Créer un abonnement
curl --request POST \
--url https://api.saspay.me/api/v1/merchant-webhook-subscriptions/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"webhook": "c1d2e3f4-1111-2222-3333-444455556666",
"event_type": "transaction.success"
}
'import requests
url = "https://api.saspay.me/api/v1/merchant-webhook-subscriptions/"
payload = {
"webhook": "c1d2e3f4-1111-2222-3333-444455556666",
"event_type": "transaction.success"
}
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({
webhook: 'c1d2e3f4-1111-2222-3333-444455556666',
event_type: 'transaction.success'
})
};
fetch('https://api.saspay.me/api/v1/merchant-webhook-subscriptions/', 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.saspay.me/api/v1/merchant-webhook-subscriptions/",
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([
'webhook' => 'c1d2e3f4-1111-2222-3333-444455556666',
'event_type' => 'transaction.success'
]),
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://api.saspay.me/api/v1/merchant-webhook-subscriptions/"
payload := strings.NewReader("{\n \"webhook\": \"c1d2e3f4-1111-2222-3333-444455556666\",\n \"event_type\": \"transaction.success\"\n}")
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://api.saspay.me/api/v1/merchant-webhook-subscriptions/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"webhook\": \"c1d2e3f4-1111-2222-3333-444455556666\",\n \"event_type\": \"transaction.success\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.saspay.me/api/v1/merchant-webhook-subscriptions/")
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 = "{\n \"webhook\": \"c1d2e3f4-1111-2222-3333-444455556666\",\n \"event_type\": \"transaction.success\"\n}"
response = http.request(request)
puts response.read_body{
"id": "d2e3f4a5-1111-2222-3333-444455556666",
"webhook": "c1d2e3f4-1111-2222-3333-444455556666",
"event_type": "transaction.success",
"created_at": "2026-08-01T09:05:00Z",
"updated_at": "2026-08-01T09:05:00Z"
}Webhooks
Créer un abonnement
Abonne un webhook existant à un type d’event
POST
/
merchant-webhook-subscriptions
/
Créer un abonnement
curl --request POST \
--url https://api.saspay.me/api/v1/merchant-webhook-subscriptions/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"webhook": "c1d2e3f4-1111-2222-3333-444455556666",
"event_type": "transaction.success"
}
'import requests
url = "https://api.saspay.me/api/v1/merchant-webhook-subscriptions/"
payload = {
"webhook": "c1d2e3f4-1111-2222-3333-444455556666",
"event_type": "transaction.success"
}
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({
webhook: 'c1d2e3f4-1111-2222-3333-444455556666',
event_type: 'transaction.success'
})
};
fetch('https://api.saspay.me/api/v1/merchant-webhook-subscriptions/', 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.saspay.me/api/v1/merchant-webhook-subscriptions/",
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([
'webhook' => 'c1d2e3f4-1111-2222-3333-444455556666',
'event_type' => 'transaction.success'
]),
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://api.saspay.me/api/v1/merchant-webhook-subscriptions/"
payload := strings.NewReader("{\n \"webhook\": \"c1d2e3f4-1111-2222-3333-444455556666\",\n \"event_type\": \"transaction.success\"\n}")
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://api.saspay.me/api/v1/merchant-webhook-subscriptions/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"webhook\": \"c1d2e3f4-1111-2222-3333-444455556666\",\n \"event_type\": \"transaction.success\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.saspay.me/api/v1/merchant-webhook-subscriptions/")
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 = "{\n \"webhook\": \"c1d2e3f4-1111-2222-3333-444455556666\",\n \"event_type\": \"transaction.success\"\n}"
response = http.request(request)
puts response.read_body{
"id": "d2e3f4a5-1111-2222-3333-444455556666",
"webhook": "c1d2e3f4-1111-2222-3333-444455556666",
"event_type": "transaction.success",
"created_at": "2026-08-01T09:05:00Z",
"updated_at": "2026-08-01T09:05:00Z"
}Un webhook ne peut être abonné qu’une seule fois au même
event_type. Si vous retentez, vous recevrez actuellement une erreur serveur générique plutôt qu’un message dédié — vérifiez d’abord la liste de vos abonnements existants avant de créer.Authorizations
Clé API secrète du marchand — header Authorization: Bearer sk_live_xxx (ou sk_test_xxx en environnement de test).
Body
application/json
Available options:
transaction.created, transaction.success, transaction.failed, transaction.cancelled, settlement.requested, settlement.approved, settlement.success, settlement.failed, settlement.cancelled, wallet_transfer.requested, wallet_transfer.completed, wallet_transfer.rejected, webhook.test Response
201 - application/json
Abonnement créé
⌘I