Skip to main content
Pro: $29 a month. 10 GB of storage free, then 25 cents a GB-month.
Bill storage for what customers really held over the month, time-weighted, past a free amount on each plan. Storage is a held feature with a measured price. Your app sets the amount the customer holds whenever it changes. At each renewal, Ledger bills the month that just ended for its time-weighted average, past the free amount, on the renewal invoice.

The catalog

  • price.model is measured: billed in arrears for the amount held over each period.
  • billingUnits is how many held units make one billed unit (default 1). Held counts are whole numbers, so count storage in MB and bill per GB: 1,024 MB in a GB.
  • includedQuantity is the free GB-months each period (default 0).
  • unitAmountCents is the price of one GB-month. For prices that fall with volume, use tiers and tiersMode instead, as seat tiers do.
  • included (or unlimited: true) is still the most the customer may hold: an add past it is refused with limit_reached.

Set the amount

Send what the customer holds now with count, whenever it changes: an upload, a delete, or a nightly sync.
quantity: 1024 adds a GB and quantity: -1024 removes one, as on any held feature. Limits has the calls.

How it’s billed

  • Time-weighted. 100 GB for half the month, then nothing, is 50 GB-months. What’s held at the end of a period carries into the next.
  • Past the free amount, rounded up. 50 GB-months less 10 free is 40, at 25 cents: $10. 10.2 GB-months, with 10 free, bills 1.
  • On the renewal invoice. One line for the period that ended, under the plan’s product: “Pro – Storage, 40 unit-months”. A period within the free amount adds no line, and a redelivered invoice event adds nothing.

Annual plans, upgrades and cancellations

  • An annual plan that resets monthly bills each month’s GB-months when the month ends, on the month’s own invoice, as overage on an annual plan is. The year’s last month goes on the renewal invoice.
  • An upgrade ends the old plan’s period. Its GB-months up to the upgrade bill at the old plan’s price on the new plan’s next renewal, beside the new plan’s own.
  • A cancellation bills the GB-months held up to the end on the final invoice.
  • A cut-short period counts against its full length. 100 GB for 20 days of a 30-day month is 66.7 GB-months.

What the customer API returns

GET /v1/customers?customerId= adds measured to a measured held feature: its price and the GB-months held so far this period, what the renewal would bill on if the period ended now.
Response
balance.used is what’s held now, in MB. unitAmountCents is null when tiers price it. GET /v1/plans lists the price with its model and billingUnits.

Rules

  • Measured prices go on held items. A measured price takes unitAmountCents or tiers, one of the two, with no proration; metered, credits and boolean items take no price.
  • Annual plans reset monthly. An annual plan with a measured price sets resetInterval: "month" (annual_measured_not_supported).
  • Measured prices recur. They go on monthly and annual plans; a lifetime plan refuses them (one_off_plan_cannot_bill_later).
  • A price change is a new version. Changing the price publishes a new plan version.