#jeffnv-sub-schedules

1 messages ยท Page 1 of 1 (latest)

deft tendon
#

Hello!

cursive ridge
#

Hey there ๐Ÿ™‚

#

thanks for the help

deft tendon
#

You can set an end_date (see https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-phases-end_date) if you want, but you can also just set iterations: 1 (https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-phases-iterations) so that the phase lasts up to one cycle. Once that final phase is over, as long as end_behavior on the Schedule is release then the Subscription will continue in whatever state it's in once the last phase was over

cursive ridge
#

ok

#

so if I create a schedule for a customer, and set iterations for 1

#

it knows to take effect after the current cycle?

#

or do I need to create a schedule from the current subscription first?

deft tendon
#

You'd need to first create a Schedule from the current subscription (using from_subscription https://stripe.com/docs/api/subscription_schedules/create#create_subscription_schedule-from_subscription), and then update the schedule you get back from that to add on an additional phase after the current one is over

cursive ridge
#

ok i have that

#

it makes a phase with start and end for the current period

#

so I append a new phase, with start as the current end period and iterations set to 1?

#

and end_date not set?

deft tendon
#

Almost - when you append the new phase you don't need to set a start since it'll start automatically after the current phase is done

cursive ridge
#

oh!

#

seems like order is important

deft tendon
#

Yes definitely - order of the phases is super important with schedules

cursive ridge
#

ok so i create a schedule from an existing sub

#

that prepopulates a phase with the current cycle

#

i append the next phase with iterations 1 and I'm good?

deft tendon
#

Yup! And to be more specific, when you append the next phase you need to pass in both the current phase AND the new phase when you update the subscription schedule

cursive ridge
#

makes sense, we're replacing not merging

#

cool I think I can handle it, so helpful as always thanks