Transactions
Get transaction by reference
Retrieve a transaction by its reference with the Go SDK.
GET
/
transactions
/
reference
/
{reference}
Get transaction by reference
curl --request GET \
--url http://localhost:5001/transactions/reference/{reference} \
--header 'X-blnk-key: <api-key>'import requests
url = "http://localhost:5001/transactions/reference/{reference}"
headers = {"X-blnk-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-blnk-key': '<api-key>'}};
fetch('http://localhost:5001/transactions/reference/{reference}', 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/reference/{reference}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
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/reference/{reference}"
req, _ := http.NewRequest("GET", 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.get("http://localhost:5001/transactions/reference/{reference}")
.header("X-blnk-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:5001/transactions/reference/{reference}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["X-blnk-key"] = '<api-key>'
response = http.request(request)
puts response.read_bodyUse
Go response (
client.Transaction.GetByReference to retrieve a transaction by reference.
1
Call the method
client.Transaction.GetByReference
transaction, resp, err := client.Transaction.GetByReference(
"ref_04551509-d7d3-4eab-a1fd-2eb12809b5a4",
)
| Field | Type | Description |
|---|---|---|
reference | string | Unique reference passed when the transaction was created. |
2
Response
200 OK
{
"precise_amount": 300,
"amount": 3,
"rate": 0,
"precision": 100,
"transaction_id": "txn_93c3f6dc-9c2c-46b0-89c5-1814cef4d0e4",
"parent_transaction": "",
"source": "bln_845bbf20-cc0c-41d2-810b-24f104f1cb8b",
"destination": "bln_e92a1ba7-92c7-427c-8c8f-bfdca55c875d",
"reference": "ref_04551509-d7d3-4eab-a1fd-2eb12809b5a4",
"currency": "BTC",
"description": "test",
"status": "APPLIED",
"hash": "0b9c25fb5b00d6c71cb4ca87026bf6dc316e63353d3330deb588bd0b3d74dcc0",
"allow_overdraft": false,
"inflight": false,
"created_at": "2025-02-08T13:36:42.748594Z",
"meta_data": {
"customer_id": "12345",
"payment_method": "card"
}
}
Go response (*blnkgo.Transaction)
| Field | Type | Description |
|---|---|---|
TransactionID | string | Unique ID for the transaction. |
Reference | string | Reference you queried. |
Status | blnkgo.PryTransactionStatus | Current status of the transaction. |
PreciseAmount | *big.Int | Amount in minor units. |
Amount | float64 | Float amount after precision is applied. |
Currency | string | Currency of the transaction. |
Source | string | Source balance. |
Destination | string | Destination balance. |
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