> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sleetpay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhooks

> Signed deliveries, retries, replay and the full event catalog.

SleetPay sends an HTTP `POST` to your endpoint whenever something happens. Add endpoints in **Dashboard > Webhooks**, choose the events each one receives, and copy its signing secret.

## The envelope

```json theme={null}
{
  "id": "evt_3f9c1d0a4b5e6f708a9b",
  "type": "order.created",
  "created_at": "2026-02-06T12:00:00.000Z",
  "data": { "...the complete entity..." }
}
```

`data` is the full entity, not a diff, so you rarely need a follow-up fetch.

### Headers

| Header | Value |
| - | - |
| `webhook-id` | The event id. Identical across retries and replays: **de-duplicate on it**. |
| `webhook-timestamp` | Unix seconds when this attempt was sent |
| `webhook-signature` | `v1,<base64>`: HMAC-SHA256 of `{webhook-id}.{webhook-timestamp}.{raw body}` |
| `X-Webhook-Event` | The event `type` |
| `X-Webhook-Signature` | Legacy hex HMAC of the body only. It has no timestamp so it is replayable. New code should use `webhook-signature`. |

## Verify every delivery

The scheme is [Standard Webhooks](https://www.standardwebhooks.com), so any Standard Webhooks library works. The SDKs do it for you. Always verify the **raw body** before parsing, and reject timestamps more than 5 minutes from your clock.

```ts TypeScript theme={null}
import { constructEvent } from "@sleetpay/sdk";

const event = await constructEvent(secret, rawBody, req.headers); // throws WebhookVerificationError
```

```python Python theme={null}
from sleetpay import construct_event

event = construct_event(secret, raw_body, request.headers)  # raises WebhookVerificationError
```

```ts Manual theme={null}
import crypto from "crypto";

function verify(rawBody: string, h: { id: string; timestamp: string; signature: string }, secret: string) {
  const ts = Number(h.timestamp);
  if (!Number.isFinite(ts) || Math.abs(Date.now() / 1000 - ts) > 300) return false;
  const expected = "v1," + crypto.createHmac("sha256", secret).update(`${h.id}.${ts}.${rawBody}`).digest("base64");
  return h.signature.split(" ").some((s) => {
    const a = Buffer.from(s), b = Buffer.from(expected);
    return a.length === b.length && crypto.timingSafeEqual(a, b);
  });
}
```

The HMAC key is the secret exactly as shown, including any prefix. The signature header can carry several space-separated signatures during secret rotation; accept if any matches.

> [!WARNING]
>
> **Use the raw body**
>
> Frameworks that parse JSON before your handler can change whitespace and key order and break the signature. Read the body as text (`await req.text()`, `request.body`, `express.raw`).

## Retries and replay

Answer with a `2xx` within 8 seconds. Otherwise SleetPay retries after 15 seconds, 60 seconds and 5 minutes, then marks the delivery `failed`. Every attempt is visible in **Webhooks > Deliveries** with its status and payload.

To resend a past delivery, open it and press **Replay**. The replay uses the same payload and the same `webhook-id` with a fresh timestamp, so a receiver that de-duplicates treats it as the redelivery it is.

## Handler checklist

1. Verify the signature on the raw body.
2. Return `200` quickly; do slow work in a queue.
3. De-duplicate on `webhook-id` (store processed ids).
4. Make handlers idempotent: events can arrive out of order, so read the current state when it matters.

## Events

| Group | Events |
| - | - |
| Checkout | `checkout.created`, `checkout.updated`, `checkout.succeeded`, `checkout.expired` |
| Order | `order.created`, `order.paid`, `order.updated`, `order.refunded` |
| Subscription | `subscription.created`, `.active`, `.cycled`, `.past_due`, `.paused`, `.resumed`, `.canceled`, `.uncanceled`, `.revoked`, `.updated` |
| Customer | `customer.created`, `.updated`, `.deleted`, `customer.state_changed` |
| Seats | `customer_seat.assigned`, `customer_seat.revoked` |
| Benefits | `benefit.created`, `benefit.updated`, `benefit_grant.created`, `.cycled`, `.updated`, `.revoked` |
| Products | `product.created`, `product.updated` |
| Refunds | `refund.created`, `refund.updated` |
| Discounts | `discount.created`, `.updated`, `.deleted` |
| Members | `member.created`, `.updated`, `.deleted` |
| Organization | `organization.updated` |
| Reminders | `reminder.abandoned_checkout`, `.payment_failed`, `.renewal_notice`, `.trial_ending` |
| Affiliates | `affiliate_commission.created`, `.updated`, `.paid`, `.voided`, `affiliate_payout.paid`, `.failed` |

Payloads use snake\_case JSON and mirror Polar's shapes, so integrations written against Polar's webhook events generally work unchanged.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.