All work
StoreZed
A commerce platform with a built-in wallet, so merchants can take payments, hold balances and pay out in one place.
- Role
- Lead backend engineer
- Client
- StoreZed
- Year
- 2023
- Focus
- Fintech, Commerce
Outcomes
- balance mismatches after the ledger rewrite
- 0balance mismatches after the ledger rewrite
- faster checkout API after caching
- 3xfaster checkout API after caching
The problem
Merchants were reconciling sales against payouts by hand. Balances drifted because the wallet was a single number on a user row, updated from several places.
What I built
I replaced the balance column with a double-entry ledger. Every movement of money is two rows that must sum to zero, and a wallet balance is simply a query over those rows.
def transfer(debit: Account, credit: Account, amount: Decimal, ref: str) -> None:
with db.transaction():
Entry.create(account=debit, amount=-amount, reference=ref)
Entry.create(account=credit, amount=amount, reference=ref)- Idempotent payment webhooks keyed on the provider reference
- Payouts queued and retried with backoff, never fired twice
- Daily reconciliation report comparing the ledger with the payment provider
Outcome
Support tickets about missing money stopped. Finance could close the month from one report instead of three spreadsheets.
Gallery
Next project
Revenue Insights
A reporting layer that replaced five weekly spreadsheets with one dashboard the leadership team trusts.