Calculate Proration
calculate_prorationProrate a mid-period plan change (upgrade, downgrade, seat change): credit for the unused part of the old plan, charge for the rest of the period on the new plan, and the net amount. Method "months" (default) counts every whole month of the period equally and splits only the partial month by its own days; "days" spreads the price over every day of the period (Stripe default). Monthly plans give the same answer either way. Same math as revexos.com/proration-calculator.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cycle | Yes | Billing period length. | |
| method | No | "months" (default) or "days". | |
| new_price | Yes | Price per unit of the new plan for one full period. | |
| old_price | Yes | Price per unit of the current plan for one full period. | |
| change_date | Yes | Date the change takes effect, YYYY-MM-DD. Must fall inside the period. | |
| new_quantity | No | Units/seats on the new plan. Default 1. | |
| old_quantity | No | Units/seats on the current plan. Default 1. | |
| period_start | Yes | Start date of the current billing period, YYYY-MM-DD. |