Create Webhook
curl --request POST \
--url https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/webhooks \
--header 'Content-Type: application/json' \
--header 'X-SFPY-AGGREGATOR-SECRET-KEY: <api-key>' \
--data '
{
"url": "https://github.com/HasCold",
"description": "this is testing url endpoint",
"event_types": [
"payment.created"
],
"enabled": true
}
'import requests
url = "https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/webhooks"
payload = {
"url": "https://github.com/HasCold",
"description": "this is testing url endpoint",
"event_types": ["payment.created"],
"enabled": True
}
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({
url: 'https://github.com/HasCold',
description: 'this is testing url endpoint',
event_types: ['payment.created'],
enabled: true
})
};
fetch('https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/webhooks', 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}/webhooks",
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([
'url' => 'https://github.com/HasCold',
'description' => 'this is testing url endpoint',
'event_types' => [
'payment.created'
],
'enabled' => true
]),
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}/webhooks"
payload := strings.NewReader("{\n \"url\": \"https://github.com/HasCold\",\n \"description\": \"this is testing url endpoint\",\n \"event_types\": [\n \"payment.created\"\n ],\n \"enabled\": true\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}/webhooks")
.header("X-SFPY-AGGREGATOR-SECRET-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://github.com/HasCold\",\n \"description\": \"this is testing url endpoint\",\n \"event_types\": [\n \"payment.created\"\n ],\n \"enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/webhooks")
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 \"url\": \"https://github.com/HasCold\",\n \"description\": \"this is testing url endpoint\",\n \"event_types\": [\n \"payment.created\"\n ],\n \"enabled\": true\n}"
response = http.request(request)
puts response.read_body{
"api_version": "v1",
"data": {
"endpoint": {
"token": "wh_f52d84b4-a140-4a3a-b707-80644232e926",
"aggregator_id": "agg_2288490a-2176-4de5-b373-0ffb6f8e2e6e",
"url": "https://github.com/HasCold",
"description": "this is testing url endpoint",
"enabled": true,
"event_filter_json": "[\"payment.created\"]",
"created_at": "2025-12-02T12:48:35.416597859Z",
"updated_at": "2025-12-02T12:48:35.416597859Z",
"secret": "9sU3KVM5iQYZsxt40st1nkJsvbyuLnquB3Re1Q7k08w=",
"secret_version": 1,
"secret_rotated_at": "2025-12-02T12:48:35.416597859Z"
},
"secret": "9sU3KVM5iQYZsxt40st1nkJsvbyuLnquB3Re1Q7k08w="
}
}{
"code": "error.bad_request",
"message": "Invalid request parameters"
}Webhooks
Create Webhook
POST
/
v1
/
aggregators
/
{raast-aggregator-id}
/
webhooks
Create Webhook
curl --request POST \
--url https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/webhooks \
--header 'Content-Type: application/json' \
--header 'X-SFPY-AGGREGATOR-SECRET-KEY: <api-key>' \
--data '
{
"url": "https://github.com/HasCold",
"description": "this is testing url endpoint",
"event_types": [
"payment.created"
],
"enabled": true
}
'import requests
url = "https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/webhooks"
payload = {
"url": "https://github.com/HasCold",
"description": "this is testing url endpoint",
"event_types": ["payment.created"],
"enabled": True
}
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({
url: 'https://github.com/HasCold',
description: 'this is testing url endpoint',
event_types: ['payment.created'],
enabled: true
})
};
fetch('https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/webhooks', 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}/webhooks",
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([
'url' => 'https://github.com/HasCold',
'description' => 'this is testing url endpoint',
'event_types' => [
'payment.created'
],
'enabled' => true
]),
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}/webhooks"
payload := strings.NewReader("{\n \"url\": \"https://github.com/HasCold\",\n \"description\": \"this is testing url endpoint\",\n \"event_types\": [\n \"payment.created\"\n ],\n \"enabled\": true\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}/webhooks")
.header("X-SFPY-AGGREGATOR-SECRET-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://github.com/HasCold\",\n \"description\": \"this is testing url endpoint\",\n \"event_types\": [\n \"payment.created\"\n ],\n \"enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/webhooks")
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 \"url\": \"https://github.com/HasCold\",\n \"description\": \"this is testing url endpoint\",\n \"event_types\": [\n \"payment.created\"\n ],\n \"enabled\": true\n}"
response = http.request(request)
puts response.read_body{
"api_version": "v1",
"data": {
"endpoint": {
"token": "wh_f52d84b4-a140-4a3a-b707-80644232e926",
"aggregator_id": "agg_2288490a-2176-4de5-b373-0ffb6f8e2e6e",
"url": "https://github.com/HasCold",
"description": "this is testing url endpoint",
"enabled": true,
"event_filter_json": "[\"payment.created\"]",
"created_at": "2025-12-02T12:48:35.416597859Z",
"updated_at": "2025-12-02T12:48:35.416597859Z",
"secret": "9sU3KVM5iQYZsxt40st1nkJsvbyuLnquB3Re1Q7k08w=",
"secret_version": 1,
"secret_rotated_at": "2025-12-02T12:48:35.416597859Z"
},
"secret": "9sU3KVM5iQYZsxt40st1nkJsvbyuLnquB3Re1Q7k08w="
}
}{
"code": "error.bad_request",
"message": "Invalid request parameters"
}Authorizations
Path Parameters
The unique identifier for the aggregator
Example:
"agg_2288490a-2176-4de5-b373-0ffb6f8e2e6e"
Body
application/json
Request to create a webhook endpoint
Parameters for creating a webhook endpoint
The URL where webhook events will be sent
Example:
"https://github.com/HasCold"
List of event types to subscribe to
Example:
[
"payment.created",
"payment.completed",
"refund.completed",
"refund.created",
"settlement.processing",
"settlement.completed"
]
Optional description for the webhook endpoint
Example:
"this is testing url endpoint"
Whether the webhook endpoint should be enabled immediately
Example:
true
Was this page helpful?
⌘I