I’m a new developer working on a Shopify app and have been going through the Managed App Pricing documentation. I have a couple of questions regarding best practices:
Is it necessary to include a navigation menu/link to the billing page? I understand that Shopify hosts the plan selection page at the URL: https://admin.shopify.com/store/:store_handle/charges/:app_handle/pricing_plans. To enhance the merchant experience, is it a good practice to add a link in the app’s navigation menu that redirects to this page? Or would this be redundant since Shopify already manages the billing process?
What is the best approach to track and manage subscription status? My app is using Shopify’s Managed App Pricing with time-based subscriptions and varying usage limits per tier. There are two main options I’m considering to track subscription status:
Registering for the APP_SUBSCRIPTIONS_UPDATE webhook to get updates when a subscription changes, then storing that data in a database.
Using the Billing API directly to query subscription information.What approach do you recommend, or should both methods be combined for better reliability?
For your first question, since Shopify is managing the app’s plan selection/billing page, you don’t explictly need to link to it within your app’s navigation link config, but it’s up to you if you’d like to do that.
It may make it more easy for merchants to quickly access the page, so from a usability stand point, I don’t think that’s a bad idea in general.
For your second question, I would definitely advise combining the two approaches if you can. You’d get the benefit of getting the subscription update info in near-real time via the webhook, but also have a built in reconciliation redundancy through the query itself if needed. Our webhooks are fairly reliable, but we can’t always guarantee delivery, so staggered polling is always recommended as a redundancy if possible (more info here).
I want to testing the subscription cancel operation in my development store, but i cannot find the cancel entry. Is the cancellation triggered only by uninstall the app?
Hey @Qiangqiang_Zhao - you’re correct here. If your app doesn’t offer a free plan, the APP_SUBSCRIPTIONS_UPDATE webhook would only trigger when the app is uninstalled.
If you did offer a free plan, it should trigger when the plan type is changed though which you could use to see if a paid plan has been cancelled (it should also change if someone upgrades to a lower or higher tiered plan).
Hope this helps - let me know if I can clarify anything as always here
If the paid plan is effective until the next billing cycle, why is the currentPeriodEnd null when it is cancelled? How would one understand if the paid plan is still effective ?
Hey @aciulpan - hope I’m understanding correctly, but if you’re looking at the AppSubscription object itself, you should be able to see the status of the subscription by checking the status field, where for cancelled subscriptions, it should show the CANCELLED enum.
If you need to check the interval timing for subscription plans, this info should be in the pricingDetails object under plan (when looking at a specific usageRecords record - which you can compare against the createdAt value to see when that specific usage record was made. Basically, if the current date is still within that billing period, the subscription should still be effective
Hope this helps/makes sense - let me know if I can clarify anything here!
Hello, thank you for your answer. I thought the usageRecords are only used for usage based pricing and not recurring pricing like in my case?
Which createdAt field are you talking about? The one on the usageRecords?
Thanks for clarifying, @aciulpan! You are correct, usageRecords would be empty if you’re not using usage-based pricing. Would you be able to share an example of where you’re seeing the AppSubscription’s currentPeriodEnd value be set to null (just sharing the App Subscription gid would be helpful)?
I can use that ID to investigate further and touch base with the team to see if this is expected behaviour.
As you can see, as soon as I click and accept the Free plan, even though Shopify says that the free plan is effective at the end of the billing cycle, the previous paid plan has currentPeriodEnd = null. What I want is a way to calculate whether the previous paid plan is still effective since currentPeriodend is null. I cannot use the createdAt + interval fields because it wouldn’t work if the previous plan had been going for longer than one month which means the createdAt would be outdated.
Thanks @aciulpan - really appreciate you sharing the response payload there - I’ll do some further looking into this and loop back with you in the thread here