What are usage events?
A usage event represents customer consumption in your app, such as an API call, token spend, or document generation. Usage events are distinct from meter events:- Usage events: customer-level metering and credit debit for SDK integrations
- Meter events: billing and limit enforcement
Record usage
Event fields
Common types
api_calltransactionemailstoragecustom
Record usage in bulk
trackUsageBulk submits many events in one request — useful for flushing a buffered queue or
backfilling. The batch is validated first, then each event is inserted individually:
{ success, inserted, results }, where each results entry carries the event
reference and its per-event creditDebit outcome (same shape as the single-event response).
Credit debit results
When the customer is on a credit-based (usage-based) plan,trackUsage debits credits and
reports what happened in creditDebit:
autoRecharge.triggered: true means an off-session recharge was initiated because the balance
crossed the customer’s auto-recharge threshold — the credits arrive when that charge succeeds, not
in this response. See the Auto-recharge guide.
Grant credits
Assign credits to a customer without collecting payment — sign-up bonuses, goodwill credits, or enterprise allotments. Grants are idempotent when you supply anidempotencyKey, so retries are
safe:
{ success, customerRef, credits, balance, reason }. Each grant emits a
customer.credit.granted webhook. Credits can also be granted from the customer detail page in
the SolvaPay Console.
Read a customer’s balance
creditsPerMinorUnit and a display exchange rate for rendering the
balance in the provider’s display currency. Credit balances are USD-normalized internally; the
display fields are for presentation only.
Relationship to meters
Use both when needed:trackUsage()/trackUsageBulk()for customer-level usage and credit debit- Meter events for named meter ingestion and aggregation
Next steps
- Core concepts
- Auto-recharge — automatic balance refills when credits run low
- Meters overview
- Webhook handling —
customer.credit.*andusage.*events