#Hydriad
1 messages · Page 1 of 1 (latest)
I tried releasing the schedule from the subscription a la https://stripe.com/docs/billing/subscriptions/subscription-schedules/use-cases#releasing-subscription, but then couldn't update it or replace it
Hello
Hi! Happy to answer any clarifying questions
ok here's the first time which succeeds:
const updatedSchedule = await stripe.subscriptionSchedules.update(
`${subscription.schedule}`,
{
phases: [
{
items: [
{
plan: subscription.items.data[0]?.plan.id,
quantity: subscription.items.data[0]?.quantity, // existing capacity
},
],
start_date: subscription.current_period_start,
end_date: subscription.current_period_end,
},
{
items: [
{
plan: subscription.items.data[0]?.plan.id,
quantity: body.cap, // new capacity
},
],
start_date: subscription.current_period_end,
},
],
},
);
which worked. but then trying to do that a second time results in error "You can not update a phase that has already ended. Trying to update phase 0."
If you release a schedule you can't update it.
You would have to re-create it
Unless I'm misunderstanding what you are trying to accomplish?
ok thank you, how can I re-create or replace a schedule on an existing subscription? I tried
const schedule2 = await stripe.subscriptionSchedules.create({
from_subscription: subscriptionId,
});
and got the error "You cannot migrate a subscription that is already attached to a schedule"
That error should only fire if you still have a schedule attached
You used https://stripe.com/docs/api/subscription_schedules/release prior to that?
i'll try that right now
you mean like this right?
const releasedSchedule = await stripe.subscriptionSchedules.release(
scheduleId,
);
const newSchedule = await stripe.subscriptionSchedules.create({
from_subscription: subscriptionId,
});
Yep
I get the error "You cannot update a subscription schedule that is currently in the released status. It must be in not_started, active status to be updated."
Hmm sounds like you already released that schedule?
yes in the line above creating it is where it's released
is there a way to remove a schedule from a subscription entirely and then create a new one?
or remove all phases from a schedule?
Sorry I don't understand. The error wouldn't be saying "You cannot update a subscription schedule" if you are creating a new one
okay i'll try commenting out everything else that might be interfering, thank you so much so far