Webhook Security & Delivery

Webhook Delivery Format

Bitnob webhooks are delivered as HTTP POST requests to the URL you provide in your dashboard or API call.

HeaderValue
Content-Typeapplication/json
X-Bitnob-SignatureHMAC-SHA256 hash used to verify the webhook
X-Bitnob-TimestampUNIX timestamp when the webhook was generated
X-Bitnob-EventEvent name (e.g. virtualcard.transaction.debit)

The body of the request contains the full JSON payload of the event.

Why Signature Verification Matters

To protect against spoofed webhooks or malicious actors sending fake events, you should verify the X-Bitnob-Signature using your Bitnob webhook secret.

Signature Verification Process

Bitnob signs each webhook payload using HMAC SHA-256, with your webhook secret as the key. Here's how to verify the signature:

1.

Read the raw request body (as a string)

2.

Concatenate the X-Bitnob-Timestamp and the raw body, separated by a .

3.

Generate the HMAC SHA-256 digest using your webhook secret

4.

Compare the result to the value in the X-Bitnob-Signature header (constant-time)

Python Example: Verifying Bitnob Webhooks

Python Webhook Verification

Note: You must read the raw body, not request.json, to ensure the hash matches exactly.

Security Tips

TipDescription
Use HTTPSNever accept webhooks over HTTP. Always use TLS.
Keep your secret secureDo not hard-code secrets in frontend code or public repos.
Log all incoming eventsHelps with debugging, dispute resolution, or replay.
Validate timestampsOptionally reject events older than 5 minutes to prevent replay attacks.
Respond quicklyAlways return HTTP 200 as soon as your app accepts the event.

Retry Behavior

BehaviorDescription
RetriesUp to 5 attempts with exponential backoff (e.g. 1s, 2s, 4s...)
TimeoutIf your server does not respond within 10 seconds, retry is triggered
Duplicate EventsPossible — your webhook handlers must be idempotent
Failure LogsAvailable in your dashboard (coming soon)

Testing Webhooks

You can test your webhook endpoint in the following ways:

Use the Bitnob Sandbox environment to trigger real test events

Manually simulate webhook payloads using tools like curl or Postman

Replay real events from your dashboard (feature coming)

Example: curl test webhook

Curl Test Webhook
Did you find this page useful?