Sifr Wahid Developers

Architecture (HLD)

Webhook delivery lifecycle

What happens to one event from the store to your receiver, and the tools to inspect, test and recover deliveries.

An event in the store, such as order.created Delivery (signature v2) X-Zo-Event X-Zo-Delivery X-Zo-Timestamp X-Zo-Signature signs "{timestamp}.{body}" Your receiver verifies, answers, then works Success any 2xx within 15 seconds no 2xx in time Retries tried 3 more times, 5 minutes apart; a retry keeps its X-Zo-Delivery 50 failures in a row, or 10 timeouts in a row Switched off the webhook stops and the owner is told Switch it back on PATCH /webhooks/{id} {"is_active": true} Tools (webhooks scopes) Delivery log GET .../deliveries the last 30 days Resend POST .../resend 202, status pending Test send POST .../test 5 s (1 to connect) New secret POST .../secret the old one stops at once
One event becomes one signed delivery. Without a 2xx within 15 seconds it is tried 3 more times, 5 minutes apart. After 50 failures in a row, or 10 timeouts in a row, the webhook switches itself off and the owner is told. The tools below the line inspect, resend, test and re-key.

Signing

  • Every delivery carries X-Zo-Event, X-Zo-Delivery (the same id on a retry), X-Zo-Security-Strategy and User-Agent: ZoSa-Webhooks/1.0, and the body {event, merchant, created_at, data}.
  • With the signature strategy it also carries X-Zo-Signature, and with signature version 2 X-Zo-Timestamp too. With token it carries Authorization: Bearer <secret> instead. Make the webhook through the API to use version 2.
  • Version 2 (signature_version: 2, recommended): X-Zo-Signature is the hex HMAC-SHA256 of "{timestamp}.{body}" with the secret, where body is the request body exactly as it arrived. Refuse a timestamp more than 300 seconds away.
  • Version 1: X-Zo-Signature is the hex HMAC-SHA256 of the raw body with the secret, and there is no X-Zo-Timestamp.
  • The secret is shown once, in the create answer (secret).

The verifiers in PHP, Node and Python: Verifying the signature.

The answer and the retries

  • Answer any 2xx within 15 seconds. Otherwise the delivery is tried 3 more times, 5 minutes apart.
  • A retry carries the same X-Zo-Delivery: use it to drop duplicates.
  • After 50 failures in a row, or 10 timeouts in a row, the webhook switches itself off and the owner is told. Switch it back on with PATCH /webhooks/{id} and {"is_active": true} once the receiver is fixed; switching a webhook back on clears its failure count.

The log and the tools

ToolCallWhat it does
Delivery logGET /webhooks/{id}/deliveriesThe last 30 days, ordered by created_at; filter[status] pending, success or failed.
One deliveryGET /webhooks/{id}/deliveries/{delivery}The body sent and the answer.
ResendPOST /webhooks/{id}/deliveries/{delivery}/resendThe same data as a new delivery (a new X-Zo-Delivery): 202 with status pending; read the outcome with the call above.
Test sendPOST /webhooks/{id}/testSends a sample now and answers its result; your receiver has 5 seconds (1 to connect). It never counts as a failure.
New secretPOST /webhooks/{id}/secretA new secret, shown once; the old one stops at once.

Ownership and plan

  • A key sees and manages only the webhooks it made; others answer 404. Revoking the key stops them.
  • A store has 10 webhooks (Pro), shared by the dashboard and every key.
  • Subscribing to an event needs the read scope of the event's resource, and scopes are checked again at every send.
  • A store without the webhooks feature has none (402 feature_locked), so it polls with updated_since.