Skip to main content
Pro: 1,000 messages and 50 exports a month. Business: unlimited messages, 500 exports.
Metered allowances give every action its own limit on every plan: 50 exports on Pro, 500 on Business, unlimited messages at the top. Ledger enforces each allowance on every request and resets it every period. A metered feature has its own balance per customer: the plan’s item grants included units at the start of each period, each use spends from it, and what’s left ends with the period. Use it when your pricing page counts each action separately. When one balance should cover several actions at different prices, use credits instead.

The catalog

Each item grants included units per period (0 or more), or makes the feature unlimited: true.

What check and track return

Check before the action, then track it once it succeeds. Send quantity when one use is several units, such as an export of 3 files; it defaults to 1.
The track answers with the feature’s balance after the use:
Response
  • balance.included is what this period granted, used what it has spent, remaining what’s left after any reservations, and resetsAt when the allowance ends.
  • chargedQuantity is the units this track applied. Credit fields stay at 0: a metered use spends no credits (why).
  • When quantity is more than remaining, check answers allowed: false with reason: "limit_reached", and track is refused with 409 limit_reached and the balance. Nothing is charged: a use is applied whole or not at all.
  • A feature the customer’s plan has no item for answers feature_not_in_plan, and a customer with no plan no_plan. Check and track has the order of refusals.

Durations and sizes

quantity is a whole number. To bill time or data, track it in a small whole unit and set the price per a larger one with overageBillingUnits.
Compute: 10 hours a month, then $0.40 an hour. **Storage transfer:** 50 GB a month, then $0.09 a GB.
Track compute in seconds and transfer in megabytes. overageBillingUnits: 3600 prices compute per hour, and overageBillingUnits: 1024 prices transfer per GB:
Track a job when it ends, with its duration rounded up to whole seconds, and a download with its size rounded up to whole megabytes:
The period’s overage is added up first, then rounded up to whole billing units: 40,000 seconds past the 10 hours bill ceil(40,000 ÷ 3,600) = 12 hours, $4.80. Prices below a cent has the rule. For a job that runs for hours, reserve its expected seconds with the check and settle the real duration with the track.

Unlimited

An item with unlimited: true always allows the use and never debits anything. check answers unlimited: true, and the balance counts uses without a limit:
Response
Keep tracking an unlimited feature: every use is recorded as a usage event, so you can see who uses what.

Rules

  • Each item takes included or unlimited: true. Metered features take no creditCost, and unlimited items take no overage price.
  • quantity is a whole number from 1 to 2,147,483,647 on a metered feature.
  • The allowance lasts one period. Unused units end when the period ends, and the next period grants included again. On an annual plan the period is a month unless resetInterval is year.
  • A feature keeps its type. To change type, create a new feature; changing type on an existing one returns 409 feature_type_locked.
  • Items are part of the plan version. Changing included publishes a new plan version; current subscribers keep their allowance.
  • One item per feature per plan. List each feature once in a plan.
  • Grants and expiry. Balances explains when an allowance arrives and ends.
  • Overage: bill the units past included instead of refusing them.
  • Pay as you go: included: 0, every unit billed.
  • Credits: one shared balance across actions.
  • Reservations: hold units before long-running work.