Skip to main content
Zerocash signs every webhook request. Verifying that signature is what stops an attacker from POSTing a fake “payment successful” event straight at your endpoint.
Your webhook URL is public. Without signature verification, anyone who finds it can tell your system that a transaction succeeded. Verify before you process — always.

Set up signatures

1

Generate a webhook secret

In your dashboard, go to Developers → API Keys and generate a webhook secret.
2

Store it securely

Put it in an environment variable or a secrets manager. Never commit it.
3

Read the header

Zerocash includes the signature in the X-Webhook-Signature header of every webhook request.

Verify the signature

On each incoming webhook:
  1. Read the signature from the X-Webhook-Signature header.
  2. Compare it against your stored webhook secret.
  3. Process the webhook only if they match.
Use a constant-time comparison (timingSafeEqual, hmac.compare_digest, hash_equals) rather than ==. A naive comparison returns faster the earlier it finds a mismatched byte, which leaks enough information to recover the secret one character at a time.

Security best practices

Always verify

Check the signature on every request, including ones you plan to ignore.

Keep the secret out of git

Environment variables or a secrets manager — never source control.

Rotate periodically

Regenerate the secret on a schedule, and immediately if you suspect exposure.

HTTPS only

Receive webhooks over TLS so payloads and headers cannot be read in transit.
Handle processing timeouts explicitly. If your handler cannot finish quickly, acknowledge with a 2xx and finish the work in the background — see Getting started.