**Scope**

How Proration is calculated when a sub is upgraded/downgraded?

Formula to calculate proration.

Calculate Proration when calendar billing is ON.

Summary

Proration is calculated in two types: day-based and milli-second based.

The Formula to calculate proration : (Prorated Term / Regular Term) * Plan Amount (OR) (Plan Amount / Regular Term) * Prorated Term

Solution

Use-case: Calendar billing is set to 1st to every month and prorate immediately. Now I start a sub with 649$ on 31st JAN . Now my renewal will be 1st of FEB. So my first invoice generated will be prorated. the prorated amount for 1 day is accounting to 23.18$

The Formula to calculate proration : (Prorated Term / Regular Term) * Plan Amount (OR) (Plan Amount / Regular Term) * Prorated Term

Now according to the above formula if we calculate the above use case then -

In this case, the prorated term is Jan 31st to Feb 1st. Internally, we calculate the per-day amount by converting that to a regular term which is Jan 31st to Feb 28th. The number of days between Jan 31st to Feb 28th is 28 so 649/28 = 23.1785.

The per-day amount is then multiplied by the number of days in the prorated term which is 1 day in this case. So the final amount charged was $23.18.