When a merchant reinstalls the app, what steps do I have to take for Billing to continue?

Hey!

When a merchant registers and setups their app, using the Billing API i create a 20$/m subscription for them, they accept it, I subscribe to the subscription/updated webhook and everything is good.

But if a user uninstalls the app and then reinstalls it after an hour, what do I have to do then? Do I have to resubscribe to the webhook? Create a new subscription?

1 Like

Hey @Nikola_Milovic!

If you are subscribing through your application TOML, then you wouldn’t have to create a new webhook subscription. It should be automatically applied on reinstallation.

If you are subscribing manually, then you may need to resubscribe. You can query the current webhook subscription to confirm if it’s needed webhookSubscriptions - GraphQL Admin

Regarding the actual app billing subscription, since subscriptions are cancelled when a merchant uninstalls, but the charge will remain active for the current billing cycle, you will need to ensure that the merchant accepts a new charge before the end of the cycle so that the subscription can continue. There’s a great discussion here on the best way to handle this: Issue with hasActivePayment Returning true After App Reinstallation - #3 by KyleG-Shopify

Let me know if that helps.

Thanks @KyleG-Shopify, that is pretty much it.

But I’ve also had another worry, somewhat related, so if another subscription is created, I’ll receive 2 webhook updates

  1. For the cancellation of the first subscription
  2. For the creation of the new subscription

This seems like quite tricky to track, what if they come out of order? Or I am I missing something?

You can see an example payload here: https://shopify.dev/docs/api/webhooks?reference=graphql#list-of-topics-app_subscriptions/update

Each app subscription will have a unique GID so you can use that to track specific changes.