How to use Billing API correctly for public shopify app

Broly
Shopify Partner
2 0 2

Hi Guys, 

New to shopify developers platform and facing issues understanding basic billing related queries. I have gone through Billing API flow, Billing API and its usage, and have some queries, would be great if any of the Shopify gurus can help answer these.

1. In case of a paid app with recurring monthly charges, does Shopify automatically charge app fee from merchant/store or do I need to use Shopify Billing API?
2. If I need to use Shopify Billing API, when do I need to call billing API, is it every month on some specific dates to trigger billing or is it just a one time step during app installation?
3. Can I launch an app as free and then later make it a paid app?  
4. What are the options to make an app free for certain subset of users during initial days of app launch and later make it paid? 
5. How can I charge any customer different recurring charges based on their certain usage like number of users in store, premium features etc.

Thanks,

mortdavi
New Member
2 0 0

I would also be very interested in hearing the answers to the questions above.

0 Likes
Zameer
Shopify Staff
Shopify Staff
295 32 74

Hey Broly,

The questions to most of your answers can be found in the two pieces of documentation which you included, but here's a brief summary:

  1. If you've activated a RecurringApplicationCharge with the Billing API, the merchant will automatically be charged a fixed-value every 30 days.
  2. You call the Billing API twice during setup. Initially to create the charge, which you then get the merchant to approve, and finally to activate the approved charge using the charge_id which Shopify returns to you. If you created a RecurringApplicationCharge then you only need to activate the charge once during setup
  3. Yes! When transitioning to a paid app, you would just have to create an ApplicationCharge (or RecurringApplicationCharge) for each merchant.
  4. The options are endless and this is completely up to you! After a merchant has installed your app, you choose exactly what events and conditions trigger the creation of the ApplicationCharge. This could be checking to see what the total number of products are, the number of transaction passing a certain threshold, even the name of the shop containing a certain substring. The logic for this implementation is entirely left up to the developer. 
  5. Again, this is all possible within your implementation. All you would have to do is implement the appropriate logic when calling the Billing API to create a charge. Before creating the charge, you could take a look at any property of the given shop and then trigger the API call with the appropriate parameters for that subgroup.

Hopefully, this helps shed some light on the process. This FAQ document is also helpful when running into issues: https://help.shopify.com/en/api/app-store/charging-for-your-app/faq

0 Likes
mortdavi
New Member
2 0 0

Follow-up questions - who handles the sensitive payment information? I.e. What exactly does the developer have to store, do we have to take card details etc. or is that all done on Shopify's end?

 

Finally, best case scenario (although I know this is ambiguous, it'd be good to have a ball-park), what would you say is the minimum number of lines of code required for a very basic implementation (standard monthly charge for each user)?

 

Are there any examples out there you could point us towards, on GitHub or something? Sample code would be helpful to see how it all works in the backend.

0 Likes
Zameer
Shopify Staff
Shopify Staff
295 32 74

Hey,

Developers never need to worry about dealing with payment information as that is all taken care of by Shopify once the appropriate calls are made with the Billing API.

In terms of a minimalist implementation, I would imagine that making a POST request to create and activate a RecurringApplicationCharge immediately after your app is installed (regardless of any other parameters), would be the easiest approach. Obviously, the assumption here is that there is a single fixed price for your app, with a potential free trial period. Such an implementation shouldn't take more than a dozen lines of code.

There currently isn't any official Shopify examples that I can point you to, but this may be something that we will be adding in the future.

0 Likes
__will
New Member
2 0 0

Did any examples ever get posted? The documentation is incredibly sparse.  The API  documentation and the shopify_api gem are understadable, but some examples of how to use the api woud be helpful.  I see request for this all over the shopify forum, youtube comments etc. 

0 Likes