#jayy-proration-calc

1 messages · Page 1 of 1 (latest)

rapid thornBOT
delicate forum
#

Hello
I don't believe the API supports that today unfortunately. You can only preview prorations for an invoice (not custom amounts)

silent ledge
#

alright.. and is it possible to know how prorations are actually calculated? to the second, minute hour in stripe?

#

atleast i can then do the calculations approximately to display xD

delicate forum
#

Hmm, let me see if we have any docs on this

silent ledge
#

alright 🙂

delicate forum
#

So we calculate by the second.
https://stripe.com/docs/billing/subscriptions/prorations

The prorated amount is calculated as soon as the API updates the subscription. The current billing period’s start and end times are used to calculate the cost of the subscription before and after the change.

So, first we calculate the time fraction from the proration periods and the initial subscription periods:
(see first screenshot)

Then, the calculated time fraction is multiplied by the total amount for each price
(see second screenshot)

silent ledge
#

oh awesome! Thank you!

delicate forum
#

NP! 🙂 Happy to help