#box-subs
1 messages ยท Page 1 of 1 (latest)
Has the invoice been finalized yet? I believe credit is not applied to invoices until they've been finalized
Ah okay gotcha, the invoice is upcoming. My initial query was how I could downgrade a subscription and refund the difference. Would this still be the correct approach?
There's a lot of different ways to do this, and the one that was suggested to you initially will work. An alternative is that you could use the Upcoming Invoice API just to calculate how much the downgrade refund amount would be, downgrade the subscription with prorations disabled, and then create a credit note (https://stripe.com/docs/invoicing/integration/programmatic-credit-notes) on the previous full payment to partially refund the amount you calculated
Ahh okay thank you, let me try that approach. Let me have a play around, could you keep this thread open for a few mins just in case anything else pops up? ๐
yup!
Sorry if I'm being a bit slow here; how would I use the Upcoming Invoice API to calculate how much the downgrade refund amount would be? Wouldn't it just show the current plan's price if I do it before downgrading the plan?
Let me clarify - with the upcoming invoice API, you can pass in the parameters you would use when downgrading the subscription to preview what an invoice would look like if you downgraded and generated prorations
You'd want to set subscription_items (https://stripe.com/docs/api/invoices/upcoming_invoice_lines#upcoming_invoice_lines-subscription_items) to reflect the downgrade and subscription_proration_behavior: always_invoice (https://stripe.com/docs/api/invoices/upcoming_invoice_lines#upcoming_invoice_lines-subscription_proration_behavior)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Ahhh I understand now, alright give me a moment ๐
Okay, I've generated an upcoming invoice -- just to clarify, ending_balance would be the value I'm looking for?
I think you'd want ending_balance - starting_balance (in case the customer already had some balance). Alternatively, I think subtotal would also work
Ah sweet, would subtotal be ending_balance - starting_balance? Or how is it calculated if you know?
I guess it really depends on what you want (and there are so many different fields on the invoice object) - subtotal is strictly the total of all the line items and will not include an invoice level discounts/taxes (see https://stripe.com/docs/api/invoices/object#invoice_object-subtotal). total will include all discounts and taxes, and will likely be closer to ending_balance-starting_balance
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Amazing, thanks for your time karbi. I think that's pretty much everything I needed help with ๐
Happy to help!