We’re a Shopify partner and trying to get a use of Shopify Billing API, but reading the docs I don’t understand a few things.
We were able to create a subscription using appSubscriptionCreate mutation with an interval of EVERY_30_DAYS, which creates a 30-days license for a user on our side when the subscription is activated.
The thing which is not clear to me is how can we get programatically notified about recurring charges (when 30 days period is over and the subscription renews).
Based on the documentation, I thought we should create a webhook with app_subscriptions/update topic, but after testing it out it seems that it sends notifications only about the subscription status updates?
The documentation is quite limited and I would appreciate if someone could help me understand how subscriptions work and how can we make sure that the customer is succesfully charged every 30 days.
Few resources I found with might be helpful to you.
Create a billing attempt
To schedule and automate the billing of subscriptions, apps need to create a billing attempt. A subscription is renewed when an app makes a billing attempt. A billing attempt represents an attempt at executing a billing cycle and charging the customer payment method for a subscription contract. A billing attempt executes a contract based on the billing cycle at the origin time if provided. Otherwise, the billing attempt is created for the current billing cycle by default. You can also create a billing attempt on a specific billing cycle.
Shopify will not notify the application via Webhook after a merchant has made a successful payment, you will need to initiate a query to Shopify via the relevant API interface. You can search the Partner’s API related documentation
As far as I know, developers often don’t actively query, but wait for notifications from webhooks for subscription status updates, or from app uninstallations. When the webhook sends a notification, the billing module within the App then modifies the merchant’s usage rights. Of course, this approach has some drawbacks, but it is better than launching queries frequently.
If you find a better way to do it, feel free to share it with me.