#bruce-zhang_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1278448412160692301
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello
Yeah if you want that level of customization then you are going to need to build your own UI to handle upgrades/downgrades
Hi, in API level, what should I use to achieve this behavior
Well first, why do you want to cancel a Subscription and create a new one?
Why not just update the Subscription Item?
Yes we can also do that. Will that be easier?
Yes
Doing this way will need more complicated logic to handle updating subscription at our backend, but if that's easier to integrate stripe api then we are ok with that
You can do either way, but just updating the Subscription is much cleaner
In terms of how to go about doing that using the API, we detail that here: https://docs.stripe.com/billing/subscriptions/upgrade-downgrade
You want to set proration_behavior: 'none' and billing_cycle_anchor: 'now' if you want to charge immediateley for hte full price with no proration
Can I do this on the customer portal?
No not with the limitations that you want
You can't reset the billing anchor with the Customer Portal
For billing_cycle, my upgrade and downgrade behaviors are different, upgrade will work immediately and downgrade will wait until the priod ends
so this is the problem right? Customer portal can not handle this
Customer Portal can't do either of those things, no.
Cool. Can you give me some instruction about the api to do upgrade and downgrade in this logic?
Yeah so I already mentioned above how to do the upgrade
You update the Subscription Item to the new Price and use proration_behavior and billing_cycle_anchor like I mentioned above
For downgrading you'll have to use a Subscription Schedule if you want to wait until the end of the cycle to trigger the downgrade: https://docs.stripe.com/billing/subscriptions/subscription-schedules