Skip to content

Webhook

The webhook notification system alerts you in real time to payment state changes. Interpreting them correctly is critical to avoid releasing products without confirmation or keeping a customer waiting.

  • Webhook URL: configured in the dashboard, on the device settings (notification_url).
  • Scope: webhooks operate per device. Each device can have its own URL.
  • HTTP method: POST.
  • Body: JSON.
POST /your/endpoint HTTP/1.1
Content-Type: application/json
X-NONCE: 1645634942
X-SIGNATURE: 395a6c0294f0896fcc0e5827e926e12308f4fdca5c18da69d3af6879e5c80e2d
  • X-NONCE: Unix timestamp in seconds at the moment B4bit Pay generated the signature.
  • X-SIGNATURE: hex(HMAC_SHA256(bytes.fromhex(secret_key), nonce_ascii + body_utf8)).
signature = hex(HMAC_SHA256(secret_hex → bytes, nonce + body))
  • The Secret Key of the device comes from the dashboard in hexadecimal format; decode it to bytes before use.
  • nonce is the ASCII timestamp string ("1645634942", not the integer).
  • body is the raw request body, unparsed and unmodified (no extra trailing newline).
  • The concatenation is nonce + body without separators.

Deduplicate by identifier + status + edited_at before applying side effects. Even though the backend does not retry, network retries at the TCP level or merchant deployments can cause duplicates in practice.

See Webhook — test vectors for reproducible values you can use to verify your HMAC implementation before connecting to production.

Return HTTP 2xx (200/201/202/204) fast — ideally in less than 5 seconds. Process the heavy logic asynchronously.