#dopeboyz
1 messages · Page 1 of 1 (latest)
hello! are you trying to calculate the proration charges to display to the customer? If so, you can make use of https://stripe.com/docs/api/invoices/upcoming
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I want to show the proration charges to customer before upgrading a plan
So the customer will be aware about the additional charges
you can use https://stripe.com/docs/api/invoices/upcoming
But this will only get me the upcoming invoice
Let me explain you
Suppose a user want to switch from basic to premium plan, so we want to show all the proration or additional charge that he may have to pay in addition to subscription price before he upgrades the plan
like what the documentation mentions You can preview the effects of updating a subscription, including a preview of what proration will take place.
Before upgrading the plan?
yes
Can you explain a lit more
which specific part would you like to know more about?
How do i get the proration charges before upgrading the plan
pass in the details of what you'll like to update into that API (and other necessary parameters), then you'll be able to preview the upcoming invoice (which includes the proration charges) in the response. You can display those details to the customer
i'd suggest trying it out, it'll be easier for you to understand if you view the response
Using the invoice api?
Okay I'll give it a try
Hey @fringe kayak still here?
What parameters should i pass to preview the upcoming invoices
i would pass in the subscription , subscription_items.id and whichever other parameter that you want to update under https://stripe.com/docs/api/invoices/upcoming?lang=node#upcoming_invoice-subscription_items