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
| Topic | Rule |
|---|---|
| Entries | Balanced per currency, immutable, unique external reference |
| Corrections | New reversing entries, never edits |
| Balances | Derived from lines; caches are rebuildable |
| Balance types | Pending, available, reserved, in transit as separate accounts |
| Currency | One account per currency; exponents from ISO 4217 |
| Clearing accounts | Return to zero; aging is the alarm |
| Manual adjustments | Maker-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
- Double-Entry Ledger Design: account types, chart of accounts, worked entries, schema, concurrency guards
- Pending vs Available Balance: balance types, modeling options, multi-currency, FX and rounding
- Ledger Reconciliation: internal checks, clearing accounts, suspense, corrections, close and maker-checker
- Ledger Quiz: scenario questions on entries, balances, currency and corrections
Related Topics
- Platform Architecture: module overview
- Data Modeling: the payment records that trigger postings
- Reliability: idempotency and events for safe posting
- Money Movement: payouts, reserves and fees built on the ledger
- Three-Way Payment Reconciliation: matching processor, bank and platform records
- Glossary: ledger and accounting terms