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

# Understanding Proration

> Learn how proration works when changing subscription plans and how it affects your billing

## What is Proration?

Proration is the process of calculating proportional charges and credits when you change your subscription plan mid-billing period. It ensures you only pay for what you use and get credited for unused time.

## How Proration Works

### Basic Concept

When you change plans, Flexprice:

1. **Calculates unused time** on your current plan
2. **Credits the unused portion** back to your account
3. **Charges for the new plan** from the change date
4. **Generates a single invoice** with the net amount

### Example Scenario

You have a monthly plan that costs `$100/month`, and you want to upgrade to a `$200/month` plan on day 15 of your billing cycle:

* **Days used**: 15 days
* **Days remaining**: 15 days
* **Credit for unused time**: `$50` (50% of `$100`)
* **Charge for new plan**: `$100` (50% of `$200`)
* **Net amount due**: \$50

## Proration Calculations

### Time-Based Proration

Proration is calculated based on the time remaining in your current billing period:

```
Credit Amount = (Days Remaining / Total Days) × Current Plan Price
Charge Amount = (Days Remaining / Total Days) × New Plan Price
Net Amount = Charge Amount - Credit Amount
```

### Billing Period Considerations

* **Monthly Plans**: Proration based on days in the month
* **Quarterly Plans**: Proration based on days in the quarter
* **Yearly Plans**: Proration based on days in the year
* **Leap Years**: February 29th is included in calculations

## Proration Examples

### Example 1: Monthly Upgrade

**Current Plan**: Basic Monthly (`$50`/month)
**New Plan**: Premium Monthly (`$100`/month)
**Change Date**: Day 10 of 30-day month

**Calculation:**

* Days used: 10
* Days remaining: 20
* Credit: (20/30) × $50 = $33.33
* Charge: (20/30) × $100 = $66.67
* Net amount: $66.67 - $33.33 = \$33.34

### Example 2: Quarterly Downgrade

**Current Plan**: Premium Quarterly (`$300`/quarter)
**New Plan**: Basic Quarterly (`$150`/quarter)
**Change Date**: Day 45 of 90-day quarter

**Calculation:**

* Days used: 45
* Days remaining: 45
* Credit: (45/90) × $300 = $150.00
* Charge: (45/90) × $150 = $75.00
* Net amount: $75.00 - $150.00 = -\$75.00 (credit)

### Example 3: Yearly Plan Change

**Current Plan**: Basic Yearly (`$600`/year)
**New Plan**: Premium Yearly (`$1200`/year)
**Change Date**: Day 100 of 365-day year

**Calculation:**

* Days used: 100
* Days remaining: 265
* Credit: (265/365) × $600 = $435.62
* Charge: (265/365) × $1200 = $871.23
* Net amount: $871.23 - $435.62 = \$435.61
