How to test the Graphql billing API in apps?

Hello ,
Greetings!

This is the first time we are building an app for Shopify.

We have created a Custom app for Shopify Admin to implement our functionality to ease the returns of the items by customers.
We wanted to make this a paid app when we publish the app.
When we want to call appSubscriptionCreate API to setup the billing plan, it is giving an error. It seems this can be called only by public app.
Can anyone please let me know how to test the billing feature, preferably before publishing the app?

Thanks in advance,
Srinivasa Pradeep

Hi @Srinivasa_Pradeep

You can try pass testSubscription: true in AppSubscriptionCreate API.

Though I’m not sure if the error you are getting is because of public app but please do you mind sharing your error in detail?

For an app to use the Billing API, it needs to be a Public app, aka be verified by the App Store team and go through the standard review process. You can then choose to keep the app unlisted so only merchants with a direct link to the app can install it.

I come from a background of custom apps and billing for those is part of my retainer services, but if you’re looking to unify billing and use the Billing APIs, you’re better off creating an unlisted app and then distributing it to your merchants.

We wanted to make this a paid app when we publish the app.

Going by this line, it’s safe to assume that your current setup is to provide early access to this merchant. Doing beta / early access builds is a little messy but a good way to go about it, like I mentioned above, is to create a public app, get it through review, keeping it unlisted and then having the merchants install the app, so you have a small group of merchants who are testing the app while you can still reap the benefits of all public APIs, like the Billing API, and later when you want to go live on the App Store, you just make your App Store listing from Unlisted to Public and you’re good to go

1 Like

Hi @Srinivasa_Pradeep, are you getting the following error when you call AppSubscriptionCreate?

Apps without a public distribution cannot use the Billing API

If so, the following should fix it:

  1. Open up your app in the Partner admin
  2. Click on Distribution on the left side
  3. Choose Public distribution and click on Select

At that point you should be able to access the AppSubscriptionCreate mutation with your app, even though it’s not published on the app store yet.

1 Like

Thanks for the input. This is possible for a new app. I will try with a new app.
However for existing custom app, is there any way to test the billing api?