If upgrading (say from a $10/month to a $20/month plan 3 days into the subscription):
- Calculate the fraction of the period used to this point under the previous plan,
x
.
3 days /30 days = 0.1 = x
Note: This is approximate, since months can have different numbers of days, there are leap years, etc.
- Multiply
x
by the previous plan's billing amount,amount_prev
to get how much to credit the customer back,credit
.