One wallet per customer (per environment)
Create customers with@jazadev/node (createCustomer). You get an id with a cus_ prefix. Store that id on your user record and pass it to init, consume, and (if needed) getBalance.
Sandbox and live are isolated — a cus_… from test keys does not exist under live keys. Remint when you go live; see Authentication.
How the app learns the balance
- Host calls
jaza.init({ customerId })→ snapshot includeswallet.balanceCredits JazaProviderloads that session viagetSession/authEndpoint- SDK refreshes via client wallet APIs while authenticated
getBalance route for the primary UI path.
Balance rules
- Non-negative balance.
- Atomic deductions on
consume(race-safe). - Top-ups and successful consumes reflect on subsequent reads and client refreshes.
How balances change
UI in your app
Use the official client SDKs:JazaBalance— shows credits from the session / client wallet (JazaBalanceWidgetis a deprecated alias)JazaTopUpButton— opens MoMo checkout (session-minted top-up JWT)JazaLedger— credit movementsJazaActionButton— gates taps by feature cost (never consumes)
Next steps
- Handshake · Ledger · Top-up · Consume credits