The Double Entry Accounting principle
The Double Entry Accounting principle states that for every entry into an account, there needs to be a corresponding and opposite entry into a different account. Only two types of entries can happen in an account — a credit and a debit. When an account is credited, money is added to the account, and when it is debited, money is removed from the account. So the principle states that if there’s a credit entry in one account, there must be an equal debit entry in another account.Another way to visualize the Double Entry principle is that for every transaction, there must be a source and a destination.
Part 1: The Basics
There are two rules to the double-entry principle:- Every financial category in your organization is represented by an account.
- Every financial transaction can be modeled as a “transfer” between accounts.
User A | Company | |
---|---|---|
Starting balance | $5,000 | $0 |
Invoice paid | –$3,000 | |
+$3,000 | ||
Ending balance | $2,000 | $3,000 |
Why is it important for the value to be equal?Because the double entry aims to be the source of truth for your financial records. When you say you received $3,000, the assumption is that someone else paid $3,000 to you. If you received $3,000 despite being paid $4,000, it becomes a case of fraud and dishonesty which is terrible for any business.
Let’s build it with Blnk
Let’s model this on our Blnk server.1
Create a new ledger
First, we create a new ledger to group our balances in, and we’ll name it “User Balances”.To do this call the endpoint URL, Copy the
/ledgers
, and pass the following in its request body:Request
ledger_id
from the response. You’ll need it for the next step.2
Create a balance for User A in the ledger you've just created
Next, create a balance for the user.To do this, call the endpoint URL, Copy the
/balances
, and pass the following in its request body:Request
balance_id
from the response. You’ll need it for the next step.3
Record the transaction between the user and your company
To do this, call the endpoint URL, This moves 3000 from User A’s balance to your revenue account (represented by an internal balance in your ledger).
/transactions
, and pass the following in its request body:Request
4
Here's how the transaction records look like
You can see at first glance that this transaction has a source (where it was debited from) and a destination (where it was credited to).
id | reference | amount | currency | source | destination | description | created_at |
---|---|---|---|---|---|---|---|
txn_171821872187 | ref_8728781718 | 300000 | USD | bln_ebcd230f-6265-4d4a-a4ca-45974c47f746 | @CompanyRevenue | Invoice payment | 2024-04-23 12:32 UTC |
The amount was converted to its lowest unit (cents, in this case) to ensure correctness when computing the balances. To learn more, read: Understanding precision.
Part 2: Dealing with the real world
Dealing with double entry when you manage both accounts is easy. But what happens when you deal with the world? What happens if User A sends the same $3,000 to an external bank account outside of our system? How do we represent it with the double entry principle? To do this with Blnk, we recommend that you create an internal balance to represent all transactions with the outside world. We call it"@World"
. This way you can track all money in and out of your system from one balance.
To apply it, use @World
in the source or destination field depending on what kind of transaction it is, and you now have a corresponding, traceable entry equal to your user balance’s entry. For example, User A sent money out, your transaction records would look like this:
id | reference | amount | currency | source | destination | description | created_at |
---|---|---|---|---|---|---|---|
txn_171821872187 | ref_8728781718 | 300000 | USD | bln_ebcd230f-6265-4d4a-a4ca-45974c47f746 | @World | Invoice payment | 2024-04-23 12:32 UTC |
Applying this to your financial application
When building your financial application, it is important to apply the double entry principle to ensure that you can guard against fraud and dishonesty. Blnk allows you to be able to see both entries in one record, instead of recording the CR and DR entries in separate records in your database. Good financial recording also saves you a lot of time and effort in performing settlements and reconciliation, a necessary operation for any financial application in today’s world. With Blnk, you don’t have to worry about building the structures for Double Entry recording. You have instant access to all the tools you need to correctly record and track all transactions in your application.Need help?
We are very happy to help you make the most of Blnk, regardless of whether it is your first time or you are switching from another tool. To ask questions or discuss issues, please contact us or join our Discord community.References
A big part of this guide was referenced from this amazing article by Meredydd: An Engineer’s Guide to Double-Entry Bookkeeping. Check it out to learn more about bookkeeping. Other references include:- How To Do A Bank Reconciliation (EASY WAY) by Accounting Stuff
- Ledger: Stripe’s system for tracking and validating money movement by Ilya Ganelin
- Double Entry: What It Means in Accounting and How It’s Used by Adam Hayes