#abuznego_subscription-upgrade
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/1280935695413678130
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
That's sort of a nebulous question. There are a lot of details missing from your question. What are you trying to actually do? Is there a reason you can't simply update the Subscription itself via https://docs.stripe.com/api/subscriptions/update ?
that would update the subscription right away, and not at the end of the billing period
Correct, so can you give me a step-be-step explanation of what you're trying to build? Something like:
- customer uses Payment Element to add payment method
- Our back-end creates a subscription with
<insert parameters here> - Later on in the billing cycle, they want to
<insert customer action here>, so we need to update the Subscription such that<insert behavior here>happens
in 2. they create a subscription with monthly plan A
in 3. they want to upgrade to annual plan B but maintaning their original billing cycle anchor so that no refund is needed and they are just billed for the annual one at the end of current cycle.
Okay, so in that case you could use a Subscription Schedule. You would create a new Subscription Schedule and pass in the exisitng Subscription so that it inherets the existing billing cycle and other attributes from the existing Subscription for phase[0] (https://docs.stripe.com/billing/subscriptions/subscription-schedules/use-cases#existing-subscription). From there, you would update the Subscription Schedule to have a phase[1] for the upgrade that starts at the beginning of the next billing cycle with the new upgraded Price (https://docs.stripe.com/billing/subscriptions/subscription-schedules/use-cases#changing-subscriptions)
I linked some examples of how this might look in your code, but I highly recommend testing with Billing Clocks to ensure that the expected behavior is happening.
Sure thing!
another question
would our system be able to rely on events generated by moving from phase 0 to 1 to update our system
Yup! You could listen for the relevant Subscription events and Subscription Schedule Events depending on what you need to update in your internal system:
https://docs.stripe.com/api/events/types#event_types-subscription_schedule.updated
https://docs.stripe.com/api/events/types#event_types-customer.subscription.updated
Those 2 events might not be exactly what you're looking for, but those docs describe each of the relevant events, so it's worth poking through them to see which ones would be most useful to you
ok sounds good thank you