Skip to main content
Call jaza.consume() from your backend after a billable action succeeds. Pass a dashboard featureCode (or raw credits) and an idempotency key so retries never double-charge.

Prerequisites

  • Features configured in the dashboard
  • A customer with a wallet (cus_…)
  • @jazadev/node with secretKey + publicKey

Call consume

You can pass credits instead of featureCode when you need an explicit debit amount.

Charge after success

Prefer deducting after the feature succeeds so failed work is not billed:

Errors

The Node SDK throws JazaError with statusCode, code, and raw. Handle insufficient balance by prompting a top-up (Top up). See Errors for the envelope shape.

Idempotency

Use a key that is stable for the same business event (customer + feature + your action id). Do not use a fresh timestamp on every retry, or a timed-out success can deduct twice.

Next steps