Skip to main content

Webhook

Always validate webhooks first

Always verify that a webhook came from NombaSub before you process it, update a customer record, mark an invoice as paid, or grant value to a user. Your webhook endpoint is a public URL, so anyone can try to send HTTP requests to it. NombaSub signs each merchant webhook delivery with the webhook secret configured for your tenant. Validate the signature before trusting the event.
Reject webhook requests that are missing required signature headers or whose signature does not match the value you compute on your server.

Webhook headers

Every webhook delivery includes headers that identify the event, delivery, tenant, and delivery time. Header names are case insensitive, so normalize header names in your framework before reading them.

How signature verification works

NombaSub creates the signature from this exact string:
For example:
Then NombaSub signs that string using HMAC-SHA256 with your webhook secret and base64-encodes the result. To verify a webhook:
  1. Read x-nombasub-event, x-nombasub-webhook-id, x-nombasub-tenant-id, x-nombasub-timestamp, and x-nombasub-signature from the request headers.
  2. Build the signature payload as eventType:webhookId:tenantId:timestamp.
  3. Generate a base64 HMAC-SHA256 signature using your webhook secret.
  4. Compare your generated signature with x-nombasub-signature using a timing-safe comparison.
  5. Process the webhook only when the signatures match.
The signature is based on the webhook headers above, not on the raw JSON request body.

Signature verification examples

Webhook payload

Webhook payloads use a common envelope:

Processing checklist

  • Validate the signature before processing the event.
  • Return a 2xx response quickly after accepting the webhook.
  • Use x-nombasub-webhook-id or payload id to make processing idempotent.
  • Process business logic asynchronously where possible.
  • Do not grant value, mark an invoice as paid, or change subscription state when signature validation fails.