Create Refund
curl --request POST \
--url https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/refunds \
--header 'Content-Type: application/json' \
--header 'X-SFPY-AGGREGATOR-SECRET-KEY: <api-key>' \
--data '
{
"request_id": "9af69842-3011-4d6b-98d0-c3de1caa96d3",
"payment_id": "pm_54b6bcee-aa58-454d-aed9-ce97d6bdd797",
"amount": 500,
"reason": "TechnicalProblem",
"addtl_info": "",
"debitor_iban": "PK12ALFH0031001006540005"
}
'import requests
url = "https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/refunds"
payload = {
"request_id": "9af69842-3011-4d6b-98d0-c3de1caa96d3",
"payment_id": "pm_54b6bcee-aa58-454d-aed9-ce97d6bdd797",
"amount": 500,
"reason": "TechnicalProblem",
"addtl_info": "",
"debitor_iban": "PK12ALFH0031001006540005"
}
headers = {
"X-SFPY-AGGREGATOR-SECRET-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-SFPY-AGGREGATOR-SECRET-KEY': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
request_id: '9af69842-3011-4d6b-98d0-c3de1caa96d3',
payment_id: 'pm_54b6bcee-aa58-454d-aed9-ce97d6bdd797',
amount: 500,
reason: 'TechnicalProblem',
addtl_info: '',
debitor_iban: 'PK12ALFH0031001006540005'
})
};
fetch('https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/refunds', 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://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/refunds",
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([
'request_id' => '9af69842-3011-4d6b-98d0-c3de1caa96d3',
'payment_id' => 'pm_54b6bcee-aa58-454d-aed9-ce97d6bdd797',
'amount' => 500,
'reason' => 'TechnicalProblem',
'addtl_info' => '',
'debitor_iban' => 'PK12ALFH0031001006540005'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-SFPY-AGGREGATOR-SECRET-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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/refunds"
payload := strings.NewReader("{\n \"request_id\": \"9af69842-3011-4d6b-98d0-c3de1caa96d3\",\n \"payment_id\": \"pm_54b6bcee-aa58-454d-aed9-ce97d6bdd797\",\n \"amount\": 500,\n \"reason\": \"TechnicalProblem\",\n \"addtl_info\": \"\",\n \"debitor_iban\": \"PK12ALFH0031001006540005\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-SFPY-AGGREGATOR-SECRET-KEY", "<api-key>")
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://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/refunds")
.header("X-SFPY-AGGREGATOR-SECRET-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"request_id\": \"9af69842-3011-4d6b-98d0-c3de1caa96d3\",\n \"payment_id\": \"pm_54b6bcee-aa58-454d-aed9-ce97d6bdd797\",\n \"amount\": 500,\n \"reason\": \"TechnicalProblem\",\n \"addtl_info\": \"\",\n \"debitor_iban\": \"PK12ALFH0031001006540005\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/refunds")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-SFPY-AGGREGATOR-SECRET-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"request_id\": \"9af69842-3011-4d6b-98d0-c3de1caa96d3\",\n \"payment_id\": \"pm_54b6bcee-aa58-454d-aed9-ce97d6bdd797\",\n \"amount\": 500,\n \"reason\": \"TechnicalProblem\",\n \"addtl_info\": \"\",\n \"debitor_iban\": \"PK12ALFH0031001006540005\"\n}"
response = http.request(request)
puts response.read_body{
"api_version": "v1",
"data": {
"token": "<string>",
"payment_id": "<string>",
"amount": "<string>",
"type": "<string>",
"reason": "<string>",
"addtl_info": "<string>",
"status": "<string>",
"trace_reference": "<string>",
"msg_id": "<string>",
"return_id": "<string>",
"request_id": "<string>",
"msg_created_at": "2025-03-13T09:12:34.000Z",
"settle_at": null,
"created_at": "2025-03-13T09:12:34.000Z",
"updated_at": "2025-03-13T09:12:34.000Z"
}
}Refunds
Create Refund
Issue a refund against a payment
POST
/
v1
/
aggregators
/
{raast-aggregator-id}
/
refunds
Create Refund
curl --request POST \
--url https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/refunds \
--header 'Content-Type: application/json' \
--header 'X-SFPY-AGGREGATOR-SECRET-KEY: <api-key>' \
--data '
{
"request_id": "9af69842-3011-4d6b-98d0-c3de1caa96d3",
"payment_id": "pm_54b6bcee-aa58-454d-aed9-ce97d6bdd797",
"amount": 500,
"reason": "TechnicalProblem",
"addtl_info": "",
"debitor_iban": "PK12ALFH0031001006540005"
}
'import requests
url = "https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/refunds"
payload = {
"request_id": "9af69842-3011-4d6b-98d0-c3de1caa96d3",
"payment_id": "pm_54b6bcee-aa58-454d-aed9-ce97d6bdd797",
"amount": 500,
"reason": "TechnicalProblem",
"addtl_info": "",
"debitor_iban": "PK12ALFH0031001006540005"
}
headers = {
"X-SFPY-AGGREGATOR-SECRET-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-SFPY-AGGREGATOR-SECRET-KEY': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
request_id: '9af69842-3011-4d6b-98d0-c3de1caa96d3',
payment_id: 'pm_54b6bcee-aa58-454d-aed9-ce97d6bdd797',
amount: 500,
reason: 'TechnicalProblem',
addtl_info: '',
debitor_iban: 'PK12ALFH0031001006540005'
})
};
fetch('https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/refunds', 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://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/refunds",
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([
'request_id' => '9af69842-3011-4d6b-98d0-c3de1caa96d3',
'payment_id' => 'pm_54b6bcee-aa58-454d-aed9-ce97d6bdd797',
'amount' => 500,
'reason' => 'TechnicalProblem',
'addtl_info' => '',
'debitor_iban' => 'PK12ALFH0031001006540005'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-SFPY-AGGREGATOR-SECRET-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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/refunds"
payload := strings.NewReader("{\n \"request_id\": \"9af69842-3011-4d6b-98d0-c3de1caa96d3\",\n \"payment_id\": \"pm_54b6bcee-aa58-454d-aed9-ce97d6bdd797\",\n \"amount\": 500,\n \"reason\": \"TechnicalProblem\",\n \"addtl_info\": \"\",\n \"debitor_iban\": \"PK12ALFH0031001006540005\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-SFPY-AGGREGATOR-SECRET-KEY", "<api-key>")
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://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/refunds")
.header("X-SFPY-AGGREGATOR-SECRET-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"request_id\": \"9af69842-3011-4d6b-98d0-c3de1caa96d3\",\n \"payment_id\": \"pm_54b6bcee-aa58-454d-aed9-ce97d6bdd797\",\n \"amount\": 500,\n \"reason\": \"TechnicalProblem\",\n \"addtl_info\": \"\",\n \"debitor_iban\": \"PK12ALFH0031001006540005\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/refunds")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-SFPY-AGGREGATOR-SECRET-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"request_id\": \"9af69842-3011-4d6b-98d0-c3de1caa96d3\",\n \"payment_id\": \"pm_54b6bcee-aa58-454d-aed9-ce97d6bdd797\",\n \"amount\": 500,\n \"reason\": \"TechnicalProblem\",\n \"addtl_info\": \"\",\n \"debitor_iban\": \"PK12ALFH0031001006540005\"\n}"
response = http.request(request)
puts response.read_body{
"api_version": "v1",
"data": {
"token": "<string>",
"payment_id": "<string>",
"amount": "<string>",
"type": "<string>",
"reason": "<string>",
"addtl_info": "<string>",
"status": "<string>",
"trace_reference": "<string>",
"msg_id": "<string>",
"return_id": "<string>",
"request_id": "<string>",
"msg_created_at": "2025-03-13T09:12:34.000Z",
"settle_at": null,
"created_at": "2025-03-13T09:12:34.000Z",
"updated_at": "2025-03-13T09:12:34.000Z"
}
}Authorizations
Path Parameters
The unique identifier for the aggregator
Example:
"agg_2288490a-2176-4de5-b373-0ffb6f8e2e6e"
Body
application/json
Request to create Refund
Was this page helpful?
⌘I