Store currency in cents
The API accepts amounts with up to two decimal places and converts them to integer cents before updating balances or journal entries.
LedgerLab is a small payment system backed by double-entry accounting. The demo lets you create two accounts, post a payment, send the same request again, issue a refund, and inspect the journal entries created by each action. Every transaction records an equal debit and credit, so the journal totals remain balanced.
Start the ledger. This creates a customer account with $250 and a merchant account with $25.
Post a payment. Choose an amount and watch both balances and the journal update.
Replay the request. The API returns the original transaction without moving money a second time.
Refund $20. Open the payment and refund rows to compare their debit and credit entries.
The API may take up to a minute to start after a period of inactivity. All accounts and transactions in this demo are synthetic.
Checking the Python API…
Select “Start demo ledger” to create two synthetic accounts and their opening balances. Demo sessions expire automatically and contain no personal information.
The browser calls the FastAPI service hosted on Render, which reads and writes Neon PostgreSQL in a single database transaction. Before saving a payment, it locks the affected accounts, checks the idempotency key and available balance, then inserts matching debit and credit rows.
The API accepts amounts with up to two decimal places and converts them to integer cents before updating balances or journal entries.
Each payment request includes an idempotency key. Sending the same request again returns the original transaction instead of creating another payment.
A refund creates a new transaction linked to the payment. The original payment remains in the journal, and refunds cannot exceed the amount paid.
Each visitor receives a separate set of synthetic accounts and transactions. Sessions expire automatically so the demo starts clean for future visitors.
API tests cover opening balances, payments, repeated requests, conflicting idempotency keys, overdrafts, partial refunds, and refunds that exceed the original payment. Each response also verifies that total debits and credits match.
Money-formatting tests generate values across the supported range and confirm that converting between dollars and cents does not change the amount.