Skip to main content

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_call
  • transaction
  • email
  • storage
  • custom

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:
The response is { 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 an idempotencyKey, so retries are safe:
The response includes { 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

The response also carries 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