An engineer’s guide to the Double Entry principle with Blnk.
Another way to visualize the Double Entry principle is that for every transaction, there must be a source and a destination.
User A | Company | |
---|---|---|
Starting balance | $5,000 | $0 |
Invoice paid | –$3,000 | |
+$3,000 | ||
Ending balance | $2,000 | $3,000 |
Create a new ledger
/ledgers
, and pass the following in its request body:ledger_id
from the response. You’ll need it for the next step.Create a balance for User A in the ledger you've just created
/balances
, and pass the following in its request body:balance_id
from the response. You’ll need it for the next step.Record the transaction between the user and your company
/transactions
, and pass the following in its request body:Here's how the transaction records look like
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 |
"@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 |