Billing

Payments, the credit ledger, and how Tokener.ai reconciles gateway budgets.

Updated 2026-07-29
Edit on GitHub

Billing has three layers:

  1. Payments — card checkout through Stripe
  2. Ledger — append-only credit grants and usage debits
  3. Gateway budget — enforcement synced from the ledger

Payments

Successful payment creates a durable payment record. Credits are granted only after webhook processing — never on the browser redirect alone.

Ledger

Every credit grant and usage debit is an append-only fact. Balance projections power the console; request paths do not scan the full ledger.

Promotional credits

When a welcome-credit offer is active, an eligible verified account receives one grant. The amount and validity are fixed when the grant is issued. Usage consumes grants with the earliest expiry first; any unused amount expires at the end of its configured UTC billing-day window.

Reconciliation

Jobs keep the gateway budget aligned with the ledger. When they diverge briefly, reconciliation closes the gap. The ledger remains authoritative for billing state.