Transactions
Update inflight
Commit or void an inflight transaction with the Go SDK.
PUT
/
transactions
/
inflight
/
{transaction_id}
Update inflight
curl --request PUT \
--url http://localhost:5001/transactions/inflight/{transaction_id} \
--header 'X-blnk-key: <api-key>'import requests
url = "http://localhost:5001/transactions/inflight/{transaction_id}"
headers = {"X-blnk-key": "<api-key>"}
response = requests.put(url, headers=headers)
print(response.text)const options = {method: 'PUT', headers: {'X-blnk-key': '<api-key>'}};
fetch('http://localhost:5001/transactions/inflight/{transaction_id}', 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/{transaction_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
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/{transaction_id}"
req, _ := http.NewRequest("PUT", 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.put("http://localhost:5001/transactions/inflight/{transaction_id}")
.header("X-blnk-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:5001/transactions/inflight/{transaction_id}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Put.new(url)
request["X-blnk-key"] = '<api-key>'
response = http.request(request)
puts response.read_bodyUse
Go response (
client.Transaction.Update to commit or void an inflight transaction or batch.
1
Call the method
- Commit
- Partial commit
- Void
- Synchronous update
- Dry run
client.Transaction.Update
transaction, resp, err := client.Transaction.Update(
"txn_c4e70eb8-e4d6-4e04-a2e2-92a43b969e0c",
blnkgo.UpdateStatus{
Status: blnkgo.InflightStatusCommit,
},
)
client.Transaction.Update
transaction, resp, err := client.Transaction.Update(
"txn_c4e70eb8-e4d6-4e04-a2e2-92a43b969e0c",
blnkgo.UpdateStatus{
Status: blnkgo.InflightStatusCommit,
Amount: 500,
},
)
client.Transaction.Update
transaction, resp, err := client.Transaction.Update(
"txn_c4e70eb8-e4d6-4e04-a2e2-92a43b969e0c",
blnkgo.UpdateStatus{
Status: blnkgo.InflightStatusVoid,
},
)
Pass
SkipQueue: true to process the commit or void synchronously instead of queuing.client.Transaction.Update
transaction, resp, err := client.Transaction.Update(
"txn_c4e70eb8-e4d6-4e04-a2e2-92a43b969e0c",
blnkgo.UpdateStatus{
Status: blnkgo.InflightStatusCommit,
SkipQueue: true,
},
)
Preview the commit or void without settling the hold. Use
UpdateDryRun. See Dry-run transactions.client.Transaction.UpdateDryRun
preview, resp, err := client.Transaction.UpdateDryRun(
"txn_c4e70eb8-e4d6-4e04-a2e2-92a43b969e0c",
blnkgo.UpdateStatus{
Status: blnkgo.InflightStatusCommit,
},
)
| Field | Type | Description |
|---|---|---|
transactionID | string | Inflight transaction ID, or batch ID from CreateBulk. |
Status | blnkgo.InflightStatus | InflightStatusCommit to apply funds, or InflightStatusVoid to cancel and roll back. |
Amount | float64 | Partial commit amount. See Partial commits. |
PreciseAmount | *big.Int | Precision-applied partial commit amount. Takes precedence over Amount. |
SkipQueue | bool | When true, process synchronously instead of queuing. |
2
Confirm the outcome
On a posted update, check
transaction.Status for APPLIED or VOID. The child gets a new TransactionID. Use ParentTransactionID to link it to the original inflight transaction.A dry run has no transaction ID. Check WouldApply instead.3
Response
- Commit
- Partial commit
- Void
- Dry run
200 OK
{
"amount": 1250.34,
"precision": 100,
"precise_amount": 125034,
"transaction_id": "txn_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"parent_transaction": "txn_c4e70eb8-e4d6-4e04-a2e2-92a43b969e0c",
"source": "bln_f344b673-e855-4bda-b769-3e94a02c1941",
"destination": "@WorldUSD",
"reference": "ref_2ye281ewiu",
"currency": "USD",
"description": "Card payment on Stripe",
"status": "APPLIED",
"hash": "0b9c25fb5b00d6c71cb4ca87026bf6dc316e63353d33deb588bd0",
"created_at": "2024-11-26T09:33:35.265582042Z"
}
200 OK
{
"amount": 500,
"precision": 100,
"precise_amount": 50000,
"transaction_id": "txn_b2c3d4e5-f6a7-8901-bcde-f23456789012",
"parent_transaction": "txn_c4e70eb8-e4d6-4e04-a2e2-92a43b969e0c",
"source": "bln_f344b673-e855-4bda-b769-3e94a02c1941",
"destination": "@WorldUSD",
"reference": "ref_2ye281ewiu",
"currency": "USD",
"description": "Card payment on Stripe",
"status": "APPLIED",
"hash": "0b9c25fb5b00d6c71cb4ca87026bf6dc316e63353d33deb588bd0",
"created_at": "2024-11-26T09:33:35.265582042Z"
}
200 OK
{
"amount": 1250.34,
"precision": 100,
"precise_amount": 125034,
"transaction_id": "txn_c3d4e5f6-a7b8-9012-cdef-345678901234",
"parent_transaction": "txn_c4e70eb8-e4d6-4e04-a2e2-92a43b969e0c",
"source": "bln_f344b673-e855-4bda-b769-3e94a02c1941",
"destination": "@WorldUSD",
"reference": "ref_2ye281ewiu",
"currency": "USD",
"description": "Card payment on Stripe",
"status": "VOID",
"hash": "0b9c25fb5b00d6c71cb4ca87026bf6dc316e63353d33deb588bd0",
"created_at": "2024-11-26T09:33:35.265582042Z"
}
200 OK
{
"dry_run": true,
"would_apply": true,
"operation": "commit",
"status": "APPLIED",
"reference": "ref_card_settle_4821",
"currency": "USD",
"amount": 120,
"precise_amount": "12000",
"precision": 100
}
Go response (*blnkgo.Transaction)
| Field | Type | Description |
|---|---|---|
TransactionID | string | ID of the new transaction created by the commit or void. |
ParentTransactionID | string | Original inflight transaction this resolves. |
Status | blnkgo.PryTransactionStatus | APPLIED or VOID. |
PreciseAmount | *big.Int | Amount applied in minor units. |
Amount | float64 | Float amount after precision is applied. |
Source | string | Source balance. |
Destination | string | Destination balance. |
Reference | string | Reference for the commit or void transaction. |
CreatedAt | time.Time | Date and time the transaction was created. |
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