Transactions
Create transaction
Post a transaction with the Go SDK.
POST
/
transactions
Create transaction
curl --request POST \
--url http://localhost:5001/transactions \
--header 'X-blnk-key: <api-key>'import requests
url = "http://localhost:5001/transactions"
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', 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",
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"
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")
.header("X-blnk-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:5001/transactions")
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 Go response (
client.Transaction.Create to post a transaction between a source and destination balance.
1
Call the method
- Single transaction
- Inflight transaction
- Split transaction
- Scheduled transaction
- Backdated transaction
Move money from one source balance to one destination in a single call.
client.Transaction.Create
transaction, resp, err := client.Transaction.Create(
blnkgo.CreateTransactionRequest{
ParentTransaction: blnkgo.ParentTransaction{
PreciseAmount: big.NewInt(125034),
Precision: 100,
Currency: "USD",
Source: "@WorldUSD",
Destination: "@MyBalance",
Reference: "ref_f482a1b3-6c2d-4e89",
Description: "Customer payment",
SkipQueue: false,
},
AllowOverdraft: false,
},
)
| Field | Type | Description |
|---|---|---|
PreciseAmount | *big.Int | Amount in minor units. Use with Precision. |
Amount | float64 | Float amount. Blnk applies Precision. Use one of Amount or PreciseAmount. |
Precision | int64 | Precision for the currency (for example 100 for cents). |
Currency | string | Currency of the transaction. |
Reference | string | Unique reference for the transaction. |
Source | string | Balance sending the amount. Prefix @ for an internal balance. |
Destination | string | Balance receiving the amount. |
Description | string | Narration of the transaction. |
AllowOverdraft | bool | Allow the source balance to go negative. See Overdrafts. |
SkipQueue | bool | Bypass the transaction queue and process directly. |
Reserve funds without settling until you commit or void the transaction. See Create inflight.
See Update inflight to commit or void.
client.Transaction.Create
expiry, _ := time.Parse(time.RFC3339, "2025-03-01T00:00:00Z")
commit, _ := time.Parse(time.RFC3339, "2025-02-28T12:00:00Z")
transaction, resp, err := client.Transaction.Create(
blnkgo.CreateTransactionRequest{
ParentTransaction: blnkgo.ParentTransaction{
PreciseAmount: big.NewInt(10000),
Precision: 100,
Currency: "USD",
Source: "bln_28edb3e5-c168-4127-a1c4",
Destination: "bln_ebcd230f-6265-4d4a-a4ca",
Reference: "ref_f482a1b3-6c2d-4e89",
Description: "For vacation",
},
Inflight: true,
InflightExpiryDate: &expiry,
InflightCommitDate: &commit,
},
)
| Field | Type | Description |
|---|---|---|
Inflight | bool | Hold the transaction until you commit or void it. |
InflightExpiryDate | *time.Time | When the inflight transaction expires and rolls back. ISO 8601 format. |
InflightCommitDate | *time.Time | When Core auto-commits the inflight transaction. ISO 8601 format. |
Debit multiple sources or credit multiple destinations in one transaction. See Multiple sources and Multiple destinations.
transaction, resp, err := client.Transaction.Create(
blnkgo.CreateTransactionRequest{
ParentTransaction: blnkgo.ParentTransaction{
PreciseAmount: big.NewInt(3000000),
Precision: 100,
Currency: "USD",
Reference: "ref_f482a1b3-6c2d-4e89",
Description: "Payment to Sarah",
Sources: []blnkgo.Source{
{
Identifier: "bln_f2073f6b-905a-4e3e-b5a2",
Distribution: "10%",
},
{
Identifier: "bln_64c50fb5-32d5-4f78-9f4a",
PreciseDistribution: "2000000",
},
{
Identifier: "bln_7d98dfe9-5c3e-4c9b-b96a",
Distribution: "left",
},
},
Destination: "bln_92e4b9b6-0b85-4ef4-87a2",
Atomic: true,
},
},
)
transaction, resp, err := client.Transaction.Create(
blnkgo.CreateTransactionRequest{
ParentTransaction: blnkgo.ParentTransaction{
PreciseAmount: big.NewInt(3000000),
Precision: 100,
Currency: "USD",
Reference: "ref_c5d9e2a1-7b4f-4a3c-9e8d",
Description: "Payment from Sarah",
Source: "bln_92e4b9b6-0b85-4ef4-87a2",
Destinations: []blnkgo.Source{
{
Identifier: "bln_f2073f6b-905a-4e3e-b5a2",
Distribution: "20%",
},
{
Identifier: "bln_64c50fb5-32d5-4f78-9f4a",
PreciseDistribution: "1000000",
},
{
Identifier: "bln_7d98dfe9-5c3e-4c9b-b96a",
Distribution: "left",
},
},
Atomic: true,
},
},
)
| Field | Type | Description |
|---|---|---|
Sources | []blnkgo.Source | Source legs when debiting more than one balance. |
Destinations | []blnkgo.Source | Destination legs when crediting more than one balance. |
Sources[].Identifier | string | Balance ID or @ internal name for a source leg. |
Destinations[].Identifier | string | Balance ID or @ internal name for a destination leg. |
Distribution | blnkgo.Distribution | Percentage, fixed amount, or left for a split leg. |
PreciseDistribution | string | Fixed split-leg amount in minor units. |
Atomic | bool | When true, every leg succeeds together or the entire split fails. |
Post the transaction at a future date and time. See Scheduling.
client.Transaction.Create
scheduledFor, _ := time.Parse(time.RFC3339, "2024-12-21T01:36:46+01:00")
transaction, resp, err := client.Transaction.Create(
blnkgo.CreateTransactionRequest{
ParentTransaction: blnkgo.ParentTransaction{
PreciseAmount: big.NewInt(10000000),
Precision: 100,
Currency: "USD",
Source: "bln_28edb3e5-c168-4127-a1c4",
Destination: "@fees",
Reference: "ref_f482a1b3-6c2d-4e89",
Description: "Monthly fee",
MetaData: blnkgo.MetaData{
"sender_name": "John Doe",
"sender_account": "00000000000",
},
},
ScheduledFor: &scheduledFor,
},
)
| Field | Type | Description |
|---|---|---|
ScheduledFor | *time.Time | Date and time to post the transaction. ISO 8601 format. |
MetaData | MetaData | Optional metadata stored on the scheduled transaction. |
Record a transaction with a financial date in the past. See Backdated transactions.
client.Transaction.Create
effectiveDate, _ := time.Parse(time.RFC3339, "2025-02-15T10:30:00Z")
transaction, resp, err := client.Transaction.Create(
blnkgo.CreateTransactionRequest{
ParentTransaction: blnkgo.ParentTransaction{
PreciseAmount: big.NewInt(35890),
Precision: 100,
Currency: "NGN",
Source: "@source_account",
Destination: "@destination_account",
Reference: "ref_f482a1b3-6c2d-4e89",
Description: "Backdated transaction",
EffectiveDate: &effectiveDate,
},
},
)
| Field | Type | Description |
|---|---|---|
EffectiveDate | *time.Time | Actual date the transaction occurred. ISO 8601 format. |
2
Response
- Single transaction
- Inflight transaction
- Split transaction
- Scheduled transaction
- Backdated transaction
201 Created
{
"amount": 1250.34,
"rate": 0,
"precision": 100,
"precise_amount": 125034,
"transaction_id": "txn_c4e70eb8-e4d6-4e04-a2e2-92a43b969e0c",
"parent_transaction": "",
"source": "bln_f344b673-e855-4bda-b769-3e94a02c1941",
"destination": "bln_d5cbde84-d20a-485b-8ce8-6677d782c3a1",
"reference": "ref_f482a1b3-6c2d-4e89-a17b-3d5e8f2a1c94",
"currency": "USD",
"description": "Customer payment",
"status": "QUEUED",
"hash": "0b9c25fb5b00d6c71cb4ca87026bf6dc316e63353d3330deb588bd0b3d74dcc0",
"allow_overdraft": false,
"inflight": false,
"created_at": "2024-11-26T09:33:35.265582042Z",
"scheduled_for": "0001-01-01T00:00:00Z",
"inflight_expiry_date": "0001-01-01T00:00:00Z",
"inflight_commit_date": "0001-01-01T00:00:00Z"
}
201 Created
{
"amount": 100,
"rate": 0,
"precision": 100,
"precise_amount": 10000,
"transaction_id": "txn_6164573b-6cc8-45a4-ad2e-7b4ba6a60f7d",
"parent_transaction": "",
"source": "bln_28edb3e5-c168-4127-a1c4-16274e7a28d3",
"destination": "bln_ebcd230f-6265-4d4a-a4ca-45974c47f746",
"reference": "ref_f482a1b3-6c2d-4e89-a17b-3d5e8f2a1c94",
"currency": "USD",
"description": "For vacation",
"status": "INFLIGHT",
"hash": "8cfdc0f2562ce30c3728ef624dc29fbd0e4207c77df9220df0c699d45de0eef",
"allow_overdraft": false,
"inflight": true,
"created_at": "2024-12-21T01:36:46.997063436Z",
"scheduled_for": "0001-01-01T00:00:00Z",
"inflight_expiry_date": "2025-03-01T00:00:00Z",
"inflight_commit_date": "2025-02-28T12:00:00Z"
}
{
"precise_amount": 3000000,
"amount": 30000,
"rate": 1,
"precision": 100,
"transaction_id": "txn_0b59f6e-6c4a-4efa-915c-526f77ef61ab",
"parent_transaction": "",
"source": "",
"reference": "ref_f482a1b3-6c2d-4e89-a17b-3d5e8f2a1c94",
"currency": "USD",
"description": "Payment to Sarah",
"status": "QUEUED",
"hash": "8cfdc0f2562ce30c3728ef624dc29fbd0e4207c77df9220df0c699d45de0eef",
"allow_overdraft": false,
"inflight": false,
"atomic": true,
"sources": [
{
"identifier": "bln_f2073f6b-905a-4e3e-b5a2-8d1b3dc2fb7f",
"distribution": "10%",
"transaction_id": "txn_59347177-aa7e-d8ad-9f4f-d09628b32ec3"
},
{
"identifier": "bln_64c50fb5-32d5-4f78-9f4a-e8b01aaf025d",
"distribution": "2000000",
"transaction_id": "txn_7ddc8d4f-3b77-4b7d-a37f-240216ab074c"
},
{
"identifier": "bln_7d98dfe9-5c3e-4c9b-b96a-65f6d9f7b89b",
"distribution": "left",
"transaction_id": "txn_5aad04dd-ed53-4f77-9f01-4916d31fac5f"
}
],
"destination": "bln_92e4b9b6-0b85-4ef4-87a2-682c31500d38",
"created_at": "2025-09-18T01:26:30.648049042Z",
"scheduled_for": "0001-01-01T00:00:00Z",
"inflight_expiry_date": "0001-01-01T00:00:00Z",
"inflight_commit_date": "0001-01-01T00:00:00Z"
}
{
"precise_amount": 3000000,
"amount": 30000,
"rate": 1,
"precision": 100,
"transaction_id": "txn_8a3c1f2e-9d4b-4e5a-b6c7-1d2e3f4a5b6c",
"parent_transaction": "",
"source": "bln_92e4b9b6-0b85-4ef4-87a2-682c31500d38",
"reference": "ref_c5d9e2a1-7b4f-4a3c-9e8d-1f6a2b4c8d30",
"currency": "USD",
"description": "Payment from Sarah",
"status": "QUEUED",
"hash": "8cfdc0f2562ce30c3728ef624dc29fbd0e4207c77df9220df0c699d45de0eef",
"allow_overdraft": false,
"inflight": false,
"atomic": true,
"destinations": [
{
"identifier": "bln_f2073f6b-905a-4e3e-b5a2-8d1b3dc2fb7f",
"distribution": "20%",
"transaction_id": "txn_f482a1b3-6c2d-4e89-a17b-3d5e8f2a1c94"
},
{
"identifier": "bln_64c50fb5-32d5-4f78-9f4a-e8b01aaf025d",
"distribution": "1000000",
"transaction_id": "txn_c5d9e2a1-7b4f-4a3c-9e8d-1f6a2b4c8d30"
},
{
"identifier": "bln_7d98dfe9-5c3e-4c9b-b96a-65f6d9f7b89b",
"distribution": "left",
"transaction_id": "txn_a1b2c3d4-6e2d-4f89-a17b-3d5e8f2a1c94"
}
],
"created_at": "2025-09-18T01:26:30.648049042Z",
"scheduled_for": "0001-01-01T00:00:00Z",
"inflight_expiry_date": "0001-01-01T00:00:00Z",
"inflight_commit_date": "0001-01-01T00:00:00Z"
}
201 Created
{
"amount": 100000,
"rate": 0,
"precision": 100,
"precise_amount": 10000000,
"transaction_id": "txn_6164573b-6cc8-45a4-ad2e-7b4ba6a60f7d",
"parent_transaction": "",
"source": "bln_28edb3e5-c168-4127-a1c4-16274e7a28d3",
"destination": "bln_f482a1b3-6c2d-4e89-a17b-3d5e8f2a1c94",
"reference": "ref_f482a1b3-6c2d-4e89-a17b-3d5e8f2a1c94",
"currency": "USD",
"description": "Monthly fee",
"status": "QUEUED",
"hash": "0b9c25fb5b00d6c71cb4ca87026bf6dc316e63353d3330deb588bd0b3d74dcc0",
"allow_overdraft": false,
"inflight": false,
"created_at": "2024-12-21T01:36:46.997063436Z",
"scheduled_for": "2024-12-21T01:36:46+01:00",
"inflight_expiry_date": "0001-01-01T00:00:00Z",
"inflight_commit_date": "0001-01-01T00:00:00Z",
"meta_data": {
"sender_name": "John Doe",
"sender_account": "00000000000"
}
}
201 Created
{
"amount": 358.9,
"rate": 0,
"precision": 100,
"precise_amount": 35890,
"transaction_id": "txn_c62f200b-905f-4983-a349-cadd279234aa",
"parent_transaction": "",
"source": "bln_a03ef6af-1e5d-46a8-86a9-5fb1f2286f66",
"destination": "bln_68be0aed-383c-4d27-87db-fb0650093686",
"reference": "ref_f482a1b3-6c2d-4e89-a17b-3d5e8f2a1c94",
"currency": "NGN",
"description": "Backdated transaction",
"status": "APPLIED",
"hash": "0b9c25fb5b00d6c71cb4ca87026bf6dc316e63353d3330deb588bd0b3d74dcc0",
"allow_overdraft": false,
"inflight": false,
"created_at": "2025-03-02T15:30:45Z",
"effective_date": "2025-02-15T10:30:00Z",
"scheduled_for": "0001-01-01T00:00:00Z",
"inflight_expiry_date": "0001-01-01T00:00:00Z",
"inflight_commit_date": "0001-01-01T00:00:00Z"
}
Go response (*blnkgo.Transaction)
| Field | Type | Description |
|---|---|---|
TransactionID | string | Unique ID for the transaction. |
Status | blnkgo.PryTransactionStatus | Transaction status (for example QUEUED, APPLIED, INFLIGHT). |
PreciseAmount | *big.Int | Amount in minor units. |
Amount | float64 | Float amount after precision is applied. |
Precision | int64 | Precision for the currency. |
Source | string | Resolved source balance. |
Destination | string | Resolved destination balance. |
Sources | []blnkgo.Source | Source legs for split transactions. |
Destinations | []blnkgo.Source | Destination legs for split transactions. |
Reference | string | Unique reference for the transaction. |
Description | string | Narration of the transaction. |
EffectiveDate | *time.Time | Actual date the transaction occurred, for backdated transactions. |
CreatedAt | time.Time | Date and time the transaction was created. |
MetaData | MetaData | Optional metadata object. |
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