Company··1 min read
How your balance is calculated, and why it is always exact
Your balance is not a number we keep updating. It is the sum of every entry on your wallet, and every entry has two sides that must add up to zero.
Daniel Reyes, Co-founder and head of finance
Most people never think about how a payment app knows what their balance is. You see a number, you trust it. For us, that number is the most important thing we produce, so it is worth explaining where it comes from.
Two sides to every payment
Northwind Pay records money using double-entry bookkeeping, the same method accountants have used for centuries. Every movement is written as an entry with at least two lines: money leaving one account and money arriving in another. When you send 40.00 to a friend, one line takes 40.00 from your wallet and another adds 40.00 to theirs. The two lines add up to zero. If they do not, our system refuses to save the entry at all.
Fees work the same way. If a payment has a fee, it appears as its own line in the same entry, so you can always see exactly where each cent went.
Your balance is the sum of your entries
Your wallet balance is simply every line ever written to it, added together. We keep a running total so the app is fast, and every night we recalculate every balance from the full history and compare the two. If they ever differ, our finance team is alerted before the morning.
Nothing is edited, only reversed
Once an entry is written it cannot be changed or deleted. If something needs correcting, for example a bank transfer that was credited and later recalled, we write a new reversing entry that points back to the original. Both stay in your Activity, marked so you can see what happened and when. It also means a wallet can never go below zero: a payment that would do that is refused before it is written, not fixed afterwards.