Reputation: 1
I am using redirectToBillingPortal() in which the user can change the subscription plan, that works fine as it does change stripe_price but it does not change the name assigned, looking at the forums the name is not supposed to update; but then how are you supposed to distinguish between subscription tiers with e.g. subscribed('tier2') if the user changed their plan?
I can imagine a few ways, but would like to consider what the proper way to do this might be:
intercept "customer.subscription.updated" event and update subscriptions name of that user (interfering with a managed cashier table feels odd)
write a custom wrapper that checks stripe_price and maps that to the plan (lose access to subscribed() method)
Both seem like it's definitely the wrong way of achieving this, but how else would I do this and retain subscribed('name') functionality to check pricing tiers?
I would also like to keep the external portal and avoid having to reinvent the subscription management stripe offers if possible.
Thanks!
Upvotes: 0
Views: 380
Reputation: 123
To check the plan of a user just use subscribedToProduct
method and use the product id of Stripe (eg 'prod_xxxxxxxxxxxx')
Upvotes: 0