#markta_api

1 messages ยท Page 1 of 1 (latest)

craggy hamletBOT
#

๐Ÿ‘‹ 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/1289257602525433946

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

harsh ether
#

Hi ๐Ÿ‘‹

The error message is correct you cannot both specify phases and create a Schedule from a Subscription in a single API call.

You will need to separate these actions into two API calls instead

slate karma
#

I understand, thank you!

harsh ether
#

Okay great! Be aware that you will likely want to copy the initial array of phases from the Schedule that you create and then add new phases to it, passing the whole array back to the API for the update.

Updating Schedule phases is a little weird. It completely overwrites the existing data instead of merging it. So even if you are not changing the first phase, you still need to provide the data when you make the update.

slate karma
#

got it, thanks for the heads up. So something like this should work: ``` const newSchedule = await stripe.subscriptionSchedules.create({
from_subscription: subscriptionId
});

            const updatedSchedule = await stripe.subscriptionSchedules.update({
                newSchedule.id,
                phases: newSchedule.phases.concat([
                    {
                        items: [{ plan: quarterlyPlanId, quantity: 1 }],
                        iterations: 12
                    }
                ])
            });```
#

After the final iteration is finished, if I don't specify a cancelation, will the plan on the final iteration continue indefinitely?

harsh ether
#

Yes, that looks good. And yes, the default behavior is release so when the final iteration ends, the subscription continues to bill with that configuration until canceled

slate karma
#

Thanks for yoour help!