#mckeemi_api
1 messages · Page 1 of 1 (latest)
👋 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/1419980291770155100
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
👋 happy to help
thank you 🙂
let me look at the subscription and get back to you
no problem thanks
I think you're not using the right price in the update
actually you're not passing a new price ID https://dashboard.stripe.com/logs/req_PkXaiakGuFo0W7
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
£20 per month?
look at the request I shared with you
you haven't passed a new price ID to the subscription item to change it
I thought it was maybe to do with first phase not ending straight away (because we can't have gaps between phases in the schedule) and I would have to put a trial or something in the second phase
oh sorry didn't see that this is a subscription schedule
my bad
ok now I see https://dashboard.stripe.com/logs/req_ogDeG1Bqed1qZj
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
the first phase's end_date is 2026-05-26
which means that until then the current price would still be invoiced
no worries, yeah I think that's theissue
if you want to start the new phase now you need to change the end_date of that phase
Is there a way I can end it today but not start invoicing until the 26th May 2026
It's just when I updated in test to start a new phase today it invoices today .... where as I don't wantit to invoice until the date specified
you can pass in proration_behavior: 'none'
I tried that but it still invoices today
where did you put the proration_behavior: 'none'?
would you mind sharing the request ID?
var newPlanPhase = new SubscriptionSchedulePhaseOptions
{
StartDate = (DateTime)newPlanStartDate,
BillingCycleAnchor = "phase_start",
Items = new List<SubscriptionSchedulePhaseItemOptions>
{
new SubscriptionSchedulePhaseItemOptions
{
Price = newRecurringPrice.Id,
Metadata = metadata,
Quantity=1
},
},
Iterations = (newPlan.NumberOfPayments > 0) ? newPlan.NumberOfPayments : 1, // if recurring payment make one scheduled payment & then the subcription will be released & ongoing
Metadata = metadata,
ProrationBehavior = "none",
};
Also on the current phase// Rebuild current phase with updated EndDate
var updatedCurrentPhase = new SubscriptionSchedulePhaseOptions
{
StartDate = currentPhase.StartDate,
EndDate = (DateTime)newPlanStartDate, // shorten phase to the start of the new phase,
TrialEnd = currentPhase.TrialEnd,
Metadata = currentPhase.Metadata,
Items = currentPhase.Items.Select(i => new SubscriptionSchedulePhaseItemOptions
{
Price = i.PriceId,
Quantity = i.Quantity,
Metadata = i.Metadata
}).ToList(),
ProrationBehavior = "none",
};
options.Phases.Add(updatedCurrentPhase);
the proration_behavior should be set on the old plan not the new
I've it on both
and add it to the top level of the SubscriptionSchedule
Do you mean here // Modify the phases to apply the new plan
var options = new SubscriptionScheduleUpdateOptions
{
Metadata = metadata,
Phases = new List<SubscriptionSchedulePhaseOptions>(),
ProrationBehavior = "none",
EndBehavior = (newPlan.NumberOfPayments > 0) ? "cancel" : "release", // 'release' for ongoing recurring payments, means the subscription will continue on with whatever was set in the last schedule
};
I have it there as well
Then I call options.Phases.Add(updatedCurrentPhase); options.Phases.Add(newPlanPhase);
var updatedSchedule = await scheduleService.UpdateAsync(schedule.Id, options, requestOptions);
I will re run it in test, but update the end date of the currentphase today and start the new phase today with proration_behavior set to none, just to see if the invoice will come out today, but as far as I remember it invoices at the start of the new phase which is today
Hey, taking over here. Let me know if there's any follow-up Qs I can answer!
Do you know how to resolve the issue, I want to be able to end the current phase and start the new phase but not take a payment straight away
I think my colleague just answered you on this part, right ?
You need to set proration_behavior to none and update the end date of the current phase to now
Ah ok, that's what Im running through test, I need to set the new phase start date to today also don't i? As you can't have gaps, but then how will it know that the next invoice is due on 26/05/2026 i.e. 10 months since last invoice
The ending date of a given phase needs to be the start of the next phase
Hi I have just run a test, I had to set the end date of the current phase to tomorrow as it has to be in the future. The test account I used was acct_1Rxmw5GzqfG4XYbW and the subscription Id is sub_1S18dYGzqfG4XYbW8lrpWdJ7
I ended the current phase tomorrow and started the new phase at the same time tomorrow, which has resulted in the next invoice coming out tomorrow. This is not the behaviour I need, in this example the original payment plan was weekly, this weeks has been paid and I want the next invoice to come out in a months time (as we're changing to monthly), setting proration_behaviour to none on the phases and on the SubscriptionScheduleUpdateOptions still results in the next invoice being tomorrow
Is there a way I can end the current phase and set a trial phase until the next invoice is due? Or is there anyway I can update the subscription so that the next invoice comes out on a specific date ?
this weeks has been paid and I want the next invoice to come out in a months time
The month phase, will start tomorrow right? So tomorrow the customer needs to pay for the upcoming month?
Or you want to the customer to pay at the period end ?
they have already paid this week so a month from their last payment
However was thinking would I be better to update the subscription directly and not use schedules and that way I can apply a trial to specify when the next payment is due?
Let's move with a concrete example if you don't mind to better undesrand the case:
Customer have a Subscription
- 17 Sept -> 24 Sept => 10$
- 24 Sept -> 24 Oct => X$
?
The production issue was the customer paid for a subscription that was incorrectly configured to be weekly instead of monthly so the subscription they had set up was for £20 every 10 weeks and it should have been £20 every 10 months Connected Account: acct_1NrMgUIl6FCwX8px, SubscriptionId: sub_1S0IdqIl6FCwX8pxxvsVqxJu
They paid £20 26/08/2025 & there next invoice in 10 weeks is set for 04/11/2025
Ah ok, you are trying to covering a production failure
However it should be in 10 months on 26/05/2026
You can use trial/free prices then until the count matches
yes details are at the top of this thread, so I ran code that created the new price and new phase which would start on the 26/052026 but the current phase is still running so the next invoice will still come out on 04/11/2025, I need it to switch to the new monthly plan and the next invoice to come out on 26/05/2026
How would I use trial/free prices, would I need to update the subscription directly or do I continue using schedules?
I need it to switch to the new monthly plan and the next invoice to come out on 26/05/2026
I think the straightforward workaround here, is to add a phase with a free price between the current phase and the monthly phase which start on 26/05/2026
That sounds good does that mean there will be a zero invoice though?
An invoice should only be generated at the end of a billing cycle. But I'm not completely sure whether a new billing cycle would be started when the free trial phase starts.
To be sure, this is something you can try in test mode, by setting up a subscription and schedule with this configuration, and then advancing time with test clocks: https://docs.stripe.com/billing/testing/test-clocks
I've seen the test clocks, maybe the safest option is to contact the customer and cancel the subscription and get them to purchase again using the correct configuration, doing it programmatically via the api might not be the best approach