#coachleyton
1 messages ยท Page 1 of 1 (latest)
hello!
Hi!
I think your best option here would be to use upcoming invoices - https://stripe.com/docs/api/invoices/upcoming
You'd use that on your /v1/product/plans/checkout page to preview what the subscription's first invoice would look like if it was created
ahhhh I see. Okay, so using this, I can provide the details of the hypothetical Subscription, and then see the first Invoice it would generate? And this would be totally equivalent to the effect I'd achieve using the Quotes API?
For example, in the case of a subscription upgrade or downgrade, I'd see pro-rations and stuff? Or in the case of a discount being applied, I can see what effect that would have?
yup!
it should mirror the exact invoice you'd see if you were to go and make the same request for real (with the subscriptions api)
This is epic news
Alrighty. Are you okay to leave this thread open temporarily? I might have some related follow up questions that some future Discord user might want to see should they stumble across this thread
yeah I can definitely leave it open a bit longer - I need to head out, but orakaro is around if you have questions
Perfect, thank you
๐ LMK when you have follow up!
@languid cairn Hi, back again. I'm having a little trouble regarding prorations on the upcoming invoice. Basically, I'm able to see subscription items for when a positive amount is due, but not for when a negative amount is due.
So, here are the options that I'm passing to the Upcoming Invoice API:
In the returned invoice, I only receive one "item":
So I actually did the subscription change, and the real produced invoice did actually have 2 items, as I would have expected:
Weird. The amount due on the upcoming invoice was 77 pence, which is very close to the actual invoice amount. So I think it's being calculated correctly, I'm just not seeing that Subscription Item ("Unused time on Lite"):
hmm weird, can you paste the full response output ?
Can do
Okie, and the request id that you called Upcoming Invoice API
And gimme some time to look at it!
ahhhh how would I go about getting that information? My apologies for my ignorance
No problem lol
https://dashboard.stripe.com/test/logs <- Dashboard request log
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Just testing but could you try again but passing expands: ['lines'] when you call the Upcoming API?
I think you have already made the change so you want to start over fresh
Sure, I'll give it a go
Well rather I can just downgrade rather than upgrade, and I should still see 2 line items
Yeah so now I'm doing it where I try to downgrade from Standard to Lite, and I should see two line items, one "Remaining time on Lite" and one "Unused time on Standard", but I'm only seeing the "Remaining time on Lite"
expand lines added here
Request ID of the new request with lines expanded: req_XwSGkZ0wtdLOpN
Full invoice response
Hmmm
Is the request I'm making definitely correct?
my c# UpcomingInvoiceOptions object I mean
(praying this isn't an API bug btw. Don't wanna have to re-work my flow to incorporate Quotes lol)
No it looks good
indeed
I may need some time to reproduce it
But on top of your mind is there anything unusual/special on your Subscription setup?
I don't think so? Well here are my subscription creation options:
I think that's pretty normal...
or at least, there's nothing wacky going on
Here are my subscription update options too, incase updating those are dodgy:
(excuse the comments)
My apologies if you're busy btw
np it's just take some time to reproduce
No problem ๐
Ah
When you call the UpcomingInvoice and passing in the new price
can you also specify the Subscription Item Id? of the existing Subscription
woohoooooo
you're a life saver mate
that was precisely it
NOTE: For future users reading this thread, I have deleted images and JSON of invoices for the sake of privacy, but the information should still be valuable
@languid cairn Thank you very much for your help here. I'm happy for you to close this thread ๐
Np! It's that the API assume you want to create a new Subscription Item alongside with what existed. So it simulate the case you need to pay an extra more item
That's it ๐
That makes perfect sense ๐