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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.