Manually dispatch a refund for a failed or cancelled transaction
curl --request POST \
--url https://sandbox-api.borderless.xyz/v1/transactions/{id}/refund \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'import requests
url = "https://sandbox-api.borderless.xyz/v1/transactions/{id}/refund"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://sandbox-api.borderless.xyz/v1/transactions/{id}/refund', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox-api.borderless.xyz/v1/transactions/{id}/refund",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox-api.borderless.xyz/v1/transactions/{id}/refund"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox-api.borderless.xyz/v1/transactions/{id}/refund")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-api.borderless.xyz/v1/transactions/{id}/refund")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body{
"supported": true,
"requiresManualAction": true,
"dispatchable": true,
"path": "PfiAutoReversal",
"status": "Created",
"destinationSource": "None",
"destination": {
"type": "Address",
"address": "<string>",
"autoRefund": true,
"autoFiatReturn": true
},
"reason": {
"message": "<string>",
"details": [
{
"pfiErrorMessage": "<string>",
"path": "<string>",
"externalStatus": "<string>"
}
]
},
"completedAt": "2023-11-07T05:31:56Z",
"failedAt": "2023-11-07T05:31:56Z",
"txHash": "<string>"
}Refunds
Manually dispatch a refund for a failed or cancelled transaction
Starts the refund workflow for the transaction’s existing refund plan.
Works even when the transaction was created with autoRefund: false, so use this endpoint to trigger refunds that were intentionally left for manual handling.
Optionally pass a refundDestination to replace the destination stored on the plan. The override is validated against the PFI’s refund capability before dispatch.
Plans in Created or Eligible status can be dispatched. Plans in ManualRequired status can also be dispatched if they were parked after a failed fiat payout; dispatching such a plan records consent to return the funds in crypto, converted from fiat at the current rate.
POST
/
v1
/
transactions
/
{id}
/
refund
Manually dispatch a refund for a failed or cancelled transaction
curl --request POST \
--url https://sandbox-api.borderless.xyz/v1/transactions/{id}/refund \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'import requests
url = "https://sandbox-api.borderless.xyz/v1/transactions/{id}/refund"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://sandbox-api.borderless.xyz/v1/transactions/{id}/refund', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox-api.borderless.xyz/v1/transactions/{id}/refund",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox-api.borderless.xyz/v1/transactions/{id}/refund"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox-api.borderless.xyz/v1/transactions/{id}/refund")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-api.borderless.xyz/v1/transactions/{id}/refund")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body{
"supported": true,
"requiresManualAction": true,
"dispatchable": true,
"path": "PfiAutoReversal",
"status": "Created",
"destinationSource": "None",
"destination": {
"type": "Address",
"address": "<string>",
"autoRefund": true,
"autoFiatReturn": true
},
"reason": {
"message": "<string>",
"details": [
{
"pfiErrorMessage": "<string>",
"path": "<string>",
"externalStatus": "<string>"
}
]
},
"completedAt": "2023-11-07T05:31:56Z",
"failedAt": "2023-11-07T05:31:56Z",
"txHash": "<string>"
}Authorizations
Body
application/json
Response
202 - application/json
Refund workflow dispatched. Returns the current RefundResolution.
Was this page helpful?