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

# Webhooks and verification

> Subscribe to events and authenticate incoming notifications.

## Register a receiver

An owner or admin registers an endpoint for the business when Recadd has enabled registration and the delivery worker has current proof of readiness. Store the signing secret when you register the endpoint. To rotate it, an owner or admin registers a new endpoint and disables the old one. Registration proof expiry has no effect on sending, stored events or replaying a registration receipt.

> [!NOTE]
>
> The Recadd business dashboard is not open yet. Recadd will tell you when you can create keys and register webhook endpoints.

Each endpoint belongs to one mode and subscribes to 1 to 10 types. A business can have up to 10 enabled endpoints per mode. A test endpoint receives test events for the types it subscribes to. Recadd does not send a ping.

Use an HTTPS URL on port 443 with a DNS hostname that resolves only to public addresses. Omit the query string. Recadd gives each attempt 10 seconds and does not follow redirects.

## Events

| Event | Live prefix | Test prefix |
| - | - | - |
| `fx.conversion.cancelled` | `fxc_` | `fxc_` |
| `fx.conversion.completed` | `fxc_` | `fxc_` |
| `fx.conversion.denied` | `fxc_` | `fxc_` |
| `order.awaiting_approval` | `ord_` | `ord_` |
| `order.cancelled` | `ord_` | `ord_` |
| `order.completed` | `ord_` | `ord_` |
| `order.failed` | `ord_` | `ord_` |
| `order.partially_completed` | `ord_` | `ord_` |
| `wallet.debited` | `ord_` | `ord_` |
| `wallet.funded` | `fnd_` | `stp_` |

An event contains `id`, `type`, `mode` and `data`, which contains `subject_id` and `status`. Fetch the order or conversion for details. A `wallet.funded` subject has no direct `/v1` resource. The wallet's transactions show the credit.

Events are delivered at least once, without an ordering guarantee. Deduplicate by `id`. Any `2xx` response acknowledges a delivery. Retries start at 30 seconds, double up to a one-hour interval, and stop at 24 hours per delivery generation.

`GET /v1/webhook-events/{id}` returns the exact stored body for any event type. Use an `orders:read` key from the same business and mode. The body is retained for 90 days from the latest terminal delivery work, or from creation if the event has no deliveries.

## Verify a request

Read `Recadd-Signature: t=<unix seconds>,v1=<hex>` and capture the exact raw request bytes before any JSON parsing. Decode the signing secret from unpadded base64url to 32 bytes. Use those bytes as the HMAC-SHA256 key. Sign the decimal timestamp from the header, an ASCII period, and the raw body. Compare the digests in constant time and accept a timestamp within five minutes of your clock.

The example below takes the raw body as a Node.js `Buffer`. For an independent test, sign the sample body with the example secret `AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA`, which is 32 zero bytes in base64url. In production, use the secret issued for the endpoint.

```json sample-body theme={null}
{"id":"evt_01kb7tvmhme008000000000003","type":"wallet.funded","mode":"test","data":{"subject_id":"stp_01kb7tvmhme008000000000004","status":"succeeded"}}
```

```js verify theme={null}
const { createHmac, timingSafeEqual } = require("node:crypto");

function verifySignature(secret, signatureHeader, rawBody) {
  if (typeof secret !== "string" || typeof signatureHeader !== "string" || !Buffer.isBuffer(rawBody)) {
    return false;
  }
  if (!/^[A-Za-z0-9_-]{43}$/.test(secret)) return false;
  const key = Buffer.from(secret, "base64url");
  if (key.length !== 32 || key.toString("base64url") !== secret) return false;

  const signature = /^t=([0-9]+),v1=([0-9a-f]{64})$/.exec(signatureHeader);
  if (!signature || signature[0] !== signatureHeader) return false;
  const [, timestamp, hex] = signature;
  const seconds = Number(timestamp);
  if (!Number.isSafeInteger(seconds) || Math.abs(Math.floor(Date.now() / 1000) - seconds) > 300) {
    return false;
  }

  const expected = createHmac("sha256", key)
    .update(timestamp + ".", "ascii")
    .update(rawBody)
    .digest();
  return timingSafeEqual(expected, Buffer.from(hex, "hex"));
}
```


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