Created
July 23, 2014 14:49
-
-
Save LarryUllman/fbe8db2f1ecc6c92e74a to your computer and use it in GitHub Desktop.
Stripe - Calculate Subscription Proration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proration cost = (period end - API request time) / (period end - period start) * quantity * plan price |
@bocharsky-bw it is the actual time, like date() now() or wathever. As of Stirpe uses unix time you should be able to use it to.
I would use this for a yearly subscription: quantity * plan_price * 12 * (period end - Api request time) / (period end - period start)
You compute a ratio of the time left / total time, then multiply that by the annual cost.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is
API request time
and how to get it? Is it a time in seconds?