#WpgJetsFan13-subschedule-date
1 messages ยท Page 1 of 1 (latest)
hello, can you share the request ID for what request you made with the Subscription Schedule?
I'll have to do it again with another subscription. It is 2 requests. Hang on
actually it's 4 requests:
changed subscription plan: req_rLNwFSGmxYIawz
attach sked: req_IEuQ2FtRFRNUFw
update sked: req_ME7r94jTbFjDYh
retrieve subscription after update: req_SapOE0oNMPp8kT
The schedule object end date shows me Thursday, August 31, 2023 4:30:49 PM, which is what I want. But in the dashboard it says it will next invoice on Sept. 7, 2023
can you share which Dashboard page shows that?
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
This is the code I used to change the schedule to make it end 1 year after the creation date:
let subscription = await client.subscriptions.retrieve('sub_1LctoTCT5ZiUAGNjsPob1Cmd');
let anchor = subscription.created;
let anchorDate = new Date(anchor*1000);
anchorDate.setFullYear(anchorDate.getFullYear()+1);
let schedule = await client.subscriptionSchedules.create({
from_subscription: subscription.id
});
console.log('attach sked: ' + schedule.lastResponse.requestId);
schedule = await client.subscriptionSchedules.update(schedule.id, {
phases: [
{
items: [
{
price: oneYearPlan,
quantity: 1
}
],
start_date: schedule.current_phase.start_date,
end_date: 'now'
},
{
items: [
{
price: oneYearPlan,
quantity: 1
}
],
start_date: 'now',
end_date: Math.floor(anchorDate.getTime()/1000)
}
]
});
and if you pull subscription schedule id sub_sched_1LfUkoCT5ZiUAGNjT0ejiKhL you can see that the last phase end date is August 31, 2023 which is correct. But it doesn't update invoices correctly in dashboard
๐ Hopping in since @soft oar has to head out soon - give me a minute to catch up
thanks
Okay so for subscription sub_1LctoTCT5ZiUAGNjsPob1Cmd what is your goal? For the Subscription to cancel? For the billling cycle anchor to be reset?
So it started as a 6 month plan on August 31 for $47.94. we have a one year plan that is $71.88. I want to upgrade to the one year plan, charge them the difference (71.88-47.94) and have it renew on August 31, 2023
So it will be as if they were always on the one year plan
And continue as a one year plan renewing every year on Aug. 31
and is there a specific reason you're using schedules?
Well, I don't want to. But when I updated the plan, it changed the anchor date to Sept. 7
I don't want to change the anchor date is what it really comes down to
Ahhh because you're moving from a 6 month plan to a 1 year plan. I see
Yes
So the issue with your current schedule, is that having the last phase end on August 31 2023 is not enough. Just because a phase is ended doesn't mean we automatically reset the billing cycle anchor. You need a third phase that has the same price as the second phase, and also set phases.billing_cycle_anchor: phase_start (see https://stripe.com/docs/api/subscription_schedules/create#create_subscription_schedule-phases-billing_cycle_anchor) so that the schedule knows to reset the Billing cycle anchor when it moves from the 2nd to the 3rd phase
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I see. So basically I would end the current phase, add a phase from today until August 31, 2023, then add a third phase with the same price as the second. Then, on August 31, 2024, will it just repeat that last phase? That was another point of confusion for me. Like if I have created 3 phases, at the end of the last phase, will it repeat the last phase, or all the phases again?
Like if I have end_behavior set to renew, I don't want it to repeat all 3 previous phases