Adds the ability to itemize proration discount amounts
What’s new
Adds the ability to itemize proration discount amounts, so proration amounts and discount amounts are displayed consistently with non-prorations. When enabled, the proration amount properties show gross amounts before discounts are applied, and discount amounts include the actual applied discount amounts. When disabled, the proration discount properties include discount IDs, but discount amounts are 0.
Impact
You can now itemize proration discount amounts by setting the proration_discounts parameter to itemized
when creating subscriptions, subscription schedules, quotes, checkout sessions, or preview invoices. You can also set this parameter to itemized
for an existing subscription by migrating it. However, you can’t migrate a subscription from itemized
to included
.
Changes summary
Object | Property | Included | Itemized (new behavior) |
---|---|---|---|
Proration Line Item | amount | Net amount (after discounts) | Gross amount (before discounts) |
discount_ | Missing item-level discounts; group-level discounts show amount=0 | All discounts included with accurate amounts | |
Invoice Item | amount | Net amount | Gross amount |
net_ (new property) | Net amount for non-discountable invoice items; otherwise null | Net amount for non-discountable invoice items; otherwise null | |
proration_ (new property) | All discounts included with amount=0 | All discounts included with accurate amounts | |
Invoice | total_ | Excludes proration discounts | Includes proration discounts |
subtotal | Includes net proration amounts (discounts already applied) | Includes proration amounts after item-level discounts (group-level discounts applied separately) |
Example: 10 USD gross debit proration with 10% item-level discount and 2 USD group-level discount
Included:
The following example shows the existing behavior, with discounts already applied:
Response:
// Line Item { "proration": true, "amount": 700, // Net: 7 USD after discounts (10 USD - 1 USD item - 2 USD group) "discount_amounts": [ // Item-level discount missing entirely {"amount": 0, "discount": "di_group_2off"} // Group-level shows ID but no amount ] } // Invoice Item { "proration": true, "amount": 700 // Net amount only } // Invoice { "total_discount_amounts": [ {"amount": 0, "discount": "di_group_2off"} // Missing item-level proration discount ], "subtotal": 700 // Adds proration amount after all discounts }
Itemized:
Request:
// POST /v1/subscriptions { // ... omitting irrelevant fields ... billing_mode: { type: "flexible", flexible: { // New parameter: only available when billing mode type is flexible proration_discounts: "itemized" // Default value is "included" } } // ... omitting irrelevant fields ... }
Response:
// Line Item { "proration": true, "amount": 1000, // Gross: 10 USD before discounts "discount_amounts": [ {"amount": 100, "discount": "di_item_10pct"}, // Item-level discount now visible {"amount": 200, "discount": "di_group_2off"} // Group-level with actual amount ] } // Invoice Item { "proration": true, "amount": 1000, // Gross amount "net_amount": 700, // New property: net amount after both discounts "proration_details": { // New property: populated when the invoice item is a proration "discount_amounts": [ {"amount": 100, "discount": "di_item_10pct"}, {"amount": 200, "discount": "di_group_2off"} ] } } // Invoice { "total_discount_amounts": [ {"amount": 100, "discount": "di_item_10pct"}, // Now includes item-level proration discount {"amount": 200, "discount": "di_group_2off"} // Now includes group-level proration discount ], "subtotal": 9000 // Includes proration amount after item-level discounts }
Upgrade considerations
- Scope: This functionality is only available on subscriptions with flexible billing mode.
- One-way migration: After you enable itemized discount amounts for a subscription, you can’t revert to included.
- Code changes required: If your integration reads proration amount properties expecting net values, update to use the new net_amount property instead.
- Historical invoices: Existing invoices reflect the behavior that was active when you created them.
- Mixed invoice support: Single invoices can contain both included and itemized proration line items if you migrate a subscription between creating prorations.
Changes
Upgrade
Related changes
- Removes iterations parameter for subscription schedules
- Promotion Codes now reference Coupons using a polymorphic field for promotions
- Adds the Discount source property and removes the Discount coupon property
- Makes flexible billing mode the default for new subscriptions
- Updates computation of subscription schedule phase end date to consider billing cycle anchor changes
- Adds customer portal configuration trial behavior