Double-entry: each charge credits the seller their net and the platform its fee. No UPDATE / DELETE — a Postgres trigger raises on both. Balances are derived, verified drift-0 every poll.
| # | time | account | kind | amount | balance | charge | |
|---|---|---|---|---|---|---|---|
| loading ledger… | |||||||
Money captured on the platform, application_fee kept, remainder transferred to the seller's connected account.
Webhook deduped by event.id + UNIQUE(ref_id) per charge. Retries and replays never double-post the split.
Balances update in the same transaction as the ledger insert. SUM(ledger) ⇄ balance verified for every account on every poll.
Refunds pull the transfer back from the seller and return the platform fee — the ledger mirrors it to the cent.