Since there's no way to create plans that are disassociated from individual charges, I'm not sure how to manage feature access if my app is going to have multiple subscription tiers.
For example, a "Standard" tier account may have access to features A and B, but not C, which requires a "Pro" tier account.
I'm not sure how best to do this with the current API, given individual charges can be given unique names, prices, etc., rather than being tied to some established "plan" type. What'd make most sense to me, in an ideal API, is:
- I create a "Standard" plan. Shopify gives it an ID of 1.
- I create a "Pro" plan. Shopify gives it an ID of 2.
- If a user chooses Standard, I create a new charge, all I supply is a plan id of 1.
- If a user chooses Pro, I create a new charge, all I supply is a plan id of 2.
Any guidance on how best to do this with the current Billing API would be appreciated. If I create recurring charges and give them all the name "Pro", how can I go about checking a user's tier when deciding if they have access to a feature? Thank you!
Solved! Go to the solution
This is an accepted solution.
You need to manage these things on your own end.
Add a 'plan' column to the Shops table or where ever your keeping your merchants shopify_domain and api_token.
When your charge is activated update the column with the appropriate plan, you can use the charge title to determine which plan has been subscribed to.
And whenever user changes the plan just update the column.
If your plan settings are complicated you can have your own plan table from where id is referenced in the Shop table. Although if you only have a hand full of plans just put them in memory with a hash or something.
Restrict features using the plan column.
Gotcha. Thanks for the response. I figured I may need to do this if there wasn't a good way to do it on the Shopify side.
As an aside, it feels a little gross that I can create an arbitrary charge on the Shopify side without any validation against existing plans. It'd be awesome if there was built-in support for multiple subscription tiers within Shopify itself. Seems like it'd be less error prone.
Again, thanks for the response!