TTocler Docs
Dashboard
Developers›Start here

Webhooks and signatures

How every message from Tocler is signed and how to check it in Node.js, Python and PHP.

Updated 2 November 2026Live from Tocler

Tocler signs every message with HMAC-SHA256 over <timestamp>.<raw body>, using a secret only you and Tocler know. Check it before doing anything else.

API deliveryTocler Pay webhooks
Signature headerx-tocler-signature: v1=<hex>Tocler-Pay-Signature: t=<seconds>,v1=<hex>
Timestampx-tocler-timestamp: <unix seconds>t= inside the signature header
Message idx-tocler-delivery (and body id)Tocler-Pay-Event-Id (and body id)
Eventx-tocler-event: order.paid or testTocler-Pay-Event-Type
Secretwhsec_… shown once when you add the endpointshown once when the webhook is set
Check an API delivery signature
const crypto = require('crypto');

// rawBody = the request body exactly as received (a string / Buffer), NOT re-serialised JSON.
function verifyTocler(rawBody, headers, secret) {
  const ts = headers['x-tocler-timestamp'];
  const sig = String(headers['x-tocler-signature'] || '');
  if (!ts || Math.abs(Date.now() / 1000 - Number(ts)) > 300) throw new Error('too old');
  const expected = 'v1=' + crypto.createHmac('sha256', secret).update(`${ts}.${rawBody}`).digest('hex');
  const a = Buffer.from(expected);
  const b = Buffer.from(sig);
  if (a.length !== b.length || !crypto.timingSafeEqual(a, b)) throw new Error('bad signature');
  return JSON.parse(rawBody);
}

Secrets

A secret is shown once. If one may have leaked, make a new one: for API delivery press New secret on the endpoint (the old one stops at once).

Answer fast, safely twice

Answer within 10 seconds. If Tocler gets no 2xx answer it tries again later with the same id — so keep the ids you handled and don’t deliver twice.

Was this page helpful?