Overview
Learn how recording transactions work in Blnk
Transactions are used to enable money movement between two or more balances. These can be payments, transfers, settlements, internal treasury management, etc. All transactions in Blnk are recorded with the double entry principle, i.e., there is a source and a corresponding destination for each transaction entry.
In this guide, you’ll learn:
Transaction properties
-
Immutability: Once recorded, transactions in Blnk cannot be modified or deleted. This fundamental property ensures the integrity and reliability of your transaction history, preventing any unauthorized alterations. See also: Transaction hashing
-
Idempotency: Each transaction in Blnk produces the same result whether executed once or multiple times. This is crucial for maintaining data consistency, especially during network failures or system retries.
Blnk implements idempotency by requiring a unique
reference
for every transaction. This reference serves as a transaction identifier, preventing duplicate processing and ensuring consistent outcomes.
How transactions work in Blnk
Queueing transactions
When you record a transaction, Blnk places it in a temporary QUEUED
status as part of its concurrency control mechanism. This queueing step ensures accuracy and maintains transaction idempotency.
APPLIED
or REJECTED
status.See following: How Blnk handles concurrency
Applying transactions
A transaction reaches APPLIED
status when it has been successfully processed and all participating balances have been updated accordingly.
reference
or transaction id
in your ledger.See also: Inflight statuses
Rejecting transactions
A transaction usually enters REJECTED
status due to insufficient funds, i.e., when the source
balance lacks sufficient funds and overdraft is not enabled for the transaction.
Discarded transactions
When a transaction is discarded, it was queued but never reached a final APPLIED
or REJECTED
status. Discarded transactions are removed from the queue and do not appear in the ledger. No webhook notification is sent for discarded transactions.
A transaction can be discarded for any of these reasons:
-
Duplicate reference: The transaction’s
reference
number matches an existing transaction record in your ledger, violating idempotency requirements. We recommend generating unique references using a combination of:- Timestamp (e.g. UNIX timestamp)
- Random string or UUID
- Business identifier (like
orderID
orcustomerID
)
-
Incorrect attributes: The transaction request contains invalid or missing required attributes. For example, passing
apply_overdraft
instead ofallow_overdraft
, invalid amounts (like negative values), etc.To avoid this, double-check that all transaction requests match the API specifications before submitting.
Recording a transaction
To record a transaction, call the record-transaction endpoint:
With the following request body:
If this is your first transaction, the participating balances will start at 0. To ensure the transaction is successful, enable overdrafts as shown above, allowing the source balance to go negative.
Learn more about Overdrafts and Negative Balances.
Field | Description | Required | Type |
---|---|---|---|
amount | The transaction amount. | Yes | float |
reference | Your unique reference to ensure idempotency. | Yes | string |
currency | Short code for your asset class. See also: Asset classes | Yes | string |
precision | Precision for the currency/asset passed. See also: Precision | No | int64 |
source | Sender’s balance ID | Yes | string |
destination | Recipient’s balance ID. | Yes | string |
description | Description or narration of the transaction. | No | string |
meta_data | Custom data associated with the transaction | No | object |
Passing detailed data with the meta_data
object is encouraged; it provides you with 360-degree insights about each transaction record. Examples of data you can pass include sender_name
, account_number
, bank_name
, receiver_name
, payment_id
, ip_address
, location
, payment_method
, etc.
Next, you can view a list of all transactions in your ledger:
Learn more
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.
Manage your Blnk Ledger and explore advanced features (access control & collaboration, anomaly detection, secure storage & file management, etc.) in one dashboard.
Was this page helpful?