Create Webhook Subscription
curl --request POST \
--url https://api.example.com/customer/webhooks/subscriptions \
--header 'Content-Type: application/json' \
--header 'X-API-NONCE: <x-api-nonce>' \
--header 'X-API-SIGNATURE: <x-api-signature>' \
--header 'X-API-SUBSCRIPTION-KEY: <x-api-subscription-key>' \
--header 'X-API-TIMESTAMP: <x-api-timestamp>' \
--data '
{
"event_types": "transaction",
"callback_url": "https://example.com/webhook",
"description": "Transaction events"
}
'import requests
url = "https://api.example.com/customer/webhooks/subscriptions"
payload = {
"event_types": "transaction",
"callback_url": "https://example.com/webhook",
"description": "Transaction events"
}
headers = {
"X-API-SIGNATURE": "<x-api-signature>",
"X-API-TIMESTAMP": "<x-api-timestamp>",
"X-API-NONCE": "<x-api-nonce>",
"X-API-SUBSCRIPTION-KEY": "<x-api-subscription-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-API-SIGNATURE': '<x-api-signature>',
'X-API-TIMESTAMP': '<x-api-timestamp>',
'X-API-NONCE': '<x-api-nonce>',
'X-API-SUBSCRIPTION-KEY': '<x-api-subscription-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
event_types: 'transaction',
callback_url: 'https://example.com/webhook',
description: 'Transaction events'
})
};
fetch('https://api.example.com/customer/webhooks/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.example.com/customer/webhooks/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([
'event_types' => 'transaction',
'callback_url' => 'https://example.com/webhook',
'description' => 'Transaction events'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-NONCE: <x-api-nonce>",
"X-API-SIGNATURE: <x-api-signature>",
"X-API-SUBSCRIPTION-KEY: <x-api-subscription-key>",
"X-API-TIMESTAMP: <x-api-timestamp>"
],
]);
$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.example.com/customer/webhooks/subscriptions"
payload := strings.NewReader("{\n \"event_types\": \"transaction\",\n \"callback_url\": \"https://example.com/webhook\",\n \"description\": \"Transaction events\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-SIGNATURE", "<x-api-signature>")
req.Header.Add("X-API-TIMESTAMP", "<x-api-timestamp>")
req.Header.Add("X-API-NONCE", "<x-api-nonce>")
req.Header.Add("X-API-SUBSCRIPTION-KEY", "<x-api-subscription-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.example.com/customer/webhooks/subscriptions")
.header("X-API-SIGNATURE", "<x-api-signature>")
.header("X-API-TIMESTAMP", "<x-api-timestamp>")
.header("X-API-NONCE", "<x-api-nonce>")
.header("X-API-SUBSCRIPTION-KEY", "<x-api-subscription-key>")
.header("Content-Type", "application/json")
.body("{\n \"event_types\": \"transaction\",\n \"callback_url\": \"https://example.com/webhook\",\n \"description\": \"Transaction events\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/customer/webhooks/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-SIGNATURE"] = '<x-api-signature>'
request["X-API-TIMESTAMP"] = '<x-api-timestamp>'
request["X-API-NONCE"] = '<x-api-nonce>'
request["X-API-SUBSCRIPTION-KEY"] = '<x-api-subscription-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"event_types\": \"transaction\",\n \"callback_url\": \"https://example.com/webhook\",\n \"description\": \"Transaction events\"\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"data": {
"subscription_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"event_type": "1234",
"callback_url": "https://example.com/webhook",
"created_at": "1234",
"description": "Transaction events",
"status": "1234",
"updated_at": "1234"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Webhook Endpoints
Create Webhook
Create a webhook subscription for a specific event type.
POST
/
customer
/
webhooks
/
subscriptions
Create Webhook Subscription
curl --request POST \
--url https://api.example.com/customer/webhooks/subscriptions \
--header 'Content-Type: application/json' \
--header 'X-API-NONCE: <x-api-nonce>' \
--header 'X-API-SIGNATURE: <x-api-signature>' \
--header 'X-API-SUBSCRIPTION-KEY: <x-api-subscription-key>' \
--header 'X-API-TIMESTAMP: <x-api-timestamp>' \
--data '
{
"event_types": "transaction",
"callback_url": "https://example.com/webhook",
"description": "Transaction events"
}
'import requests
url = "https://api.example.com/customer/webhooks/subscriptions"
payload = {
"event_types": "transaction",
"callback_url": "https://example.com/webhook",
"description": "Transaction events"
}
headers = {
"X-API-SIGNATURE": "<x-api-signature>",
"X-API-TIMESTAMP": "<x-api-timestamp>",
"X-API-NONCE": "<x-api-nonce>",
"X-API-SUBSCRIPTION-KEY": "<x-api-subscription-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-API-SIGNATURE': '<x-api-signature>',
'X-API-TIMESTAMP': '<x-api-timestamp>',
'X-API-NONCE': '<x-api-nonce>',
'X-API-SUBSCRIPTION-KEY': '<x-api-subscription-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
event_types: 'transaction',
callback_url: 'https://example.com/webhook',
description: 'Transaction events'
})
};
fetch('https://api.example.com/customer/webhooks/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.example.com/customer/webhooks/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([
'event_types' => 'transaction',
'callback_url' => 'https://example.com/webhook',
'description' => 'Transaction events'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-NONCE: <x-api-nonce>",
"X-API-SIGNATURE: <x-api-signature>",
"X-API-SUBSCRIPTION-KEY: <x-api-subscription-key>",
"X-API-TIMESTAMP: <x-api-timestamp>"
],
]);
$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.example.com/customer/webhooks/subscriptions"
payload := strings.NewReader("{\n \"event_types\": \"transaction\",\n \"callback_url\": \"https://example.com/webhook\",\n \"description\": \"Transaction events\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-SIGNATURE", "<x-api-signature>")
req.Header.Add("X-API-TIMESTAMP", "<x-api-timestamp>")
req.Header.Add("X-API-NONCE", "<x-api-nonce>")
req.Header.Add("X-API-SUBSCRIPTION-KEY", "<x-api-subscription-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.example.com/customer/webhooks/subscriptions")
.header("X-API-SIGNATURE", "<x-api-signature>")
.header("X-API-TIMESTAMP", "<x-api-timestamp>")
.header("X-API-NONCE", "<x-api-nonce>")
.header("X-API-SUBSCRIPTION-KEY", "<x-api-subscription-key>")
.header("Content-Type", "application/json")
.body("{\n \"event_types\": \"transaction\",\n \"callback_url\": \"https://example.com/webhook\",\n \"description\": \"Transaction events\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/customer/webhooks/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-SIGNATURE"] = '<x-api-signature>'
request["X-API-TIMESTAMP"] = '<x-api-timestamp>'
request["X-API-NONCE"] = '<x-api-nonce>'
request["X-API-SUBSCRIPTION-KEY"] = '<x-api-subscription-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"event_types\": \"transaction\",\n \"callback_url\": \"https://example.com/webhook\",\n \"description\": \"Transaction events\"\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"data": {
"subscription_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"event_type": "1234",
"callback_url": "https://example.com/webhook",
"created_at": "1234",
"description": "Transaction events",
"status": "1234",
"updated_at": "1234"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Headers
Signature header
Timestamp header
Nonce header
Account ID header
Body
application/json
Schema to deserialize the webhook subscription request.
⌘I