Transactions
Bulk commit inflight
Commit multiple independently-created inflight transactions with the TypeScript SDK.
POST
/
transactions
/
inflight
/
bulk
/
commit
Bulk commit inflight
curl --request POST \
--url http://localhost:5001/transactions/inflight/bulk/commit \
--header 'X-blnk-key: <api-key>'import requests
url = "http://localhost:5001/transactions/inflight/bulk/commit"
headers = {"X-blnk-key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-blnk-key': '<api-key>'}};
fetch('http://localhost:5001/transactions/inflight/bulk/commit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "5001",
CURLOPT_URL => "http://localhost:5001/transactions/inflight/bulk/commit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"X-blnk-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:5001/transactions/inflight/bulk/commit"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-blnk-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:5001/transactions/inflight/bulk/commit")
.header("X-blnk-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:5001/transactions/inflight/bulk/commit")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["X-blnk-key"] = '<api-key>'
response = http.request(request)
puts response.read_bodyUse
blnk.Transactions.bulkCommitInflight to commit multiple inflight transactions.
1
Call the method
- Queued commit
- Synchronous commit
- Dry run
blnk.Transactions.bulkCommitInflight
const response = await blnk.Transactions.bulkCommitInflight({
transactions: [
{
transaction_id: 'txn_c4e70eb8-e4d6-4e04-a2e2-92a43b96',
},
{
transaction_id: 'txn_6164573b-6cc8-45a4-ad2e-7b4ba6a6',
amount: 40,
},
{
transaction_id: 'txn_0b59f6e6-6c4a-4efa-915c-526f77ef',
precise_amount: 125034,
},
],
});
Pass
skip_queue: true to process each commit synchronously instead of queuing.blnk.Transactions.bulkCommitInflight
const response = await blnk.Transactions.bulkCommitInflight({
skip_queue: true,
transactions: [
{
transaction_id: 'txn_c4e70eb8-e4d6-4e04-a2e2-92a43b96',
},
{
transaction_id: 'txn_6164573b-6cc8-45a4-ad2e-7b4ba6a6',
amount: 40,
},
],
});
Preview every commit without settling any hold. Items are projected independently. See Dry-run transactions.
Pass
blnk.Transactions.bulkCommitInflight
const preview = await blnk.Transactions.bulkCommitInflight({
dry_run: true,
transactions: [
{
transaction_id: 'txn_c4e70eb8-e4d6-4e04-a2e2-92a43b96',
},
{
transaction_id: 'txn_6164573b-6cc8-45a4-ad2e-7b4ba6a6',
},
],
});
| Field | Type | Description |
|---|---|---|
dry_run | true | Return a BulkTransactionPreview without committing. Holds stay in place. |
dry_run: true inline, as shown above, to infer the preview response. If the request is declared separately, type it as DryRun<BulkCommitInflightRequest>.| Field | Type | Description |
|---|---|---|
transactions | object[] | Up to 100 inflight transactions to commit. |
transactions[].transaction_id | string | Inflight transaction ID to commit. |
transactions[].amount | number | Partial commit amount. Omit to commit the full remaining inflight amount. |
transactions[].precise_amount | number | Precision-applied partial commit amount. Takes precedence over amount. |
skip_queue | boolean | When true, process synchronously instead of queuing. |
2
Review per-item results
On a posted batch, check
response.data.results for each transaction’s outcome. Failed items include a code and message without stopping the rest of the batch.A dry run has no succeeded / failed counts. Check would_apply and results.3
Response
- Queued commit
- Dry run
200 OK
{
"succeeded": 2,
"failed": 1,
"results": [
{
"transaction_id": "txn_c4e70eb8-e4d6-4e04-a2e2-92a43b96",
"status": "succeeded"
},
{
"transaction_id": "txn_6164573b-6cc8-45a4-ad2e-7b4ba6a6",
"status": "succeeded"
},
{
"transaction_id": "txn_0b59f6e6-6c4a-4efa-915c-526f77ef",
"status": "failed",
"code": "INVALID_AMOUNT",
"message": "cannot commit more than inflight amount"
}
]
}
| Field | Type | Description |
|---|---|---|
succeeded | number | Number committed successfully. |
failed | number | Number that failed. |
results | object[] | Per-transaction outcome in request order. |
results[].status | string | succeeded or failed. |
results[].code | string | Failure code (for example NOT_FOUND, ALREADY_VOIDED, INVALID_AMOUNT). |
results[].message | string | Human-readable failure message. |
200 OK
{
"dry_run": true,
"would_apply": true,
"cumulative": false,
"atomic": false,
"results": [
{
"dry_run": true,
"would_apply": true,
"operation": "commit",
"status": "APPLIED",
"reference": "ref_hold_001",
"currency": "USD",
"amount": 120,
"precise_amount": "12000",
"precision": 100
},
{
"dry_run": true,
"would_apply": true,
"operation": "commit",
"status": "APPLIED",
"reference": "ref_hold_002",
"currency": "USD",
"amount": 40,
"precise_amount": "4000",
"precision": 100
}
]
}
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.Was this page helpful?
⌘I