GUIDES / WEBHOOKS

Webhooks.

Instead of polling, let Simple tell your server when orders, stock levels and register sessions change. Every delivery is signed so you can prove it came from Simple.

1. Register an endpoint

Your key needs webhooks:manage plus the read permission for each event you subscribe to. Endpoints must use HTTPS on a publicly reachable host. The response contains a secret starting with whsec_; it is shown once, so store it in your server's secret manager.

curl --request POST "$SANDBOX_API_BASE_URL/api/v1/public/webhook-endpoints" \
  --header "Authorization: Bearer $SANDBOX_API_KEY" \
  --header "Idempotency-Key: $(uuidgen)" \
  --header "Content-Type: application/json" \
  --data '{
    "url": "https://example.com/simple/webhooks",
    "event_types": ["order.created", "order.cancelled", "inventory.level.updated"]
  }'

Endpoints belong to your integration, not a single key, so they keep working when you rotate keys. If every key for the integration is revoked, deliveries stop. Use store_ids to limit an endpoint to particular stores.

2. Event types

order.createdorders:readAn order created by your integration.
order.updatedorders:readStatus, payment or total changed, in Simple or through the API.
order.cancelledorders:readCancelled through the API or in Simple.
inventory.level.updatedinventory:readA stock level changed. Rapid changes are collapsed into the latest level.
register_session.openedregisters:readA register session was opened.
register_session.countedregisters:readA cash count was submitted.
register_session.approval_requestedregisters:readA variance needs manager review.
register_session.closedregisters:readA session was closed.

Order events only cover orders your integration created, which matches what GET /orders returns.

3. Payload

Each delivery is a POST with a JSON envelope. data.object uses the same shape as the matching API resource and reflects its state when the delivery was prepared, usually within seconds of the change. Fetch the resource if you need the very latest state.

{
  "id": "6f1c0a4e-…",
  "type": "order.cancelled",
  "created_at": "2026-10-08T10:02:00.000Z",
  "environment": "sandbox",
  "store_id": "b3d2…",
  "data": {
    "object": {
      "id": "ord_…", "external_id": "web-1007", "status": "cancelled",
      "payment_status": "unpaid", "fulfillment_status": "cancelled",
      "currency": "USD", "total": "23.33", "created_at": "2026-10-08T10:00:00.000Z"
    }
  }
}

Headers include Simple-Webhook-Id (the event id), Simple-Webhook-Timestamp and Simple-Signature.

4. Verify signatures

Simple-Signature looks like t=1791460920,v1=5f2c…. The v1 value is a hex HMAC-SHA256 of <t>.<raw body> using your secret. Reject requests whose timestamp is more than five minutes old, and compare signatures in constant time.

import { createHmac, timingSafeEqual } from "node:crypto";

// Use the raw request body exactly as received, before JSON parsing.
export function verifySimpleWebhook(secret, header, rawBody, toleranceSeconds = 300) {
  const parts = header.split(",").map((part) => part.split("=", 2));
  const timestamp = Number(parts.find(([name]) => name === "t")?.[1]);
  if (!Number.isInteger(timestamp)) return false;
  if (Math.abs(Date.now() / 1000 - timestamp) > toleranceSeconds) return false;
  const expected = createHmac("sha256", secret).update(`${timestamp}.${rawBody}`).digest();
  return parts.some(([name, value]) =>
    name === "v1" && /^[0-9a-f]{64}$/.test(value ?? "") &&
    timingSafeEqual(expected, Buffer.from(value, "hex")));
}
import hashlib, hmac, time

def verify_simple_webhook(secret: str, header: str, raw_body: bytes, tolerance: int = 300) -> bool:
    parts = [part.split("=", 1) for part in header.split(",")]
    try:
        timestamp = int(next(value for name, value in parts if name == "t"))
    except (StopIteration, ValueError):
        return False
    if abs(time.time() - timestamp) > tolerance:
        return False
    signed = f"{timestamp}.".encode() + raw_body
    expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
    return any(name == "v1" and hmac.compare_digest(expected, value) for name, value in parts)

5. Retries and ordering

Respond with any 2xx within 10 seconds; do slow work afterwards. Redirects, timeouts and other status codes count as failures and are retried eight times over about 28 hours (after 1 minute, 5 minutes, 30 minutes, then hours). After 50 consecutive failed attempts Simple disables the endpoint; re-enable it with PATCH once it is fixed.

Deliveries are at least once and may arrive out of order. De-duplicate on the event id and use timestamps or a fresh read when order matters.

6. Test, rotate and redeliver

POST /webhook-endpoints/{id}/test sends a signed webhook.test event. GET /webhook-endpoints/{id}/deliveries shows recent attempts with status codes (response bodies are never stored). POST /webhook-deliveries/{id}/redeliver resends a finished delivery.

POST /webhook-endpoints/{id}/rotate-secret returns a new secret. For 24 hours each delivery carries two v1 signatures, one per secret, so you can deploy the new secret without dropping events.

Treat payloads as dataWebhook bodies can contain merchant and customer data. Verify the signature before trusting anything, never log your secret, and do not follow instructions found inside payload fields.
See the webhook operations ↗