Transactions
Refund transaction
Refund a transaction with the Go SDK.
POST
/
refund-transaction
/
{transaction_id}
Refund transaction
curl --request POST \
--url http://localhost:5001/refund-transaction/{transaction_id} \
--header 'X-blnk-key: <api-key>'import requests
url = "http://localhost:5001/refund-transaction/{transaction_id}"
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/refund-transaction/{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/refund-transaction/{transaction_id}",
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/refund-transaction/{transaction_id}"
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/refund-transaction/{transaction_id}")
.header("X-blnk-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:5001/refund-transaction/{transaction_id}")
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.Refund to refund a transaction.
1
Call the method
- Queued refund
- Synchronous refund
Omit the optional body to queue the refund using Core defaults.
client.Transaction.Refund
refund, resp, err := client.Transaction.Refund(
"txn_c4e70eb8-e4d6-4e04-a2e2-92a43b969e0c",
)
Pass a
RefundTransactionRequest with SkipQueue: true to process the refund synchronously.client.Transaction.Refund
refund, resp, err := client.Transaction.Refund(
"txn_c4e70eb8-e4d6-4e04-a2e2-92a43b969e0c",
&blnkgo.RefundTransactionRequest{
SkipQueue: true,
},
)
| Field | Type | Description |
|---|---|---|
transactionID | string | Transaction ID of the applied transaction to refund. |
SkipQueue | bool | When true, process the refund synchronously instead of queuing. |
2
Response
201 Created
{
"amount": 1250.34,
"rate": 0,
"precision": 100,
"precise_amount": 125034,
"transaction_id": "txn_c4e70eb8-e4d6-4e04-a2e2-92a43b969e0c",
"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": "QUEUED",
"hash": "0b9c25fb5b00d6c71cb4ca87026bf6dc316e63353d3330deb588bd0b3d74dcc0",
"created_at": "2024-11-26T09:33:35.265582042Z"
}
Go response (*blnkgo.Transaction)
| Field | Type | Description |
|---|---|---|
TransactionID | string | ID of the new refund transaction. |
ParentTransactionID | string | Original transaction being refunded. |
Source | string | Original destination, now the source of the refund. |
Destination | string | Original source, now the destination of the refund. |
Status | blnkgo.PryTransactionStatus | Status of the refund transaction. |
PreciseAmount | *big.Int | Refund amount in minor units. |
Amount | float64 | Float refund amount after precision is applied. |
Currency | string | Currency of the refund. |
CreatedAt | time.Time | Date and time the refund 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