The pieces
Pools link to subscriptions with a draw priority and optional
draw limit, so multiple pools can back one subscription and drain in a
defined order.
How deduction works
When an event arrives for a feature backed by a credit model, credits are deducted synchronously at ingestion, FIFO across grants and respecting draw priority. The amount isusageUnits × weight, where the weight comes from
the server-side tariff — see Credit weights. With no
tariff published, one unit burns one credit. The deduction is stamped into the event’s context, and
credit-covered usage is excluded from Stripe meter forwarding so it isn’t
billed twice.
If a pool has hardLimit: true and the balance cannot cover the event, the
service rejects ingestion with 409 Conflict. The response has
success: false and an error message beginning with Credit pool depleted.
The transaction rolls back, so the event is not stored and no credits are
deducted.
Use an entitlement check before serving the feature for an earlier allow/deny
decision. Event rejection remains the final enforcement boundary.
Reading balances (Client API)
Design notes worth knowing
- Deduction is 1:1 by default between usage units and the credit denomination; a published weight tariff changes that server-side.
- Purchased grants carry their sale price. A
PURCHASEDgrant without an explicitunitPriceis stamped with the current price book entry for the pool’s denomination; an explicitunitPrice(a negotiated top-up) always wins. - Expiry is a scheduled job (
CreditExpirationJob): expired grants move their remainder to the pool’stotal_expired, visible in the ledger. - Plan-included credits are granted on subscription cycle rollover and clawed back on cancellation; upgrades grant the delta.