Plan change policies

Changing (upgrading or downgrading) plan is another thing that can be highly customizable. You can choose which ChangePlanPolicy should be used via PLAN_CHANGE_POLICY settings variable.

Plan change policy is a class that derives from plans.plan_change.PlanChangePolicy which should implement get_change_price(plan_old, plan_new, period). This method returns should return total price of changing current plan to new one, assuming that a given active period left on the account.

class plans.plan_change.PlanChangePolicy[source]
get_change_price(plan_old, plan_new, period)[source]

Calculates total price of plan change. Returns None if no payment is required.

There are some default change plan policies already implemented.


class plans.plan_change.StandardPlanChangePolicy[source]
This plan switch policy follows the rules:
  • user can downgrade a plan for free if the plan is cheaper or have exact the same price (additional constant charge can be applied)
  • user need to pay extra amount depending of plans price difference (additional constant charge can be applied)

Change percent rate while upgrading is defined in StandardPlanChangePolicy.UPGRADE_PERCENT_RATE

Additional constant charges are:
  • StandardPlanChangePolicy.UPGRADE_CHARGE
  • StandardPlanChangePolicy.FREE_UPGRADE
  • StandardPlanChangePolicy.DOWNGRADE_CHARGE



User has PlanA which costs monthly (30 days) 20 €. His account will expire in 23 days. He wants to change to PlanB which costs monthly (30 days) 50€. Calculations:

PlanA costs per day 20 €/ 30 days = 0.67 €
PlanB costs per day 50 €/ 30 days = 1.67 €
Difference per day between PlanA and PlanB is 1.00 €
Upgrade percent rate is 10%
Constant upgrade charge is 0 €
Switch cost is:
           23 *            1.00 € *                  10% +                     0 € = 25.30 €
    days_left * cost_diff_per_day * upgrade_percent_rate + constant_upgrade_charge


Values of UPGRADE_CHARGE, DOWNGRADE_CHARGE, FREE_UPGRADE and UPGRADE_PERCENT_RATE can be customized by creating a custom change plan class that derives from StandardPlanChangePolicy.

Project Versions

Table Of Contents

Previous topic

Validation of quota

Next topic

Taxation Policies

This Page