Embedded app test charging

I try to migrate to AppBridge from standalone applications and because my apps are over 10 years old my code got rusted. There are so many changes in the shopify platform and especially on the authorization and billing part.

So I already have a public application, and I created a test application to develop my app. My application is authorizing using the latest AppBridge and my legacy code tries to charge the shop using billing API.

My test application is in Draft mode (like it’s going to be live, but I haven’t press the submittion yet), and I have installed the application using the ‘Test your app’ → ‘Select store’ button from the app overview.

After the installation, I make a request to Shopify Rest API to get the latest charge and I correctly get an empty response since there were no charges yet.

When I try to create a new charge using the Rest API, I get a 403 forbidden response.

I haven’t setup managed or manual pricing, since there is no option to do that, my listing isn’t published, i can’t edit the pricing.

I don’t know how to move from here. Can anyone help me?

HI @Menelaos_Vergis

When I try to create a new charge using the Rest API, I get a 403 forbidden response.

Can you please share the request details? I’m not sure if you’re trying to create a usage charge, one time charge or trying to create a subscription.

The answer depends on which REST endpoint you’re using.

I suspect you’re creating a one time or usage charge, if that’s the case then the problem is that you’ll first need to create a subscription and the merchant has to accept it.

Then you’ll be able to create usage charges from the Subscription’s line item ID for your usage component in the confirmed subscription.

1 Like

Hey all :waving_hand: - just+1ing @Dylan’s answer here. If you’re trying to create a one time/usage charge, you’d need to first create a subscription to attach it to (usage charges are “child” charges that live under a parent subscription).

We have a decent guide here on how to do this in GraphQL that might be helpful: Create usage-based subscriptions

If you’re still seeing 403 errors after you try those steps though, if you could share an X-Request-ID from the API response headers we send out, I can definitely do some digging into our logs to investigate further..

Hi,
Thank you for responding.
After I exchange the Session Token for an Offline Token, I make a call to the Rest API ‘/recurring_application_charges.json’ with data the charge and the ‘test:true’.

I am not making an one time charge, I want to create a monthly subscription.

Hi,
I am trying to create a monthly subscription using the rest api ‘recurring_application_charges.json’.

Since I just created this test app, can I use the Rest API for charges or am I restricted to only use GraphQL?

Could this be the reason for the 403? Is it because the app is created after the REST API ban?

Please see the billing process in this flow chart: About billing for your app

  1. Create a subscription through the GraphQL API
  2. From the response, redirect the merchant to the confirmation URL generated from step #1
  3. Merchant accepts the subscription, which activates it
  4. Then you’ll be able to create usage charges, retrieve subscription details, etc.

Since I just created this test app, can I use the Rest API for charges or am I restricted to only use GraphQL?

Please see this notice in the docs:

The REST Admin API is a legacy API as of October 1, 2024. Starting April 1, 2025, all new public apps must be built exclusively with the GraphQL Admin API. For details and migration steps, visit our migration guide.

So if your app hasn’t been published on the app store yet, most likely it will need to be migrated to GraphQL anyway.

have you select your distribution such as public distribution. if your use billing api

1 Like