Skip to content

Instantly share code, notes, and snippets.

@LarryUllman
Created July 23, 2014 14:49
Show Gist options
  • Save LarryUllman/fbe8db2f1ecc6c92e74a to your computer and use it in GitHub Desktop.
Save LarryUllman/fbe8db2f1ecc6c92e74a to your computer and use it in GitHub Desktop.
Stripe - Calculate Subscription Proration
proration cost = (period end - API request time) / (period end - period start) * quantity * plan price
@ggcespia
Copy link

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