Skip to main content
Your webhook URL is public, so anyone could send it a fake “payment successful” event. Check every request before you act on it. Every webhook from Tanda carries an X-Webhook-Signature header. It must match the webhook secret you generated in the dashboard.

Set up

  1. In the dashboard, go to Developers → API keys and generate a webhook secret.
  2. Store it as an environment variable, for example TANDA_WEBHOOK_SECRET. Keep it out of source control.
  3. In your handler, read X-Webhook-Signature and compare it with the secret using a constant-time comparison.
  4. If they don’t match, return 401 and do nothing else.
Use a constant-time comparison (timingSafeEqual, compare_digest, hash_equals) rather than ==. A normal string comparison can leak the secret through response timing.

Good practice

  • Verify every request, in sandbox too, so the code path is tested before you go live.
  • Accept webhooks over HTTPS only.
  • Rotate the secret periodically, and immediately if you think it has leaked.
  • Even with a valid signature, confirm high-value outcomes with Get transaction.