OA
All projects Backend · Java

Ledger Lane

Every cent is accounted for. Even if the server crashes in the middle of the rush.

How a payment flows

The proof

100,000payments in parallel, the total still matches to the cent
410/sentries per second, measured on a laptop
10,054duplicate requests caught, none booked twice
0€lost, even though the server was killed hard midway

The problem

A marketplace collects money for many brands. Money must never be booked twice, halfway or lost.

  1. Customer clicks Pay twice
  2. Server crashes in the middle of a booking
  3. Bank and accounting show different numbers

Try it yourself

Go ahead and click twice. Crash the server. Every cent is still booked exactly once.

Try it: follow the golden hints.

Order#1001€50.00

Accounts

Bank account€0.00
Brands, payout pending€0.00
Platform fee, 15 %€0.00
Difference, must be 0€0.00

What happens

    0Payments booked
    0Double clicks caught
    0Crashes without damage
    €0.00lost

    Rebuilt in the browser with the same rules as the real booking system: every payment has its own number and is booked only once, a crash books nothing halfway, the difference stays 0. The real code is on GitHub.

    Bank reconciliation

    Bank statement in, discrepancies out. Paid out money is closed automatically.

    Figures from the demo run with the real bank statement in the repo, the example rows are simplified.

    How every cent stays clean

    1. Double entry bookkeeping: every booking balances, the difference is always 0
    2. Own number per payment: sent twice, still booked only once
    3. Immutable: errors are reversed, never deleted
    4. Message to other systems (Kafka): every booking is guaranteed to arrive
    5. Key based access: shop books, finance pays out, audit reads
    6. Euro and dollar: each currency balances to 0 on its own
    omar.dev@web.de