docs: add proration_behavior and custom_line_items to proration docs

Made-with: Cursor
This commit is contained in:
Ayush Rodrigues
2026-04-02 10:06:08 +01:00
parent fbd384c010
commit 39b57687d0

View File

@@ -147,6 +147,23 @@ curl -X POST https://api.useautumn.com/v2/billing/attach \
In these cases, Autumn requires immediate billing and will return an error.
</Warning>
### Custom line items
If you need full control over what the customer is charged during a plan switch, you can pass `custom_line_items` to replace the auto-generated proration invoice entirely. This is only valid for immediate plan changes (e.g. upgrades).
```typescript
await autumn.billing.attach({
customerId: "user_123",
planId: "enterprise",
customLineItems: [
{ amount: 25, description: "Prorated upgrade credit" },
{ amount: -10, description: "Loyalty discount" },
],
});
```
When `custom_line_items` is provided, Autumn skips its own proration calculation and creates an invoice with exactly the line items you specified. Amounts can be negative to represent credits.
## Usage-based proration
For usage-based prices, when a plan change occurs mid-cycle: