Stripe plugin - upgrade() creates two subscriptions instead of updating existing one.

I have two plans, "Starter" and "Pro". If a user upgrades their plan from "Starter" to "Pro" with the upgrade() method, there becomes two active subscriptions at the same time in Stripe (see image attached). This will bill the user for both plans, which isn't correct.
No description
4 Replies
ayersss
ayersss2w ago
Yeah I got same issue here. Have u found a workaround?
George
GeorgeOP2w ago
A workaround could be to cancel the cheaper plan using the Stripe api (https://docs.stripe.com/api/subscriptions/cancel) whenever the user upgrades to a more expensive plan. This can be done in the onSubscriptionComplete() hook.
Cancel a subscription | Stripe API Reference
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
George
GeorgeOP2w ago
However, IMO this should be done automatically by the plugin.
George
GeorgeOP7d ago
@ayersss I found this issue on github. It seems to address this very issue: https://github.com/better-auth/better-auth/issues/1880. Looks like there is a fix planned. Make sure to pass the subscriptionId to the upgrade() method. This way it will work once the issue gets fixed.
GitHub
Issues · better-auth/better-auth
The most comprehensive authentication framework for TypeScript - Issues · better-auth/better-auth

Did you find this page helpful?