#shroomlife
1 messages · Page 1 of 1 (latest)
Hi there! You can update a subscription and use cancel_at_period_end: true: https://stripe.com/docs/billing/subscriptions/cancel?dashboard-or-api=api#cancel-at-end-of-cycle
The subscription will remain updateable until the end of the billing period (if customers want to continue the subscription instead of canceling)
Ok thanks, I will try that.
But I get the following error:
StripeInvalidRequestError: The subscription is managed by the subscription schedule sub_sched_1MskM0AIBz8zc47oyJqXApGR, and updating any cancelation behavior directly is not allowed. Please update the schedule instead.
So I need to update the schedule when there is one. But how can I easily update the schedule to end on the phase? Is there a way?
got it, okay. you can either update the schedule's end_behavior to cancel: https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-end_behavior
or release the subscription from the schedule and then update the subscription object directly: https://stripe.com/docs/api/subscription_schedules/release
But if the schedule has like an update at the end of current period then the end of the subscription would be after the month with the update cause a phase is still there. If I use the first option.
When I use the second option the maybe updates would be lost after release of schedule right?
right, schedules get a bit complicated. when you update a schedule, you need to make sure to pass in the current phase and any phase(s) you want to keep. so if your intent is to cancel at the end of the current phase, you'd need to pass in the current phase and end_behavior: cancel but omit all other phases: https://stripe.com/docs/billing/subscriptions/subscription-schedules#updating
if a customer changes their mind and wants to continue the subscription, you'd likely just want to update the schedule again but change the # of iterations of the current phase, or add new phases as needed