How can I change the interval of a user's active plan?
Let's say a user first buys a subscription with a monthly interval. They now decide that they want to pay yearly, since that one has a discount. How can I change that user's subscription interval from monthly to yearly? Is there a function provided by BA, or do I have to do this manually with stripe's sdk?
18 Replies
Pretty sure the BA stripe plugin re-exports most if not all of the stripe sdk client n stuff
Also I'm a bit hazy on Stripe, but for all the stripe-based services like polar and lemonsqueezy, you need to switch plans to switch the interval, you can't just change the interval like that, so you'd create separate plans for each of the monthly/weekly/yearly variants you'd have
Yeah, I just rechecked, you can't just change the interval on a stripe plan
You have to make products/subs for each interval
So you mean in Product Catalogue I should have new products for each plan and interval instead of 2 prices within one product, like I have here?

Cause right now, my "Basic" plan has these 2 prices. I thought that was the correct way to setup a subscription plan that has 2 different intervals.

Because in my stripe auth config I have the 2 prices defined like this, as it says in the docs for my "Basic" plan
How's your better-auth stripe plugin set up?
The docs show this:
Think if you just change the
annual: true
thing, it should switch which version of the plan you get
Since you have the annualDiscountPriceId
set up
Proration settings should probably be in the stripe dashboard if you're talking about that
stripe should handle the price differencesI tried that, but then I get the error that the user is already subscribed to that plan.
Hmm
Also usually most platforms have you cancel the monthly, or let it end before switching to yearly
Is that behaviour usually possible with the stripe sdk?
tbh, I have no idea π I never used stripe before, was hoping BA would make my life easier π
Well, as far as i remembered, it couldn't
Also you have noooooooo idea just how much easier the ba plugin makes itπ
Especially the createCustomerOnSignUp, and the webhook things
But yeah, usually that's what you're supposed to do
Also I'm pretty sure the ba plugin fully re-exports the Stripe client, so there's probably not alot of things that aren't possible with it
Ah I found the docs on stripe. It is a bit of a hassle to change the interval
https://docs.stripe.com/billing/subscriptions/billing-cycle#changing
Setting the subscription billing cycle date
Learn how to set the billing date for subscriptions.
Does it tho? Where do you see that api?
I guess you could try the openapi plugin, it'll expose all the routes ba uses, but no, I'm talking from experience, i don't actually know if that's 100% the same, but when shifting my polar and stripe projects to ba, all the same things were available as usual wuth their own sdks
No, i wouldn't recommend that, it will cause alot of edge cases, also this doesn't change your plan, this changes only the billing cycle date
Aka if your user has a monthly subscription, this article only shows you how to change what day his month renews on
Not moving it to yearly
hmm, I see
Some question to that btw, since you mentioned creating customer on signup. I got the same config enabled and experienced some issues I explained here. Are u using a secondary storage in your auth configs too (i for example use redis)? And if so, are you also experincing this issue?
https://discord.com/channels/1288403910284935179/1363601316202680432
Hmm, well, I'm using the official convex adapter (not the ba one) as my main db, so i don't really need a secondary storage, although seeing the thread and the issue, I'd say maybe you wanna manually set up a few hooks to also update your redis store?
Stripe | Better Auth
Stripe plugin for Better Auth to manage subscriptions and payments.
onCustomerCreate