curl --request POST \
--url https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/payments/{payment-id}/cancel \
--header 'Content-Type: application/json' \
--header 'X-SFPY-AGGREGATOR-SECRET-KEY: <api-key>' \
--data '
{
"request_id": "f0a3b1c2-8d4e-4f6a-9b1c-2d3e4f5a6b7c",
"reason": "PAYMENT_CANCEL_REASON_CUSTOMER_REQUEST",
"additional_info": "Customer requested cancellation"
}
'import requests
url = "https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/payments/{payment-id}/cancel"
payload = {
"request_id": "f0a3b1c2-8d4e-4f6a-9b1c-2d3e4f5a6b7c",
"reason": "PAYMENT_CANCEL_REASON_CUSTOMER_REQUEST",
"additional_info": "Customer requested cancellation"
}
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: 'f0a3b1c2-8d4e-4f6a-9b1c-2d3e4f5a6b7c',
reason: 'PAYMENT_CANCEL_REASON_CUSTOMER_REQUEST',
additional_info: 'Customer requested cancellation'
})
};
fetch('https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/payments/{payment-id}/cancel', 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}/payments/{payment-id}/cancel",
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' => 'f0a3b1c2-8d4e-4f6a-9b1c-2d3e4f5a6b7c',
'reason' => 'PAYMENT_CANCEL_REASON_CUSTOMER_REQUEST',
'additional_info' => 'Customer requested cancellation'
]),
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}/payments/{payment-id}/cancel"
payload := strings.NewReader("{\n \"request_id\": \"f0a3b1c2-8d4e-4f6a-9b1c-2d3e4f5a6b7c\",\n \"reason\": \"PAYMENT_CANCEL_REASON_CUSTOMER_REQUEST\",\n \"additional_info\": \"Customer requested cancellation\"\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}/payments/{payment-id}/cancel")
.header("X-SFPY-AGGREGATOR-SECRET-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"request_id\": \"f0a3b1c2-8d4e-4f6a-9b1c-2d3e4f5a6b7c\",\n \"reason\": \"PAYMENT_CANCEL_REASON_CUSTOMER_REQUEST\",\n \"additional_info\": \"Customer requested cancellation\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/payments/{payment-id}/cancel")
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\": \"f0a3b1c2-8d4e-4f6a-9b1c-2d3e4f5a6b7c\",\n \"reason\": \"PAYMENT_CANCEL_REASON_CUSTOMER_REQUEST\",\n \"additional_info\": \"Customer requested cancellation\"\n}"
response = http.request(request)
puts response.read_body{
"api_version": "v1",
"data": {
"token": "pc_3b2a1c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
"payment_id": "pm_96bc0ef4-7857-47fb-a345-c411a23aeb92",
"request_id": "f0a3b1c2-8d4e-4f6a-9b1c-2d3e4f5a6b7c",
"status": "PAYMENT_CANCEL_CREATED",
"reason": "PAYMENT_CANCEL_REASON_CUSTOMER_REQUEST",
"additional_info": "Customer requested cancellation",
"iso_reason": "CUST",
"iso_status": "",
"created_at": "2025-06-26T10:58:17Z",
"updated_at": "2025-06-26T10:58:17Z"
}
}{
"code": "error.bad_request",
"message": "Invalid request parameters"
}{
"api_version": "v1",
"error": {
"code": "error.unauthorized_access",
"message": "partner access key is required in request header"
}
}{
"code": "error.not_found",
"message": "Requested resource not found"
}{
"api_version": "v1",
"error": {
"code": "error.internal_server_error",
"message": "rpc error code Internal desc = something went wrong"
}
}Cancel RTP
Request cancellation of an unsettled Request-to-Pay (RTP) payment. The payment must still be in a P_INITIATED or P_RECEIVED state; terminal payments cannot be cancelled. A 202 Accepted response means the cancellation request was created and the camt.055 was posted to Raast - the final outcome is asynchronous. Poll the payment and inspect the cancellation status, which progresses from PAYMENT_CANCEL_CREATED to either PAYMENT_CANCEL_ACCEPTED or PAYMENT_CANCEL_REJECTED.
curl --request POST \
--url https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/payments/{payment-id}/cancel \
--header 'Content-Type: application/json' \
--header 'X-SFPY-AGGREGATOR-SECRET-KEY: <api-key>' \
--data '
{
"request_id": "f0a3b1c2-8d4e-4f6a-9b1c-2d3e4f5a6b7c",
"reason": "PAYMENT_CANCEL_REASON_CUSTOMER_REQUEST",
"additional_info": "Customer requested cancellation"
}
'import requests
url = "https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/payments/{payment-id}/cancel"
payload = {
"request_id": "f0a3b1c2-8d4e-4f6a-9b1c-2d3e4f5a6b7c",
"reason": "PAYMENT_CANCEL_REASON_CUSTOMER_REQUEST",
"additional_info": "Customer requested cancellation"
}
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: 'f0a3b1c2-8d4e-4f6a-9b1c-2d3e4f5a6b7c',
reason: 'PAYMENT_CANCEL_REASON_CUSTOMER_REQUEST',
additional_info: 'Customer requested cancellation'
})
};
fetch('https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/payments/{payment-id}/cancel', 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}/payments/{payment-id}/cancel",
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' => 'f0a3b1c2-8d4e-4f6a-9b1c-2d3e4f5a6b7c',
'reason' => 'PAYMENT_CANCEL_REASON_CUSTOMER_REQUEST',
'additional_info' => 'Customer requested cancellation'
]),
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}/payments/{payment-id}/cancel"
payload := strings.NewReader("{\n \"request_id\": \"f0a3b1c2-8d4e-4f6a-9b1c-2d3e4f5a6b7c\",\n \"reason\": \"PAYMENT_CANCEL_REASON_CUSTOMER_REQUEST\",\n \"additional_info\": \"Customer requested cancellation\"\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}/payments/{payment-id}/cancel")
.header("X-SFPY-AGGREGATOR-SECRET-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"request_id\": \"f0a3b1c2-8d4e-4f6a-9b1c-2d3e4f5a6b7c\",\n \"reason\": \"PAYMENT_CANCEL_REASON_CUSTOMER_REQUEST\",\n \"additional_info\": \"Customer requested cancellation\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/payments/{payment-id}/cancel")
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\": \"f0a3b1c2-8d4e-4f6a-9b1c-2d3e4f5a6b7c\",\n \"reason\": \"PAYMENT_CANCEL_REASON_CUSTOMER_REQUEST\",\n \"additional_info\": \"Customer requested cancellation\"\n}"
response = http.request(request)
puts response.read_body{
"api_version": "v1",
"data": {
"token": "pc_3b2a1c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
"payment_id": "pm_96bc0ef4-7857-47fb-a345-c411a23aeb92",
"request_id": "f0a3b1c2-8d4e-4f6a-9b1c-2d3e4f5a6b7c",
"status": "PAYMENT_CANCEL_CREATED",
"reason": "PAYMENT_CANCEL_REASON_CUSTOMER_REQUEST",
"additional_info": "Customer requested cancellation",
"iso_reason": "CUST",
"iso_status": "",
"created_at": "2025-06-26T10:58:17Z",
"updated_at": "2025-06-26T10:58:17Z"
}
}{
"code": "error.bad_request",
"message": "Invalid request parameters"
}{
"api_version": "v1",
"error": {
"code": "error.unauthorized_access",
"message": "partner access key is required in request header"
}
}{
"code": "error.not_found",
"message": "Requested resource not found"
}{
"api_version": "v1",
"error": {
"code": "error.internal_server_error",
"message": "rpc error code Internal desc = something went wrong"
}
}Authorizations
Path Parameters
The unique identifier for the aggregator
"agg_2288490a-2176-4de5-b373-0ffb6f8e2e6e"
The unique identifier for the payment
"pm_2288490a-2176-4de5-b373-0ffb6f8e2e6e"
Body
Request to cancel an unsettled RTP payment
RTP cancellation payload
Client-supplied UUID v4 idempotency key for the cancellation (exactly 36 characters with hyphens). Must be distinct from the original payment's request id.
"f0a3b1c2-8d4e-4f6a-9b1c-2d3e4f5a6b7c"
Public reason for the cancellation. Only PAYMENT_CANCEL_REASON_CUSTOMER_REQUEST is currently accepted; the remaining reason codes are reserved until Raast confirms support for them.
PAYMENT_CANCEL_REASON_CUSTOMER_REQUEST "PAYMENT_CANCEL_REASON_CUSTOMER_REQUEST"
Optional free-text context for the cancellation (max 105 characters).
105Response
Cancellation request accepted. The camt.055 has been posted to Raast and the final outcome is delivered asynchronously.
Was this page helpful?