> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bango.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Pro-ration

## Overview

Consumers can make changes to their plan at any time. Whenever a change is made to an active subscription plan during a billing period, the DVM automatically calculates a **Pro-rated Charge** or **Pro-rated Refund** based on how many days remain in the current billing cycle.

This ensures consumers only pay for what they use, and receive fair refunds for what they don't.

Here are the changes which can be made to an active subscription offer which will result in a Pro-rated Charge or Refund calculation:

<CardGroup cols={3}>
  <Card title="Upgrade" icon="circle-up">
    Consumer moves to a higher-priced Product tier.

    They are charged the price difference for the remaining days in the period.
  </Card>

  <Card title="Downgrade" icon="circle-down">
    Consumer moves to a lower-priced Product tier.

    They receive a refund of the price difference for the remaining days, starting the day after the change.
  </Card>

  <Card title="Immediate Cancellation" icon="circle-xmark">
    Consumer cancels their subscription immediately.

    They receive a full refund for the remaining days, starting the day after cancellation.
  </Card>
</CardGroup>

***

## How time is calculated

The DVM works in **whole days**. Partial days are always rounded up to the nearest full day — The DVM never issues a charge or refund for fractions of a day.

<Info>
  DVM billing uses ISO timestamps internally for precision, but all pro-ration amounts are computed at day-level granularity using `ROUNDUP(duration / 1 day)` before the proration factor is applied.
</Info>

The key difference between charges and refunds is **when the clock starts**:

| Scenario | Effective date (EffectiveTs) | Day count includes change day? |
| - | - | - |
| Upgrade (charge) | The day of the change | ✅ Yes — charged from the change day |
| Downgrade (refund) | The day after the change | ❌ No — refunded from the following day |
| Cancellation (refund) | The day after cancellation | ❌ No — refunded from the following day |

<Warning>
  **Why downgrade and cancellation refunds start the following day**

  Refunds for both downgrades and immediate cancellations are deliberately calculated from the day after the change — not the change day itself.

  This prevents a scenario where a consumer could upgrade to a higher tier, access premium features on the same day, then immediately downgrade or cancel and receive a full refund for that day.

  By excluding the change day from the refund calculation, the consumer always pays for the day on which they accessed the higher tier or held the active subscription.
</Warning>

***

## The pro-ration formula

Every pro-rated amount is calculated using the same core formula:

```text theme={null}
ProrationFactor = RemainingDuration (adjusted) ÷ TotalDuration (adjusted)

Pro-rated Amount = Price (or ΔPrice) × ProrationFactor
```

### Variables

| Variable | Description |
| - | - |
| `ΔP` | The price difference between the old and new tier (used for upgrades and downgrades) |
| `P` | The full renewal price of the canceled offer (used for cancellations) |
| `BillingPeriodStartTs` | Start of the current billing period |
| `BillingPeriodEndTs` | End of the current billing period |
| `TierChangeTs` | ISO timestamp of the subscription change event |
| `EffectiveTs` | The timestamp from which remaining days are counted (see table above) |
| `RemainingDuration (adjusted)` | Days from EffectiveTs to end of cycle, rounded up |
| `TotalDuration (adjusted)` | Total days in the billing cycle, rounded up |
| `ProrationFactor` | `RemainingDuration (adjusted) ÷ TotalDuration (adjusted)` |

***

## Scenario details

<AccordionGroup>
  <Accordion title="⬆️ Upgrade — pro-rated charge">
    When a consumer upgrades to a higher tier, they are charged the **price difference** (ΔP) for the days remaining in the cycle, inclusive of the change day itself.

    ```text theme={null}
    ProrationFactor = ROUNDUP(BillingPeriodEndTs − EffectiveTs, day) / ROUNDUP(TotalDuration, day)

    Pro-rated Charge = ΔP × ProrationFactor
    ```

    **Example — Upgrade on Day 13 of a 31-day cycle (ΔP = £50)**

    ```text theme={null}
    EffectiveTs                  = Day 13  (change day included)
    RemainingDuration (adjusted) = ROUNDUP(31 − 13) = 19 days
    TotalDuration (adjusted)     = ROUNDUP(31)      = 31 days
    ProrationFactor              = 19 / 31          = 0.6452

    Pro-rated Charge = £50 × 0.6452 = £32.26
    ```
  </Accordion>

  <Accordion title="⬇️ Downgrade — pro-rated refund">
    When a consumer downgrades to a lower tier, they receive a refund of the **price difference** (ΔP) for the remaining days in the cycle.

    The change day itself is not refunded — the refund starts from the following day.

    ```text theme={null}
    ProrationFactor = ROUNDUP(BillingPeriodEndTs − EffectiveTs, day) / ROUNDUP(TotalDuration, day)

    Pro-rated Refund = ΔP × ProrationFactor
    ```

    **Example — Downgrade on Day 18 of a 31-day cycle (ΔP = £50)**

    ```text theme={null}
    EffectiveTs                  = Day 19  (day after change)
    RemainingDuration (adjusted) = ROUNDUP(31 − 19) = 13 days
    TotalDuration (adjusted)     = ROUNDUP(31)      = 31 days
    ProrationFactor              = 13 / 31          = 0.4194

    Pro-rated Refund = £50 × 0.4194 = £20.97
    ```

    <Note>
      The refund starts from the **day after** the downgrade. The consumer is not refunded for the change day itself — they are charged for that day at the higher tier price, regardless of when the downgrade occurs during the day. This applies even if the consumer upgraded and downgraded on the same day.
    </Note>
  </Accordion>

  <Accordion title="❌ Immediate Cancellation — pro-rated refund">
    When a consumer immediately cancels their subscription, they receive a refund of the **full renewal price** (P) for the remaining days in the cycle.

    The cancellation day itself is not refunded — the refund starts from the following day.

    ```text theme={null}
    ProrationFactor = ROUNDUP(BillingPeriodEndTs − EffectiveTs, day) / ROUNDUP(TotalDuration, day)

    Pro-rated Refund = P × ProrationFactor
    ```

    **Example — Cancellation on Day 17 of a 31-day cycle (P = £50)**

    ```text theme={null}
    EffectiveTs                  = Day 18  (day after cancellation)
    RemainingDuration (adjusted) = ROUNDUP(31 − 18) = 14 days
    TotalDuration (adjusted)     = ROUNDUP(31)       = 31 days
    ProrationFactor              = 14 / 31           = 0.4516

    Pro-rated Refund = £50 × 0.4516 = £22.58
    ```

    <Note>
      The refund starts from the **day after** cancellation. The consumer is not refunded for the cancellation day itself — they are charged for that day at the full subscription price, regardless of when during the day the cancellation occurs.
    </Note>
  </Accordion>
</AccordionGroup>

***

## Quick reference

Use this as a mental model: **the later in a cycle a change happens, the smaller the pro-rated amount** — because fewer days remain.

| Change day (in a 31-day cycle) | Remaining days (upgrade) | Remaining days (downgrade / cancel) | ProrationFactor (upgrade) | ProrationFactor (downgrade / cancel) |
| - | - | - | - | - |
| Day 1 | 31 | 30 | 1.0000 | 0.9677 |
| Day 5 | 27 | 26 | 0.8710 | 0.8387 |
| Day 10 | 22 | 21 | 0.7097 | 0.6774 |
| Day 15 | 17 | 16 | 0.5484 | 0.5161 |
| Day 20 | 12 | 11 | 0.3871 | 0.3548 |
| Day 25 | 7 | 6 | 0.2258 | 0.1935 |
| Day 30 | 2 | 1 | 0.0645 | 0.0323 |

<Tip>
  The change day is included in the remaining day count for **upgrades** (charges), but excluded for **downgrades and immediate cancellations** (refunds). For both refund scenarios, the effective date is always the day after the change — the consumer is always charged for the day on which they held their tier or active subscription.
</Tip>

***

## Same-day upgrade and downgrade

If a consumer upgrades and then downgrades on the same day, both pro-ration calculations apply independently and are issued as separate transactions.

| Action | Timing | Calculated from | Financial outcome |
| - | - | - | - |
| Upgrade | Immediate | Change day (inclusive) | Pro-rated **charge** for remaining days at the higher tier |
| Downgrade | Immediate | Day after the downgrade | Pro-rated **refund** for remaining days at the lower tier price difference |

Because the downgrade refund is calculated from the **following day**, the consumer is always charged for the day on which they held the higher tier — even if they downgraded later the same day. This prevents consumers from accessing premium features at no cost by upgrading and immediately downgrading within the same day.

**Example — Upgrade then downgrade on Day 15 of a 31-day cycle (ΔP = £5.00)**

```text theme={null}
Upgrade charge:
  EffectiveTs                  = Day 15 (change day included)
  RemainingDuration (adjusted) = ROUNDUP(31 − 15) = 17 days
  ProrationFactor              = 17 / 31 = 0.5484
  Pro-rated Charge             = £5.00 × 0.5484 = £2.74

Downgrade refund:
  EffectiveTs                  = Day 16 (day after downgrade)
  RemainingDuration (adjusted) = ROUNDUP(31 − 16) = 16 days
  ProrationFactor              = 16 / 31 = 0.5161
  Pro-rated Refund             = £5.00 × 0.5161 = £2.58

Net cost to consumer for the day of access at the higher tier = £2.74 − £2.58 = £0.16
```

The consumer pays only for Day 15 at the higher tier price — a fair reflection of the time they actually held the upgraded access.
