#mshaban-schedule
1 messages · Page 1 of 1 (latest)
can you share the code you used and the request ID req_xxx for the error?
but the mistake you're making probably is you forgot to pass the current phase in the call
it's confusing but you would need to re-declare the current phase every time, like
{ start_date:subscription.current_period_start, end_date:subscription.current_period_end,
},
{ start_date:subscription.current_period_end,
// .. change to make in the next phase
},
]```
we'd need more examples of what you're actually trying to do, to help
i just need to change the price the subscription but only by the next month.
this the first call :
const schedule = await createSubscriptionSchedule({
from_subscription: subscription.id,
})
and this is the second call :
const secondSchedule = await updateSubscriptionSchedule(schedule.id, {
phases: [{
items: items.items,
start_date: subscription.current_period_end
}, ],
})
and this the requestid :
requestId: 'req_poE16aYLDJqiCG'
Thanks for the request ID. Taking a look
Apologies, the server got busy for a moment. I got pulled away but am looking again now
Ah I see. You should replace the variable you are using to pass in your start date the phase start and current period end differ here hence the error message.
It looks like you already have the schedule, so you can probably just do something like schedule.phases.data[0].start_date
bro what i need is just to change the subscription price permanently starting from the next month.
i can do it using stripe dashboard but i cant do it using apis, so please help me to do it using stripe apis
Gotcha. Missed that detail when catching up. So you need to pass in your current phase in your phases array before adding the one with the new prices
It would look something like this:
const secondSchedule = await updateSubscriptionSchedule(schedule.id, {
phases: [
{
start_date: currentPhase.start_date,
items: currentPhase.items,
iterations: 1
},
schedule.phases.data[0],
{
items: items.items,
}, ],
})```
I didn't get a chance to run that, just based on your current code. Basically you want to pass in your current phase as the first phase and pass in iterations: 1 which will tell us to end the phase once the subscription cycles
it wokrs now, thanks you 🙂
but i have question, after the second months with the new price finish, what will happen in the third month will the price be changed? or it will still as it forever?
i mean the new price, i need it to not be change
With that schedule, it should continue