Skip to main content
The ledger is the source of truth for a wallet’s balance. Every balance change — whether a top-up, a debit, or a refund — is written as an immutable ledger entry. The wallet’s current balance always equals the sum of all its ledger entries, which means you can reconstruct the complete balance history at any point in time purely from ledger data, without ever needing to read the wallet’s balance field directly.

Ledger endpoints

GET /api/wallets/:walletId/ledgers

Returns paginated ledger entries for a single wallet. Use this endpoint when you want to show a wallet’s balance history in your UI or reconcile its activity. Query parameters

GET /api/ledger

Returns the global ledger — entries across all wallets. Useful for platform-wide reconciliation or building an admin view of all balance changes. This endpoint accepts the same page and pageSize query parameters as the per-wallet endpoint.

LedgerEntry fields

Why balanceAfter matters

balanceAfter lets you reconstruct the wallet’s full balance timeline from the ledger alone. Each entry is a snapshot: take any entry and you instantly know the balance at that moment in history. This is useful for:
  • Auditing what a wallet’s balance was at a specific time
  • Building a balance chart over time without a separate time-series store
  • Verifying that the current balance on the wallet object matches the latest ledger entry’s balanceAfter

Example response

The three entries above tell a clear story: the wallet was topped up with ₦50,000, then debited ₦5,000 for a transaction, and finally refunded the same ₦5,000 — arriving back at its original balance.

TypeScript example: fetching ledger entries with pagination

Fetching the global ledger

To query across all wallets, swap the endpoint for /api/ledger. The response shape is identical: