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.
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:
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
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.
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.