#takahiro_sub-schedule-preview-invoice
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/1422193560769269790
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
You should create thte preview on the current phase ?
to be specific for the next cycle in this case. I have tried with subscription as it is said here: https://docs.stripe.com/api/invoices/create_preview?api-version=2025-02-24.acacia#create_create_preview-subscription_details yet it does not work due to the fact that subscription schedule exists.
Can you share the ID (req_xxx) of the failing API request?
https://support.stripe.com/questions/finding-the-id-for-an-api-request
but it does not really matter which phase I would like to create a preview in this case imo. the problem is that when subscription schedule has a phase which has already ended how can I create a preview using subscription schedule
req_HQomRcPjCXuVoC
You are making the update on phase 0 too here
Not sure I understand this part but you can't update or create a preview on a phase that already ended.
You need to do it on an upcoming phase
yes
no, according to your request you are updating phase0
in this case I should provide phases? how the payload should look like?
You pass phase0 as it (same object you get from GET subscription details) and do the changes on phase 1
I thought so too but could it be possible for you to specify which property in this request detects the change of phase 0? I tried to send the same
Can you make a GET by id on that Schedule, and share its content here ?
yes
The current phase of the Subscription:
current_phase: {
end_date: 1759104000,
start_date: 1759066216,
}
According to te request body req_O5h7nvsdya5vEb, you are sending different values for phase 0
phase 0 must have exactly the same start and end date
req_HQomRcPjCXuVoC sry I sent the wrong request id
You are setting proration_behavior: none remove that
ah nope I did not send the wrong request id lol
let me try~
do you mean proration_behavior: none in the phase 0? or under schedule_details?
yes
phase 0 right?
yes
req_FZkgnEeYQk5TxA?t=1759150022 (this is both without phase[0][proration_behavior] and schedule_details[proration_behavior])
it still fails...
req_EQfzi5bFVgVMHy (this is only without phase[0][proration_behavior])
req_EQfzi5bFVgVMHy (this is only without phase[0][proration_behavior])
Here you've changed the end_date of the phase
Please do inspect each request and make sure you aren't changing the start and end date of the phase 0
It should have:
end_date: 1759104000,
start_date: 1759066216,
but it has
"start_date": "1759066216",
"end_date": "1759104000", for phase 0 for req_EQfzi5bFVgVMHy
could you have a look the payload of req_EQfzi5bFVgVMHy?
If I get correctly you are talking about phase 0 right?
Hi, taking over as my teammate needs to step away. Let me catch up.
To fully understand what you're trying to do, you'd like to get preview invoice on the next phase and would like to change the quantity?
yes
but the problem here is phase 0
im not updating i set the same values
but the response says that You can not update a phase that has already ended. Trying to update phase 0.
Are you able to simplify the schedules, and then pass the the next phase to update the quantity, https://docs.stripe.com/api/invoices/create_preview?api-version=2025-02-24.acacia#create_create_preview-schedule_details-phases-items-quantity ? Can you pass all the current and future phases, and now past phases, https://docs.stripe.com/billing/subscriptions/subscription-schedules#previewing-schedule-creation-and-updates ?
I do not get what you mean by simplify here
ah you mean everything the same right?
I can try that
req_5n1Z5CAvBay4Ej still the same
sry I have explained a bit off. quantity 20 is already applied(since phase 1 is already current one). and I would like to see the next cycle preview. (it does not matter much probably but wanted to correct)
So you're not trying to make any updates, you're just trying to attain an invoice preview?
yes
If so, you can just pass the subscription schedule id: https://docs.stripe.com/billing/subscriptions/subscription-schedules#preview-an-invoice
for this specific case yes
but it does still not make sence
for me
if I would like to increase the quantity for the next cycle it will be the same result
I would like to know what is causing the phase 0 update
and I would like to avoid that
I think the issue is with the date, the phase end date is 2025-09-29 00:00:00 and the request was made at
2025-09-29 13:23:55 UTC
You can use Test Clocks, https://docs.stripe.com/billing/testing/test-clocks to advance time
I think you could play with the dates here to get the desire behavior
Sry but it does not solve anything tho
could it be possible to escalate and get an answer via email?
The issue is that you're trying to update a phase that has ended.
You can write in to support: https://support.stripe.com/contact
It looks like you're making these updates using the Dashboard instead of the API.
no im using stripe cli from the dashboard it should act the same
Ah, yes you're using the CLI.
as i have explain, I am not trying to update phase 0
can you check the previous chat with os4m37?
Can you verbalize exact steps you're taking here so I can try to reproduce the issue?
If you can share a step by step, I can try to replicate this on my end
- create a subscription with backdating.
- create subscription schedule req_yjymmuZ1AGQ3Fl
- update subscription schedule req_O5h7nvsdya5vEb
- create preview with schedule_details with the same phases
the importand thing here is that you have to schedule a phase for the future date and advance the date so that the current phase will be phase 1 (added from update) not phase 0
On these requests from steps 2 and 3, what are you really trying to achieve?
step 2 is just creating subscription schedule
step 3 is updating subscription schedule
I know but with what goals in mind? I'm trying to replicate the exact scenario on my end to help unblock you
req_O5h7nvsdya5vEb
as the payload, it should change the phase 0 (at this point 0 is the current one) end_date and added new phase (increased the quantity to 20).
So just so I understand, this is the last attempt you made to repro this where you are getting an error? Also, it looks like this invoice preview attempt was made from the dashboard. Which flow did you use to initiate it?
Off hand I don't seen any differences between the subscription schedule's phase 0 and what you're passing in the request
problem here is that the response says i am updating phase 0 but I set the same thing
im just trying to create preview
req_O5h7nvsdya5vEb my question is why this is giving an error response
does this mean that I have to recreate the subscription schedule if it contains the phase which has already ended?
in order to create preview
I think you shared wrong request id. That's a successful request to update a subscription schedule
ah sry
That's why I was using that older request id req_5n1Z5CAvBay4Ej as an example
req_5n1Z5CAvBay4Ej
Curious how you made that from the dashboard
Because to me this looks like it might be a bug
Trying to understand the exact steps you made in the dashboard to make that request
i didnt do this all the steps from dashbaord
Right but that request specifically was made from dashboard
The create preview at least
create preview is from dashbaord but using stripe cli
Ah cli
Ok
I don't think you're doing anything wrong here... Let me check with a colleague to make sure
My guess is this is a bug
thank you so much for the support
Sure, np
Will get back to you when I hear back from my colleague. Waiting on their response
sry i have to leave now but i will check later this conversation
Ok so they think this might be a gap with the invoice preview api where we only provide a way to pass coupon within phase.discounts[0].coupon but you specified coupon when creating the schedule within phase.coupon
But, passing in past phases isn't required with subscription schedules. You only need to pass in current and future ones: https://docs.stripe.com/api/subscription_schedules/update?api-version=2025-08-27.preview#update_subscription_schedule-phases
So I recommend trying again by only passing in the current phase