User can't subscribe again after canceling ( Stripe )

I'm using stripe basically after subscribing, and cancelling, when the user would want to subscribe again, it's not possible it looks like there's already a record with referenceId in Subscribtions table with canceled status should I remove that record immidietely after user cancels? or somehow ( dunno how ) get that referenceId and upgade?
No description
20 Replies
aqua
aquaOP2mo ago
@The Untraceable
The Untraceable
The Untraceable2mo ago
Stripe | Better Auth
Stripe plugin for Better Auth to manage subscriptions and payments.
aqua
aquaOP2mo ago
"successfully restored subscribtion" but nothing happened
The Untraceable
The Untraceable2mo ago
Hold on lemme just double check something
aqua
aquaOP2mo ago
No description
aqua
aquaOP2mo ago
No description
aqua
aquaOP2mo ago
here's my stripe billing portal setting
The Untraceable
The Untraceable2mo ago
https://github.com/better-auth/better-auth/blob/canary/packages%2Fstripe%2Fsrc%2Findex.ts#L753-L862 just scanned through this, i dont see anything immediately wrong with it. How do you call that endpoint?
GitHub
better-auth/packages/stripe/src/index.ts at canary · better-auth/b...
The most comprehensive authentication framework for TypeScript - better-auth/better-auth
aqua
aquaOP2mo ago
No description
aqua
aquaOP2mo ago
No description
aqua
aquaOP2mo ago
I can't restore them because cancelAtPerionEnd is false but that's not the problem imagine a user that 1. subscribes 2. cancels 3. next month or few months want to subscribe again he's unable to subscribe again and can't restore it @The Untraceable any more ideas?
The Untraceable
The Untraceable2mo ago
I dont see what you could really do apart from deleting the customer after the subscription. I'm not 100% sure though maybe someone else might know
aqua
aquaOP2mo ago
I thought the same since every data is still in stripe I'ma delete Subcribtion data after user cancels and see what happens
aqua
aquaOP2mo ago
No description
aqua
aquaOP2mo ago
also that does onSubsciptionDeleted do? also
aqua
aquaOP2mo ago
No description
aqua
aquaOP2mo ago
something wrong in better auth I guess because I user can't subscribe even if all previous subscriptions are canceled @The Untraceable I changed the referenceId to not be @unique it works but dunno what are the risks of doing that
The Untraceable
The Untraceable2mo ago
You're gonna have multiple stripe customers I think not 100% sure Just make sure if you migrate your DB you make sure you set it back to unique or it'd break things
aqua
aquaOP2mo ago
do you have a public repo with how you do it? I mean using stripe with better auth
The Untraceable
The Untraceable2mo ago
Nah i dont

Did you find this page helpful?