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, respecting draw priority. 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 hashardLimit: true and the balance can’t cover the event, the
event is rejected at ingestion — real-time enforcement, not an invoice
surprise.
Reading balances (Client API)
Design notes worth knowing
- Deduction assumes 1:1 between usage units and the credit denomination.
- 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.