Credits & commits

Prepaid and postpaid commits, credits, access and invoice schedules, and the balance ledger.

View .md

Credits and commits are both balances that usage draws down.

Metronome's reference: Apply credits and commits to contracts · List balances · Get the net balance of a customer · Add a manual balance entry · Edit a contract. These pages are the source of truth for every field; metro's page covers how metro handles it. What metro wraps, endpoint by endpoint: Metronome API coverage.

  • A commit is the customer's agreement to spend an amount over time. PREPAID commits are invoiced up front and drawn down by usage. POSTPAID commits are settled after usage, as a true-up.
  • A credit is a free allowance of spend or quantity. It has no invoice.
  • Recurring commits and credits issue a new balance every period.

Access schedule and invoice schedule

Access scheduleInvoice schedule
SaysWhen, and how much, balance is availableWhat the customer is billed
Credit typeFiat or a custom credit typeMust be fiat
OnEvery commit and creditPrepaid commits only, optional

A prepaid commit without an invoice schedule is a pure access grant. A custom credit type on the invoice schedule returns 400 "Credit type must be a fiat currency", and only a live call reveals it.

How it connects

Commits and credits live on a contract and reference a product. applicable_product_ids or applicable_product_tags limit what they pay for; leaving both out means everything. On invoices, a purchase shows as a commit_purchase line and a drawdown as a negative applied_commit_or_credit line. A parent can share commits with child contracts.

Gotchas

  • Lower priority numbers draw down first.
  • rollover_fraction, from 0 to 1, is the share carried into a renewal. 0 means the balance is lost on transition.
  • Pass a uniqueness_key on every grant, so a retry can't grant twice.
  • An invoiced commit can't be archived until its invoices are voided. Rollover commits can't be edited; edit the original on the previous contract.
  • A manual ledger entry needs the commit's current segment_id.
  • The net balance is the spendable truth. The balance list can differ by anything rolled over to an archived successor.

How metro handles it

CommandDoes
metro customer balances --ingest-alias=acme-corp --sandbox --jsonBalances, plus spendableNet, which compares the net balance with the list
metro ledger-adjustment preflight --amount=<signed-int>A manual ledger entry on one balance segment
metro ledger-adjustment preflight --archive-balance-id=<id>Archives a whole grant
metro ledger-adjustment preflight --grant=credit or --grant=commitAdds a new credit, or a complimentary prepaid commit, through a contract edit
metro credit preview --shape complimentary-credit-grant --file credit.json --sandboxOffline preview of a grant
metro credit preview --shape paid-credit-top-up --file topup.json --sandboxOffline preview of a payment-gated top-up

metro refuses an addition while the net balance and the balance list disagree for that credit type, and warns with MTR-CREDIT-NET-001. When they disagree, trust the net.

See Credits and commits. Metronome docs: Apply credits and commits.

On this page