Test webhook signature verification
curl --request POST \
--url https://sandbox.elementpay.net/webhooks/test \
--header 'Content-Type: application/json' \
--header 'X-Webhook-Signature: <x-webhook-signature>' \
--data '{
"ping": "pong"
}'import requests
url = "https://sandbox.elementpay.net/webhooks/test"
payload = { "ping": "pong" }
headers = {
"X-Webhook-Signature": "<x-webhook-signature>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Webhook-Signature': '<x-webhook-signature>',
'Content-Type': 'application/json'
},
body: JSON.stringify({ping: 'pong'})
};
fetch('https://sandbox.elementpay.net/webhooks/test', 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://sandbox.elementpay.net/webhooks/test",
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([
'ping' => 'pong'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Webhook-Signature: <x-webhook-signature>"
],
]);
$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://sandbox.elementpay.net/webhooks/test"
payload := strings.NewReader("{\n \"ping\": \"pong\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Webhook-Signature", "<x-webhook-signature>")
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://sandbox.elementpay.net/webhooks/test")
.header("X-Webhook-Signature", "<x-webhook-signature>")
.header("Content-Type", "application/json")
.body("{\n \"ping\": \"pong\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.elementpay.net/webhooks/test")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Webhook-Signature"] = '<x-webhook-signature>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"ping\": \"pong\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Webhook received and verified",
"data": {
"event": "order.settled",
"request_id": "e1a9..."
}
}Webhooks
Test webhook signature verification
Verifies a signed webhook request using the provider-shared secret.
Steps:
- Read raw body
- Parse
X-Webhook-Signature: t=<unix_ts>,v1=<base64sig> - Enforce ±5 minute tolerance
- Recompute base64(HMAC_SHA256(secret,
${ts}.${raw_body})) and compare - If valid, return 200 with echo metadata
POST
/
webhooks
/
test
Test webhook signature verification
curl --request POST \
--url https://sandbox.elementpay.net/webhooks/test \
--header 'Content-Type: application/json' \
--header 'X-Webhook-Signature: <x-webhook-signature>' \
--data '{
"ping": "pong"
}'import requests
url = "https://sandbox.elementpay.net/webhooks/test"
payload = { "ping": "pong" }
headers = {
"X-Webhook-Signature": "<x-webhook-signature>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Webhook-Signature': '<x-webhook-signature>',
'Content-Type': 'application/json'
},
body: JSON.stringify({ping: 'pong'})
};
fetch('https://sandbox.elementpay.net/webhooks/test', 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://sandbox.elementpay.net/webhooks/test",
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([
'ping' => 'pong'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Webhook-Signature: <x-webhook-signature>"
],
]);
$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://sandbox.elementpay.net/webhooks/test"
payload := strings.NewReader("{\n \"ping\": \"pong\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Webhook-Signature", "<x-webhook-signature>")
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://sandbox.elementpay.net/webhooks/test")
.header("X-Webhook-Signature", "<x-webhook-signature>")
.header("Content-Type", "application/json")
.body("{\n \"ping\": \"pong\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.elementpay.net/webhooks/test")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Webhook-Signature"] = '<x-webhook-signature>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"ping\": \"pong\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Webhook received and verified",
"data": {
"event": "order.settled",
"request_id": "e1a9..."
}
}How to test (recommended, no secrets in the docs UI)
- Set
WEBHOOK_SECRETin your server env. - Use one of the client snippets below to sign and POST a JSON payload to your webhook endpoint (or to this
/webhooks/testroute) withX-Webhook-Signature: t=<ts>,v1=<base64sig>. - Expect
200withWebhook received and verified.
The signature is computed asTry It: Avoid entering secrets in the public Try It UI; run the snippet locally instead.base64(HMAC_SHA256(secret,ts.))with a ±5 minute tolerance.
Headers
Signature header in the format t=<unix_ts>,v1=<base64sig>.
Event type (e.g., order.settled).
Unique request id for idempotency/debugging.
Body
application/json
The body is of type object.

