attach, and a lifetime plan moves to a recurring plan through attach with replaceLifetime: true.
Each upgrade and downgrade takes an idempotency key that identifies this one intended change. Store it and reuse it on every retry, so a retry never charges or refunds twice. Create the key when the customer confirms the change, for example the ID of a row you save for it, so a customer who later moves back to the same plan gets a fresh change. A key lasts 24 hours; after that it is a new request.
Upgrade
Response
UpgradeResponse | AddOnItemAttachResponse: a bill holding add-ons, a plan riding on another product line’s bill, or an entity’s plan, answers an item change instead. Narrow it with "itemChangeId" in upgrade before reading upgradeId or itemChangeId; status and paymentUrl are on both.
Stripe charges the full new price and starts a new period. Act on status:
What carries over:
- Credits and metered allowances. The new plan’s grants start with its period. The old plan’s unspent credits and metered allowances stay until the old period would have ended (spend order). Packs are untouched.
- Held counts carry over, and the new plan’s limit applies at once. Boolean features switch when the upgrade is applied.
- Seats. The count carries to the new plan’s seat price, billed in full on the upgrade invoice with the new plan.
- License seats. An upgrade to a plan that sells the same seat plan moves the license: the seats, who holds them and what they’ve used, at the new plan’s seat price.
- Prepaid quantities. A prepaid quantity carries to a plan that sells the same feature, billed as its packs on the upgrade invoice.
- Intervals. Monthly to annual is always an upgrade, whatever the price: the year is charged in full now, starts from the upgrade, and its first month is granted at once.
- Discounts. A coupon on the Stripe subscription stays on it. See Discounts.
- Tax. A taxed subscription stays taxed. With Automatic tax on, an untaxed one starts being taxed when Stripe knows the customer’s location.
502 stripe_upgrade_failed or 503 upgrade_reconciliation_required, retry with the same key.
Downgrade
Response
At the period end (default)
The customer keeps the current plan and its grants until the period ends, and the renewal starts the cheaper plan. The response isscheduled, with effectiveAt set to the renewal. Undo it any time before then with cancelScheduledDowngrade({ downgradeId, customerId }); getScheduledDowngrade returns the one that’s pending. Held counts stay stored; past the new limit, see below.
Immediately
Withtiming: "immediately", the cheaper plan starts now and the renewal date stays. The response is applied.
- Credits. The new plan’s credits are prorated to the rest of the period. The old plan’s remaining credits end, or stay with
oldPlanCredits: "keep". - Metered allowances are prorated per feature: the new allowance times the unused share of the period, counting what the customer already used of that feature. A customer who already used more than the new allowance gets the new plan’s full allowance at the renewal.
- Held counts above the new limit are kept, never deleted. Removes work as usual, and adds resume once the count is back under the limit (until then they answer
limit_reachedwithremainingat 0). Boolean features the cheaper plan lacks go off at once. - Seats move to the cheaper plan’s seat price, at the same count.
- Refund.
refund: "prorated"refunds the unused share of the price difference to the card, plus the tax charged on it. On a discounted invoice the refund is on what the customer paid: a 50%-off customer gets half the list-price refund, never more than they paid. - Overage from the old plan bills at its own rate on the next renewal, or now with
overageOnPlanChange: "bill_now".
Annual, seat and free plans
- Annual to monthly happens at the year’s end, where Stripe restarts the billing cycle for the new interval. Monthly grants carry on until the year ends; then the monthly plan renews.
- Between two annual plans, an immediate downgrade with
refund: "prorated"refunds the price difference times the unused share of the year. The cheaper plan’s allowance runs to the end of the current month, and the next month is granted in full. - A plan with seat prices downgrades immediately, seats and all. To move it at the period end, cancel at the period end and attach the cheaper plan.
- To a free plan: cancel at the period end, then attach the free plan.
Within a group
Each plan group is its own ladder. An upgrade or downgrade replaces the customer’s plan in the target’s group and leaves their other product lines as they are: upgrading tocampaigns_pro moves Campaigns Starter and keeps Starter.
- The bill’s own plan (the first paid plan on the Stripe bill) moves as described above.
- A plan riding on another product line’s bill moves up in one prorated Stripe change, with the period kept. The old plan’s credits run to the period end, and the new plan’s are granted for the rest of it. The answer is an item change:
{ "itemChangeId", "status", "paymentUrl", "item" }, read as for an add-on attach. - An entity’s plan moves the same way: pass
entityId, and only that entity moves. Other entities on the old plan stay on it. See Plans per workspace or user.
With add-ons
A customer holding recurring add-ons moves their base plan up or down with the same calls. Only the base plan changes: each add-on stays on the bill at its quantity, with its grants and discounts, and the customer keeps one invoice.- Upgrade. One prorated Stripe change, with the period kept. The invoice prorates the old and new base plan only, so no add-on is billed twice. The new plan’s credits are granted for the rest of the period, prorated, and the old plan’s run to the period end. The renewal bills the new plan and every add-on in full.
- Downgrade at the period end. The renewal starts the cheaper plan beside every add-on, billed in full with no proration.
- Downgrade now. The base plan moves to the cheaper price at once, and the add-ons carry on untouched.
- Discounts. A coupon on the bill stays through both, and discounts the upgrade invoice and the renewal.
- Any currency. A bill in euros or another currency upgrades, downgrades and changes add-ons in that currency.
{ "itemChangeId", "status", "paymentUrl", "item" }, and its status reads as for an add-on attach. In TypeScript, narrow the reply on itemChangeId:
Response
Discounts
A coupon or promotion code on the Stripe subscription stays on it through upgrades and downgrades, with its end date unchanged, and keeps discounting whatever it covers. A coupon for every product discounts the new plan too; one limited to the old plan’s product stays with that plan, and applies again if the customer moves back. Each plan still grants its full credits. A period-end downgrade keeps the subscription’s discounts on both phases of its schedule, and a prorated refund is on what the discounted invoice took. See Discounts and promotion codes.Cancel at period end
Renewal is set on the subscription’s numericid. Find the active paid subscription in listCustomerSubscriptions and offer the control only when its cancellation.manageable is true:
Response
cancelsAt and a Resume button. The plan and its grants last until then, with no further charge. When the period ends, the subscription is canceled: its credits and metered allowances expire, its boolean features go off, and packs stay. Held counts stay stored, so attaching a plan later restores them against its limit. Attach your free plan to give the customer an allowance again.
A past-due subscription can be cancelled too, at the period end, by its id. Its unpaid invoice stays open for Stripe to collect. At cancelsAt the plan ends without granting again.
Cancel now
To end a subscription immediately, cancel it in Stripe; Ledger follows Stripe’scustomer.subscription.deleted event. The plan ends at once, the current month’s grants with it (on an annual plan, too). Any unbilled overage, credit and metered, is billed on a final invoice, so no usage goes unpaid. The subscription’s unpaid invoices follow your Stripe subscription settings. Cancellations carry no refund from Ledger; refund in Stripe when you want to.
Rules
- One change at a time: while an upgrade waits for payment, or a downgrade or cancellation is scheduled, the others answer
409(upgrade_pending,downgrade_scheduled,cancellation_scheduled). Undo the scheduled one first. - Build each idempotency key from the confirmed change, not from the customer and plan alone, or a later move back to the same plan replays the first result.
- Upgrades and downgrades stay in a group: a target in a group the customer (or entity) holds nothing in answers
400 plan_not_in_group; attach it instead. - A plan riding on another product line’s bill, and an entity’s plan, move by upgrade (
409 downgrade_unavailable_for_item). - An upgrade goes to a synced paid plan that costs more or bills on a longer interval (
400 ineligible_upgrade). - A downgrade goes to a cheaper synced paid plan, or one on a shorter interval (
400 ineligible_downgrade). - Upgrades and downgrades work on subscriptions whose schedule Ledger set (
400 ineligible_stripe_subscription). - A base plan with seat prices, seat licenses or prepaid units moves on a bill without add-ons (
400 ineligible_stripe_subscription). - While an add-on is canceling at the period end, the base plan moves by upgrade; a downgrade waits until the add-on has ended (
409 subscription_change_pending). - Annual to monthly uses the default
timing: "period_end"(400 interval_change_at_period_end). - A plan with seat prices downgrades with
timing: "immediately"(400 seat_plan_downgrade_now_only). refundandoverageOnPlanChangego withtiming: "immediately"(400 refund_not_available,overage_option_not_available).refund: "prorated"andoldPlanCredits: "keep"are sent one or the other.- A prorated refund needs a paid invoice; without one, downgrade without
refund(409 no_payment_to_refund). - An immediate downgrade waits until the renewal invoice is paid, since it bills the current plan (
409 renewal_pending, in the hour before Stripe charges and after a failed payment). - Seats and prepaid quantities move by upgrade: a downgrade to or from a plan with prepaid units is
400 prepaid_change_unavailable, and a downgrade from a plan with a license is400 license_change_unavailable. Cancel at the period end, then attach the new plan. - An upgrade keeps the customer’s prepaid quantity; change it after with
POST /v1/billing/quantities. cancellationisnullfor free plans, pending Checkouts, and when Ledger couldn’t read the subscription from Stripe.409 subscription_not_manageablemeans the Stripe subscription has a change of its own, such as a pause or a custom cancellation date; resolve it in Stripe.
Other ways. Customers in the dashboard have a Manage subscription sheet for one-off changes. Over HTTP, see upgrade, downgrade and cancellation. Every error code is in Errors.