Bulk Transactions
Learn how to handle bulk transactions in Blnk
Overview
The Bulk Transaction API enables you to process multiple transactions within a single request. It offers two processing options: atomic processing, where all transactions either succeed or fail as a unit, and independent processing, where each transaction is handled separately.
Additionally, the API supports asynchronous processing to efficiently manage large batches of transactions.
Creating bulk transactions
To process multiple transactions in a single request, call the Bulk Transactions endpoint.
Request body
Field | Type | Required | Description |
---|---|---|---|
atomic | Boolean | Yes | When true , either all transactions succeed or all fail. When false , transactions are processed independently. |
inflight | Boolean | Yes | When true , transactions are created in INFLIGHT status and require a separate commit. When false , transactions are processed immediately. |
run_async | Boolean | No | When true , processing happens in the background and results are delivered via webhook. When false or not provided, processing happens synchronously and results are returned in the response. |
transactions | Array | Yes | Array of transaction objects. |
Synchronous response
When run_async
is false:
Asynchronous response
When run_async
is true:
Commit or void bulk inflight
To commit or void all transactions in a batch:
Webhook notifications
When using run_async: true
, the API sends webhook notifications upon completion or failure.
Webhook structure
The webhooks follow this structure:
Field | Type | Description |
---|---|---|
event | String | Name of event. Can be bulk_transaction.applied , bulk_transaction.inflight , or bulk_transaction.failed . |
batch_id | String | Specifies the id of the batch transaction. |
status | String | Status of the batch transaction. Can be applied , inflight , or failed . |
transaction_count | String | Number of transactions in the batch. Only included for successful cases. |
error | String | Error message. Only included for failure cases. |
timestamp | String | Specifies the date & time when the batch transaction was completed. |
Usage examples
Synchronous processing
Process multiple transactions atomically (all or nothing):
Asynchronous processing
Process a large batch of transactions in the background:
Inflight transactions
Create inflight transactions
Later, commit the batch
Error handling
Failed atomic transactions (synchronous)
When using atomic: true
with inflight: false
and run_async: false
, if any transaction in the batch fails, all previously processed transactions will be automatically refunded, and you’ll receive an error response like this:
Failed atomic transactions (asynchronous)
When using atomic: true
with run_async: true
, if any transaction fails, all transactions will be rolled back, and you’ll receive a webhook notification with an error message containing the rollback status:
Failed atomic inflight transaction
When using atomic: true
with inflight: true
, if any transaction in the batch fails during the inflight creation phase, all previously created inflight transactions will be automatically voided, and you’ll receive an error response (or webhook for async) like this:
Failed non-atomic transactions
When using atomic: false
, if a transaction in the batch fails, only that transaction and the subsequent transactions in the sequence will fail; all previous transactions that succeeded before the failed one will remain applied in your ledger.
You’ll receive an error response (or webhook for async) like this:
Important notes
- When
atomic
istrue
, transactions are processed in the order provided in the request. - Each transaction’s
reference
must be unique. - When
run_async
istrue
, processing happens in the background and you’ll receive an immediate response with a batch ID. - For large transaction batches, using
run_async: true
is recommended to avoid timeout issues. - Webhook notifications for async processing contain the same detailed error information as synchronous responses, including rollback status.
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.
Connect your Blnk Ledger and explore advanced features (access control & collaboration, anomaly detection, secure storage & file management, etc.) in one intuitive dashboard.