#tom_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/1465366754036416535
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- tom_api, 5 days ago, 15 messages
I think I'm misunderstanding something here RE
req_Dpl7unlCElUwFC
I'm trying to make a change to an existing subscription and get a preview invoice to tell the customer how much they need to pay now to make the change to the plan.
Hello, taking a look.
Thanks!
And you've made this same call otherwise but got the expected invoice items back?
I'm trying to get it to return two lines:
- Unused time on 5,000 players - -$2.49
- Remaining time on 10,000 additional players - $4.98
- $2.49 to pay
I did earlier today but I must of changed something without reallising, been scratching my head trying to solve it for hours now
Can you look through your dashboard logs for a previous example of this call that did work as expected? https://dashboard.stripe.com/test/logs
I've deleted all the test data unfortunately since
The request logs should still exist unless you deleted the sandbox account itself
Ah ok one moment
req_09YaQ2nvvMaMpP looks good
Shows:
- Unused time on 45000 ร Additional Players after 24 Feb 2026 (-2159)
- Remaining time on 65000 ร Additional Players after 24 Feb 2026 (+3119)
In the lines, the data.parent.proration = true on the working one, and false on the not working one
Manual refers to:
The recommended way to get only the prorations being previewed on the invoice is to consider line items where parent.subscription_item_details.proration is true.
But I'm not sure how that is set?
Can you link to that manual section?
Ah I think that that section is just saying that that is how you can tell which invoice items specifically came from a proration.
And thanks for that other request. That does help explain one of your questions.
In req_Dpl7unlCElUwFC (the one with proration items + cycling items) you passed proration_behavior: 'create_prorations' which tells Stripe to create invoice items about the proration but to not immediately charge for them. That means that the invoice items will get added to the next monthly invoice that gets created.
Wheras in req_09YaQ2nvvMaMpP, you passed proration_behavior: 'always_invoice' which tells us to create those invoice items and then invoice for them right now right away.
If you want an invoice that is only for the proration items and you want it to be sent right away, you should pass proration_behavior: 'always_invoice'
req_iRJCZd179G0Cy9
Just tested with always_invoice, but is only returning one line:
Remaining time on 10000 ร Additional Players after 26 Jan 2026
I'm expecting a second line, unused time up to this point on the 5000 additional players
Right, still looking in to that part.
OK thanks
Can you try that call again but with a proration date that is a full day out in the cycle? I am curious if this is an issue with the unused time amount being too small because the period is less than an hour. I don't think that is the issue because that hour should still cost a decent amount but it would be helpful to rule out
OK one moment
+2 days,
req_PKFSQuNg5tXuwu
same issue
I'll try a bit further ahed
same issue
req_0OfJ5OQGmWknjG
Sounds good, also apologies I mixed things up.
To lay it out to make sure I am getting it: the user already paid ~$2.50 and this new invoice is for ~$5. Almost none of the month has happened, so they should be credited almost all of that $2.50 no credit item is in this preview.
Yes correct
Looks like I need more coffee
I'm building a page to allow them to adjust the units of their subscription.
Can you try actually making that update in test mode to see if the invoice generated actually has that unused time item or not?
That can narrow down where this issue may be
one moment
I'm not sure if my process is correct, but:
- Generate the preview invoice
- Then create a new invoice copying over the lines
- Then charge the customer
Thsi is the result:
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Hmmm... I'm generating the invoice for the customer NOT the subscription
Wheras the test clock is for the subscrption only...
Could this be the issue?
Ugh no sorry ignore me
This is all so confusnig
Ah gotcha, yeah there is a way simpler way to update subscriptions:
https://docs.stripe.com/billing/subscriptions/change-price
There is a subscription update API call that you can make that you can pass the same settings to as what you are passing to that invoice preview endpoint
https://docs.stripe.com/api#update_subscription
I see yes, that page does say to preview the proration as the first step:
Which si what I'm trying to do
Was working just fine this morning ๐ I need more coffee as well
Ah I see what happened now. When you made that req_Dpl7unlCElUwFC request from your first message here, the most recent update on that subscription was req_PzfU96SCjTzfJ2. That update has proration_behavior: 'none', so there wasn't an invoice from that change to prorate off of.
Basically prorations are based on what the customer has already paid, but here there isn't a previous payment for the thing you are changing from.
That's it thank you!
That's saved me such a headache really appreciate it thank you so much!
Of course! Definitely confused me for a bit as well.
Also if you haven't read through our how subscriptions work doc, I definitely recommend it. It is long but definitely helps get a solid baseline of what all these moving parts do.