Payment provider webhook (Standard Webhooks)
Public by necessity: the payment provider holds no session and cannot present a JWT, so this route cannot sit behind the edge’s identity middleware. Authenticity comes from the HMAC-SHA256 signature instead. Unsigned or mis-signed deliveries are refused before anything is read, the body is verified as the exact bytes received, and every delivery is deduped by webhook-id before any side effect. NOT enveloped, because the provider reads the status line.
POST
/
api
/
billing
/
webhook
Payment provider webhook (Standard Webhooks)
curl --request POST \
--url https://api.truscan.co/api/billing/webhook \
--header 'Content-Type: application/json' \
--header 'webhook-id: <webhook-id>' \
--header 'webhook-signature: <webhook-signature>' \
--header 'webhook-timestamp: <webhook-timestamp>' \
--data '
{
"business_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"data": {}
}
'import requests
url = "https://api.truscan.co/api/billing/webhook"
payload = {
"business_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"data": {}
}
headers = {
"webhook-id": "<webhook-id>",
"webhook-timestamp": "<webhook-timestamp>",
"webhook-signature": "<webhook-signature>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'webhook-id': '<webhook-id>',
'webhook-timestamp': '<webhook-timestamp>',
'webhook-signature': '<webhook-signature>',
'Content-Type': 'application/json'
},
body: JSON.stringify({business_id: '<string>', timestamp: '2023-11-07T05:31:56Z', data: {}})
};
fetch('https://api.truscan.co/api/billing/webhook', 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.truscan.co/api/billing/webhook",
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([
'business_id' => '<string>',
'timestamp' => '2023-11-07T05:31:56Z',
'data' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"webhook-id: <webhook-id>",
"webhook-signature: <webhook-signature>",
"webhook-timestamp: <webhook-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.truscan.co/api/billing/webhook"
payload := strings.NewReader("{\n \"business_id\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"data\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("webhook-id", "<webhook-id>")
req.Header.Add("webhook-timestamp", "<webhook-timestamp>")
req.Header.Add("webhook-signature", "<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://api.truscan.co/api/billing/webhook")
.header("webhook-id", "<webhook-id>")
.header("webhook-timestamp", "<webhook-timestamp>")
.header("webhook-signature", "<webhook-signature>")
.header("Content-Type", "application/json")
.body("{\n \"business_id\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"data\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.truscan.co/api/billing/webhook")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["webhook-id"] = '<webhook-id>'
request["webhook-timestamp"] = '<webhook-timestamp>'
request["webhook-signature"] = '<webhook-signature>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"business_id\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"data\": {}\n}"
response = http.request(request)
puts response.read_bodyBody
application/json
Response
Accepted, or a replay that was already applied
⌘I
Payment provider webhook (Standard Webhooks)
curl --request POST \
--url https://api.truscan.co/api/billing/webhook \
--header 'Content-Type: application/json' \
--header 'webhook-id: <webhook-id>' \
--header 'webhook-signature: <webhook-signature>' \
--header 'webhook-timestamp: <webhook-timestamp>' \
--data '
{
"business_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"data": {}
}
'import requests
url = "https://api.truscan.co/api/billing/webhook"
payload = {
"business_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"data": {}
}
headers = {
"webhook-id": "<webhook-id>",
"webhook-timestamp": "<webhook-timestamp>",
"webhook-signature": "<webhook-signature>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'webhook-id': '<webhook-id>',
'webhook-timestamp': '<webhook-timestamp>',
'webhook-signature': '<webhook-signature>',
'Content-Type': 'application/json'
},
body: JSON.stringify({business_id: '<string>', timestamp: '2023-11-07T05:31:56Z', data: {}})
};
fetch('https://api.truscan.co/api/billing/webhook', 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.truscan.co/api/billing/webhook",
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([
'business_id' => '<string>',
'timestamp' => '2023-11-07T05:31:56Z',
'data' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"webhook-id: <webhook-id>",
"webhook-signature: <webhook-signature>",
"webhook-timestamp: <webhook-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.truscan.co/api/billing/webhook"
payload := strings.NewReader("{\n \"business_id\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"data\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("webhook-id", "<webhook-id>")
req.Header.Add("webhook-timestamp", "<webhook-timestamp>")
req.Header.Add("webhook-signature", "<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://api.truscan.co/api/billing/webhook")
.header("webhook-id", "<webhook-id>")
.header("webhook-timestamp", "<webhook-timestamp>")
.header("webhook-signature", "<webhook-signature>")
.header("Content-Type", "application/json")
.body("{\n \"business_id\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"data\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.truscan.co/api/billing/webhook")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["webhook-id"] = '<webhook-id>'
request["webhook-timestamp"] = '<webhook-timestamp>'
request["webhook-signature"] = '<webhook-signature>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"business_id\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"data\": {}\n}"
response = http.request(request)
puts response.read_body