Prorations
Manage prorations for modified subscriptions.
The most complex aspect of changing existing subscriptions are prorations, where the customer is charged a percentage of a subscription’s cost to reflect partial use. This page explains how prorations work with subscriptions and how to manage prorations for your customers.
How prorations work
For example, upgrading or downgrading a subscription can result in prorated charges. If a customer upgrades from a 10 USD monthly plan to a 20 USD option, they’re charged prorated amounts for the time spent on each option. Assuming the change occurred halfway through the billing period, the customer is billed an additional 5 USD: -5 USD for unused time on the initial price, and 10 USD for the remaining time on the new price.
Proration ensures that customers are billed accurately, but a proration can result in different payment amounts than you might expect. Negative prorations aren’t automatically refunded and positive prorations aren’t immediately billed, although you can do both manually.
You can preview a proration to view the amount before applying the changes. To learn more about how credit prorations work, read our guide.
Prorations and discounts
All invoice items that are prorations (prorations=true) are set to discountable=false. Discounts applied to an invoice containing prorations are only applied to invoice items and invoice line items that aren’t prorations. Any discounts previously applied to the subscription and affecting the amount of the proration are reflected in the proration invoice item’s amount.
Non-prorations show discount adjustments in discount_amounts.
What triggers prorations
By default, the following scenarios result in a proration:
| Update | Description |
|---|---|
| Changing items | Adding a new item or removing an existing item |
| Changing price | Changing to a price with a different base cost or billing period |
| Changing quantity | Increasing or decreasing the quantity on a subscription item |
| Adding trial_end or trial_from_plan | Adding a trial period to an active subscription |
| Changing billing_cycle_anchor | Resetting the billing period to a new date |
| Setting cancel_at | Canceling a subscription mid-period (not at period end) |
What doesn’t trigger prorations
Many subscription updates don’t affect billing or generate prorations. Make these updates at any time without creating proration invoice items:
| Parameter | Description |
|---|---|
| Configuration and settings updates | |
| automatic_tax | Enable or disable automatic tax calculation |
| default_payment_method | Change the default payment method |
| default_source | Change the default payment source |
| payment_behavior | Control payment attempt behavior |
| collection_method | Change between charge automatically and send invoice |
| days_until_due | Update payment due date for send invoice subscriptions |
| tax_filing_currency | Change the tax filing currency |
| retry_settings | Modify retry behavior for failed payments |
| trial_settings | Update trial end behavior settings |
| pay_immediately | Control immediate payment behavior |
| pending_invoice_item_interval | Change how often pending items are invoiced |
| pause_collection | Pause or resume payment collection |
| proration_date | Set a specific proration date (doesn’t create prorations by itself) |
| Metadata and descriptive fields | |
| metadata and items.metadata | Update metadata on the subscription/subscription items |
| cancellation_details | Add cancellation feedback and comments |
| Updates that act as settings for future non-proration billing changes | |
| discounts and items.discounts | Add or update discounts (applies to future invoices) |
| billing_thresholds and items.billing_thresholds | Update billing thresholds on subscription/subscription items |
| cancel_at_period_end | Cancel at the current period end without proration |
| add_invoice_items | Add one-time charges to the next invoice |
Note
These updates don’t generate proration invoice items with proration_ or generate invoices with proration invoice items with proration_ because they don’t change the billing amount for the current period.
Manually creating your own prorations
To calculate your own prorations outside of Stripe and add them to the subscription, pass add_invoice_items with a negative unit_ (equal to the calculated proration amount) to these endpoints:
When prorations are applied
Prorations only apply to charges that occur ahead of the billing period. Usage-based billing isn’t subject to proration.
The prorated amount is calculated as soon as the API updates the subscription. The current billing period’s start and end times are used to calculate the cost of the subscription before and after the change.
Prorations and unpaid invoices
Stripe calculates prorations based on the subscription’s status at the time of an update, assuming that any previous invoices for the subscription will eventually be paid. If a customer changes their subscription while having an unpaid invoice for the current period, they might receive a credit for unused time on the higher-priced plan, even if they haven’t paid for that time yet.
To avoid crediting for unpaid time, you can disable prorations when the subscription’s latest invoice is unpaid. When updating the subscription, set proration_behavior to none. Select one of the following approaches:
- To keep the original billing period: Manually create a one-off invoice for any new charges.
- To charge immediately for the new plan and reset the billing period: Set
billing_tocycle_ anchor now. For more details, see Reset the billing period to the current time.
Either of these approaches can lead to double payment if the customer eventually pays the old invoice. To avoid this, void the unpaid invoice.
Taxes and prorations
For information about how taxes work with prorations, see Collect taxes for recurring payments.
Credit prorations
Credit prorations are issued when customers downgrade their subscriptions or cancel subscription items before the end of their billing period. Stripe offers two approaches for calculating credit prorations, depending on whether you set your subscription’s billing_mode to classic or flexible.
Calculation logic with no prorations
In the following scenario, you upgrade a 10 USD monthly subscription to 20 USD with the proration_ set to none for 10 days. There’s no previous debit to base it on. Later, you downgrade the subscription to 10 USD per month with the proration_ set to always_.
To set up this scenario, first you create a subscription for 10 USD per month on April 1:
The response includes the invoice that’s created for this subscription:
{ id: "sub_123", latest_invoice: { id: "in_123", total: 10_00, currency: "usd" } }
Then, on April 11, you upgrade the subscription to 20 USD per month without creating prorations:
The latest invoice remains unchanged because proration_ is none:
{ id: "sub_123", latest_invoice: { id: "in_123" } }
Finally, on April 21, you downgrade the subscription to 10 USD per month and create prorations:
| Classic | Flexible |
|---|---|
The billing_ proration calculation logic creates a credit proration based on the current price, even though the customer never paid the 20 USD monthly rate. The latest invoice credits a third of the month for 20 USD (-6.67 USD), even though the customer never paid for the price_ price. It also debits a third of the month for 10 USD (3.33 USD). | The calculation logic enabled with billing_ creates a credit proration based on the last price billed for the subscription item. In this case, the latest invoice credits a third of a month for the 10 USD monthly price billed on April 1 (3.33 USD) and debits a third of the month for the 10 USD price (3.33 USD). The credit and debit cancel out so the invoice total is 0 USD. |
|
|
Calculation logic for coupons applied to multiple subscription items
Stripe weights the amount_ coupon on the credit proration to prevent over-billing.
In the following scenario, a 5 USD coupon is unevenly allocated to a 25 USD monthly subscription for a 10 USD item and 20 USD item.
To set up this scenario, you create a subscription with multiple items and a coupon on February 1:
Which returns this response:
{ id: "sub_123", latest_invoice: { id: "in_123", total: 25_00, currency: "usd", lines: { data: [ { id: "ili_1", amount: 10_00, price: "price_10_monthly", discount_amounts: [{ discount: "di_a", amount: 1_66 }] }, { id: "ili_2", amount: 20_00, price: "price_20_monthly", discount_amounts: [{ discount: "di_a", amount: 3_34 }] }, ] } } }
To cancel the 10 USD monthly subscription item:
When a subscription item is deleted, the billing_ associated with that subscription affects how the proration is calculated as follows:
| Classic | Flexible |
|---|---|
The default behavior distributes a 5 USD coupon to each item (2.5 USD each), canceling the cheaper item (5 USD) and resulting in a refund of 2.5 USD. Stripe calculates the total with the formula -0.. | The flexible behavior reflects the proportional discount applied to the canceled item, rather than potentially applying the full discount amount to the proration calculation. Stripe calculates the total using the formula -0.. |
|
|
Preview a proration
You can create a preview invoice to preview changes to a subscription. This API call doesn’t modify the subscription. Instead, it returns the upcoming invoice based only on the parameters that you pass. Changing the price or quantity both result in a proration. This example changes the price and sets a date for the proration.
You can expand the example response below to see:
- The credit for unused time at the previous price on lines 36-38.
- The cost for time spent at the new price on lines 107-109.
- The new subtotal and total for the invoice on lines 276-279.
{ "id": "upcoming_in_1OujwkClCIKljWvsq5v2ICAN", "account_country": "US", "account_name": "Test account", "amount_due": 3627, "amount_paid": 0, "amount_remaining": 3627, "application_fee_amount": null, "attempt_count": 0, "attempted": false,
Use this information to confirm the changes with the customer before modifying the subscription. Because Stripe prorates to the second, prorated amounts might change between the time they’re previewed and the time the update is made. To avoid this, pass in a subscription_ value when creating a preview. When you update the subscription, pass the same date using the proration_ parameter on a subscription so that the proration is calculated at the same time.
Control proration behavior
Prorating is controlled by the proration_behavior parameter, which has three possible parameter options: create_, always_, and none.
Default behavior
The default parameter for proration_ is create_, which creates proration invoice items when applicable. These proration items are only invoiced immediately under certain conditions.
Create immediate prorations
To bill a customer immediately for a change to a subscription on the same billing period, set proration_ to always_ when you modify the subscription. This calculates the proration, then immediately generates an invoice.
Disable prorations
To disable prorations on a per-request basis, set the proration_ parameter to none. No parameter turns off all future prorations for a subscription. To disable prorations indefinitely, set proration_ to none for every request that generates prorations:
When prorations are disabled, customers are billed the full amount at the new price when the next invoice is generated.