Webhooks
The events, the HMAC signature, the retry schedule, and what a receiver has to tolerate.
import { verifyWebhook, WebhookSignatureError } from "@intents-fi/sdk";
export async function POST(request: Request) { let event; try { // The raw body: request.text(), never a parsed and re-serialised object. event = await verifyWebhook(await request.text(), request.headers, process.env.INTENTS_WEBHOOK_SECRET); } catch (e) { if (e instanceof WebhookSignatureError) return new Response("bad signature", { status: 400 }); throw e; } if (event.type === "invoice.paid") await markPaid(event.data.reference); // safe to run twice return new Response("ok");}Ship the order only on invoice.paid. The browser’s onPaid / paid event is for the page.
Server helpers has verifyWebhook for Express and Hono, and intents-php for PHP. Verify and test webhooks is the step-by-step guide to a receiver that survives duplicates and disorder.
Verify against the raw request body, byte for byte. Parse the JSON after, never before: a re-serialised body has a different signature.
Register an endpoint
Section titled “Register an endpoint”curl https://api.intents.fi/v0/webhooks \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY' \ -H 'content-type: application/json' \ -d '{ "url": "https://northwood.example/hooks/intents" }'const response = await fetch("https://api.intents.fi/v0/webhooks", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ "url": "https://northwood.example/hooks/intents" }),});
if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`);}const data = await response.json();import osimport httpx
response = httpx.post( "https://api.intents.fi/v0/webhooks", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"}, json={ "url": "https://northwood.example/hooks/intents" },)response.raise_for_status()data = response.json()The secret comes back only here. Endpoints are per mode: a ik_test_ key registers a test
endpoint, and it never sees live events.
GET /v0/webhooks
Section titled “GET /v0/webhooks”GET /v0/webhooks
curl https://api.intents.fi/v0/webhooks \ -H 'authorization: Bearer $INTENTS_SECRET_KEY'const response = await fetch("https://api.intents.fi/v0/webhooks", { method: "GET", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, },});
if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`);}const data = await response.json();import osimport httpx
response = httpx.get( "https://api.intents.fi/v0/webhooks", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},)response.raise_for_status()data = response.json()| Status | Means |
|---|---|
200 |
Active webhooks |
DELETE /v0/webhooks/{id}
Section titled “DELETE /v0/webhooks/{id}”DELETE /v0/webhooks/{id}
| Parameter | In | Required | Notes |
|---|---|---|---|
id |
path | yes |
curl https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw \ -X DELETE \ -H 'authorization: Bearer $INTENTS_SECRET_KEY'const response = await fetch("https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw", { method: "DELETE", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, },});
if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`);}const data = await response.json();import osimport httpx
response = httpx.delete( "https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},)response.raise_for_status()data = response.json()| Status | Means |
|---|---|
200 |
Deleted |
From the dashboard
Section titled “From the dashboard”Webhooks in the dashboard adds and deletes endpoints for the mode you’re viewing, without a
key. It can also rotate the secret, send a test event, show each delivery in full, and
resend one. A new or rotated whsec_ secret is shown once. A rotated secret takes effect at
once, so the old one stops verifying, retries included.
Test your receiver
Section titled “Test your receiver”Send a test event
Section titled “Send a test event”Pick an event type and we deliver it now, signed with the endpoint’s real secret, outside the retry queue. The result shows the body we sent and what your endpoint answered.
- Test-mode endpoints get a sample invoice in the state the event describes:
invoice.paidcarries a paid invoice,invoice.underpaidone withamountRemaining, and so on. It is shaped exactly like a real delivery, but it is made up: the envelope hassample: true, the event id startsevt_test_, the invoice idinv_test_(whichGET /v0/invoices/{id}does not know), andreferenceissample_…, so it cannot match one of your orders. - Live-mode endpoints only ever get the
webhook.testping, which carries no invoice. A live receiver is never handed something shaped like a paid invoice that was not paid. Asking for a sample on a live endpoint is refused withTEST_MODE_ONLY.
From code, with a test key, for an endpoint that key registered:
curl https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw/test \ -X POST \ -H 'authorization: Bearer $INTENTS_SECRET_KEY'const response = await fetch("https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw/test", { method: "POST", headers: { authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`, },});
if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`);}const data = await response.json();import osimport httpx
response = httpx.post( "https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw/test", headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},)response.raise_for_status()data = response.json()type defaults to invoice.paid; webhook.test sends the ping. The response says whether your
endpoint answered 2xx, and carries requestBody and responseBody (the first 2 KB). A test event
doesn’t count towards an endpoint’s failures and isn’t retried.
{ "id": "evt_test_9f2c41d07ab3e815", "type": "invoice.paid", "createdAt": "2026-11-25T09:30:00.000Z", "sample": true, "data": { "id": "inv_test_4b7e1a90c3d25f68", "status": "paid", "mode": "test", "reference": "sample_0d93c7e2a41b8f56", "…": "…" }}Acknowledge it with a 2xx and do not fulfil anything: isTestEvent(event) in
the SDK is true for both kinds. The ping looks like this:
{ "id": "evt_test_1c8a5e2d07f94b36", "type": "webhook.test", "createdAt": "2026-11-17T09:30:00.000Z", "data": { "endpointId": "wh_2KpR8wNdL5qTbXvZ", "mode": "live", "message": "A test event from intents.fi. Nothing was paid." }}A receiver that switches on type should ignore types it doesn’t know, since webhook.test is one
of them.
Delivery detail and Resend
Section titled “Delivery detail and Resend”Each row in the delivery log opens to the request body exactly as we signed and sent it, the response status and body (truncated to 2 KB), how long it took and when, for its latest attempt.
Resend delivers the same event to the same endpoint again, now. It carries the same event
id, so it is exactly what a duplicate looks like: use it to check your receiver is safe to
receive an event twice. data is the invoice as it is at the moment of sending, like every retry.
A resend that fails is retried on the normal schedule below.
The signature
Section titled “The signature”Every delivery carries:
X-Intents-Signature: t=1794666272,v1=4f1c…9ab2t— when we signed, in Unix secondsv1—HMAC-SHA256(secret, "<t>.<raw body>"), hex
Reject anything more than five minutes old, and compare in constant time. v1 is a version: a new
scheme would arrive as v2 alongside it, so match on the prefix rather than taking the first
value.
The events
Section titled “The events”| Event | When it fires |
|---|---|
invoice.processing |
the first deposit has been seen |
invoice.underpaid |
part of the money arrived; the payload carries amountRemaining |
invoice.paid |
the settlement transaction confirmed. Only this means paid |
invoice.expired |
the invoice expired with nothing completed |
invoice.canceled |
you cancelled it |
invoice.needs_review |
a human should look: a late payment, a payment to a superseded address, or a status we could not map |
order.updated |
an Intents Route order changed status. Intents Checkout merchants never get this for a payment attempt’s order |
The body is always the same shape:
{ "id": "evt_6LqB9vZtHd3nMwCx", "type": "invoice.paid", "createdAt": "2026-11-14T10:03:12.000Z", "late": false, "data": { "id": "inv_3QkR7mVt9zLpXdB2hJn6Yw", "status": "paid", "…": "…" }}data is byte-for-byte what GET /v0/invoices/{id} returns, so one parser covers every invoice
event and the polling path. late only appears on invoice.paid, and only when the payment
settled after expiry.
“Detected” is not an event
Section titled ““Detected” is not an event”A deposit that has been seen but not settled is invoice.processing, and it is not a reason to
fulfil an order. Nothing but invoice.paid means the money is yours.
Retries
Section titled “Retries”A delivery is a success on any 2xx. Anything else — a 4xx, a 5xx, a timeout at five seconds, a TLS failure — is retried, up to 8 attempts over about 23 hours:
| Attempt | After |
|---|---|
| 2 | 1 minute |
| 3 | 5 minutes |
| 4 | 30 minutes |
| 5 | 1 hour |
| 6 | 3 hours |
| 7 | 6 hours |
| 8 | 12 hours |
After five consecutive failures we email you, and again daily while it keeps failing. The delivery log shows every attempt with its response status and error.
What a receiver has to tolerate
Section titled “What a receiver has to tolerate”- Duplicates. The same event can arrive more than once: a retry after a timeout, or a
Resend from the dashboard, which re-sends the same
event.idon purpose. Key onevent.id, or make the work idempotent. - Out-of-order delivery.
invoice.paidcan land beforeinvoice.processing. Usedata.status, and ignore an event that would move an order backwards. - Unknown event types. Return 2xx for a type you do not handle, or you will be retried for a day over an event you did not want.
Answer in under five seconds — queue the work and return 204 — or the delivery times out and you
get a duplicate.
URL rules
Section titled “URL rules”httpsonly, with no credentials in the URL.- A public host. Private, loopback, link-local and CGNAT addresses are refused at registration and checked again before every delivery, so a redirect cannot be used to reach inside our network.
- Local development: use a tunnel (
cloudflared tunnel,ngrok) and register the tunnel’s URL.
Instead of webhooks
Section titled “Instead of webhooks”Poll GET /v0/invoices/{id}. Every status change is reflected there, so polling and webhooks give
you the same information; webhooks just save you the requests. Poll no faster than every two
seconds while a customer is watching, and back off to ten seconds after five minutes.