Skip to main content

Payment Ledger Design

Last Updated: 2026-12-01 Status: Complete

A payment ledger is the system of record for who owns which money. For a PayFac it must answer, at any moment and for any sub-merchant, "how much do we owe, in which state and in which currency", and it must prove the answer. In this category you build a double-entry ledger: the accounts and journal entries, the balance types derived from them, and the reconciliation that keeps the books honest against processors and banks.

The pages are written to be implemented. You get a PayFac chart of accounts, worked journal entries for a sale, refund, chargeback, payout and reserve, a PostgreSQL schema that rejects unbalanced entries, a NestJS posting service with idempotency and overdraft guards, a multi-currency model with FX and rounding rules, and a daily reconciliation job. Card and bank flows that feed the ledger are explained in Clearing and Settlement.

Quick Reference​

TopicRule
EntriesBalanced per currency, immutable, unique external reference
CorrectionsNew reversing entries, never edits
BalancesDerived from lines; caches are rebuildable
Balance typesPending, available, reserved, in transit as separate accounts
CurrencyOne account per currency; exponents from ISO 4217
Clearing accountsReturn to zero; aging is the alarm
Manual adjustmentsMaker-checker, ticket and reason on every entry

How the Ledger Fits Together​

Learning Objectives​

After completing this category you can:

  • Define a PayFac chart of accounts and explain why sub-merchant money is a liability
  • Write balanced journal entries for a sale with a fee, a refund, a chargeback, a payout and a reserve hold, and say at which event each line posts
  • Implement a ledger schema with a deferred balance check, immutability and idempotent posting
  • Explain why balances are derived and how snapshots stay rebuildable
  • Compute pending, available and reserved balances and choose an account model for them
  • Record an FX conversion with a clearing account, apply a documented rounding rule and use ISO 4217 minor units correctly
  • Use clearing and suspense accounts as reconciliation signals and correct a bulk posting error with reversing entries

Topics​

  1. Double-Entry Ledger Design: account types, chart of accounts, worked entries, schema, concurrency guards
  2. Pending vs Available Balance: balance types, modeling options, multi-currency, FX and rounding
  3. Ledger Reconciliation: internal checks, clearing accounts, suspense, corrections, close and maker-checker
  4. Ledger Quiz: scenario questions on entries, balances, currency and corrections
Share: