Add overage to a plan
SetoverageUnitAmountCents, the price per overageBillingUnits credits (default 1), and optionally a default monthly cap, overageCapCents. Leave the cap out for no cap. This Scale plan charges $0.01 per extra credit, capped at $20 a month:
How it’s decided
Your integration doesn’t change. Ledger spends plan credits, then packs, then overage. A use that costs more than what’s left spends the rest and records the remainder as overage, as long as the period’s overage cost stays within the cap. A use that would pass the cap is refused whole with409 overage_cap_reached; one that lands exactly on it is allowed. check makes the same decision, so allowed: true can mean the use will be billed as overage.
A customer with 1,000 credits left who tracks a 2,500-credit use gets:
Response
overageCredits is this period’s overage so far, and overageRemainingCents is what’s left under the cap ($20.00 − $15.00). The period’s cost is ceil(credits ÷ overageBillingUnits) × overageUnitAmountCents, worked out for each rate separately.
Per-customer caps and rates
A customer’s own cap replaces the plan default, higher or lower.0 turns overage off for them and null restores the default. An override gives one customer a negotiated rate; the plan must already have overage terms, or it returns 409 plan_has_no_overage.
track. Leave out planId to apply an override to whichever overage plan the customer is on, so it carries across upgrades; a plan-specific override wins. Send unitAmountCents: null to clear it. The cap response’s overage.capSource says where the effective cap comes from: customer, override, plan, or null.