← Projects

LedgerMatch — Open-Source Payment Reconciliation For Small Businesses

Active
PythonFastAPIUvicornNext.js 16React 19TypeScriptTailwind CSSpytestPlaywright
View Repository →
▶Product demo

Problem

A Stripe payout is one lump sum that covers dozens of orders, with the fees buried inside. Square and PayPal do the same thing in their own way, and bank feeds do not break the lump sums apart. So every month an owner or bookkeeper spends 2 to 10 hours in a spreadsheet to learn whether the money actually arrived.

Business Impact

Small online sellers lose track of money in the gap between an order, a processor payout and a bank deposit. A missing payment or a payout held back by a reserve is easy to miss when it sits inside a lump sum. LedgerMatch turns the monthly spreadsheet job into one run and shows a cash gap, the sum of payouts that never arrived and the amounts that landed short. It is positioned as a free, self-hosted alternative to paid reconciliation services, and all data stays on the owner's machine.

System Approach

  • FastAPI backend with CSV parsers for orders, Stripe, Square, PayPal and bank statements; columns are found by header name, and the source is detected from the filename or headers
  • Order-to-payment matching in three passes, highest confidence first: by reference, exact amount within 3 days, then amount within $0.02 within 3 days
  • Payout rebuild: charges and refunds are grouped by processor and settlement day (Stripe 2 days, Square 1, PayPal same day), net = gross - fees - refunds
  • Payout-to-bank ladder: exact net within 3 days, then combined transfers (up to 4 payouts in one credit, subset-sum), then short landings at 50 to 120% of expected net
  • Next.js dashboard with match rate, money at risk, cash gap, fees per processor, an exceptions list sorted by severity and amount, and a payouts-to-bank table
  • A /console page replays a real engine run from an events file the engine wrote, with millisecond timestamps

Key Decisions & Trade-offs

  • Rules, not a model: reconciliation has to be explainable to a bookkeeper, so each match names the pass that made it
  • Match by header name instead of column position so standard processor exports work without edits
  • Rebuild payouts from charges instead of waiting for payout exports, so a plain payments export is enough
  • Subset-sum for combined bank transfers, capped at 4 payouts, to handle several payouts landing as one credit without searching the whole statement
  • Everything runs on localhost with in-memory state for one merchant; nothing is uploaded or stored, which keeps transaction data private
  • CORS only allows localhost origins, so the API is not open to other sites

Current Status

Public and open source under the MIT license at github.com/rohitguta2432/ledgermatch. Version 0.2.0 includes payout-level reconciliation and a bundled demo of 48 orders, 3 processors and a bank statement with planted discrepancies. The backend has 15 pytest tests for the payout logic. Run it with a Python 3.11+ virtualenv and uvicorn for the API, and npm run dev for the dashboard.

Roadmap

  • Use Stripe payouts.csv as the payout source of truth instead of rebuilding from charges
  • Export the matched ledger as a QuickBooks or Xero journal
  • More processors: Razorpay, Adyen and Klarna
  • Scheduled runs with an email digest of new exceptions

What I'd Improve Next

  • State is held in memory for a single workspace, so results are lost on restart and there is no multi-user mode
  • The dashboard formats every amount as USD, and the automated tests cover the payout logic only

Explore More