Webhooks
Spleetz tells your server when something happens to a payment by sending an HTTP POST to your
endpoint. Use webhooks, not the return address, to know a payment is paid.
Registering an endpoint
Section titled “Registering an endpoint”A business’s own endpoints
Section titled “A business’s own endpoints”In the dashboard, go to Settings > Webhooks and add an endpoint: its address, a description, and the events it listens for (all of them, or a list). A business can have up to 16.
- Live endpoints must use
https. Test endpoints, made in Test mode, may use plainhttp, for a laptop or a tunnel. - Each endpoint has its own signing secret (
whsec_...), shown once when it is made and when it is rolled. - An endpoint can be paused, which keeps its secret and events, and switched back on.
- Send test event sends
webhook.testto that endpoint alone, so you can check your server receives and verifies it.
A business’s endpoints hear about all of its payments in their mode, including those connected apps create.
A connected app’s endpoints
Section titled “A connected app’s endpoints”A connected app with the notifications.manage scope registers its own endpoints through the
API. They hear only about payments its connection created, and go when the connection is revoked.
A connection can have up to 5. The business sees them in its dashboard but can’t change them.
curl https://api.spleetz.com/webhook-endpoints \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "url": "https://app.example.com/spleetz/webhooks", "description": "Invoices", "allEvents": false, "events": ["payment.succeeded", "transaction.refunded", "recurring.cancelled"], "sources": ["invoices"] }'The answer, 201, carries the endpoint and its secret. Store the secret: it isn’t shown again.
GET /webhook-endpoints |
The connection’s endpoints. |
POST /webhook-endpoints |
Register one. sources limits it to some of the connection’s sources; leave it out for all. |
PATCH /webhook-endpoints/{id} |
Change any of url, description, allEvents, events, sources (an empty list means all) or isActive. |
POST /webhook-endpoints/{id}/roll-secret |
A new secret. The old one stops working at once. |
DELETE /webhook-endpoints/{id} |
Remove it. |
A secret key gets 403 on these: a business’s own endpoints are set in the dashboard.
What Spleetz sends
Section titled “What Spleetz sends”POST /spleetz/webhooks HTTP/1.1Content-Type: application/json; charset=utf-8X-Spleetz-Signature: t=1795526400,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bdX-Spleetz-Event: payment.succeededX-Spleetz-Delivery: 4b1d6c8e-7d1f-4d0c-9a7e-0f5e2a1c3b9d
{ "id": "4b1d6c8e-7d1f-4d0c-9a7e-0f5e2a1c3b9d", "type": "payment.succeeded", "timestamp": "2026-11-24T12:00:00.0000000+00:00", "data": { "transactionId": "...", "reference": "INV-2026-0193", "metadata": { "customerId": "C-2231" }, "source": null, "settledBy": "WebCard", "merchantId": "1093", "status": "Completed", "amountMinor": 4800, "currency": "GBP", "splits": [ { "cardId": "...", "amountMinor": 4800, "status": "Completed" } ], "processedAt": "2026-11-24T11:58:41+00:00", "refundAmountMinor": null, "totalRefundedMinor": null, "isFullRefund": null }}| Header | |
|---|---|
X-Spleetz-Signature |
The signature. See Verifying the signature. |
X-Spleetz-Event |
The event type, the same as type in the body. |
X-Spleetz-Delivery |
This delivery’s id, the same as id in the body. It stays the same when a delivery is retried. |
The body is always the envelope id, type, timestamp and data, with camelCase names.
Events
Section titled “Events”Payments
Section titled “Payments”data is a payment: transactionId, reference, metadata, source, settledBy (how the
money came in: WebCard, Terminal, Transfer, TapToPay and others), merchantId, status,
amountMinor, currency, splits (the cards paid with) and processedAt (when the payment was
created). A recurring bill’s period also carries recurring; see
Recurring bills.
| Event | When |
|---|---|
payment.authorized |
A card payment is authorised but not yet taken. |
payment.succeeded |
The payment is complete and the money taken. |
payment.failed |
The payment did not go through. |
payment.expired |
The payment ran out of time before it was paid. |
transaction.cancelled |
The payment was cancelled before it was paid. |
transaction.refunded |
All or part of the payment was refunded. Adds refundAmountMinor (this refund), totalRefundedMinor (all refunds so far) and isFullRefund. |
A split bill sends these once, for the bill, not for each share.
Splits
Section titled “Splits”data describes the bill being split. See Following a split.
| Event | When |
|---|---|
split.started |
A bill was split into shares, by a payer or for a group. |
split.member_joined |
Someone joined the group a bill is split between. |
split.share_claimed |
A payer took a share and is about to pay it. |
split.share_paid |
One share of a split bill was paid. |
split.resized |
The number of shares changed. |
split.deadline_extended |
A split bill was given longer to be paid. |
Recurring bills
Section titled “Recurring bills”data is the recurring bill. See Recurring events.
| Event | When |
|---|---|
recurring.activated |
The first period was paid. |
recurring.past_due |
A period’s charge failed and will be tried again. |
recurring.action_required |
A period can’t be charged without the payer. |
recurring.unpaid |
Retries ran out, or the payer didn’t act in time. |
recurring.cancelled |
Cancelled. Nothing more will be charged. |
recurring.ended |
It ran its course, or its first period was never paid. |
recurring.payer_past_due |
One payer’s charge failed and will be tried again. |
recurring.payer_action_required |
One payer can’t be charged without them. |
recurring.payer_unpaid |
One payer ran out of retries or time. |
recurring.payer_cancelled |
One payer stopped their own part. |
webhook.test is sent only when someone presses Send test event in the dashboard. You can’t
subscribe to it. Its data has endpointId, livemode and a message.
New event types can be added. Ignore any type you don’t know, and answer it with 200.
Verifying the signature
Section titled “Verifying the signature”Check every delivery before you trust it. The header looks like this:
X-Spleetz-Signature: t=1795526400,v1=5257a869e7ecebed...tis when the delivery was signed, in Unix seconds.v1is the HMAC-SHA256 of{t}.{body}, keyed with your endpoint’s whole secret (whsec_..., as UTF-8), written as lowercase hex.
To verify:
- Read the raw request body, exactly as received. Don’t parse and re-serialise it first: any change to spacing or order breaks the signature.
- Split the header on
,and taketandv1. - Compute HMAC-SHA256 of
t + "." + bodywith your secret. - Compare it with
v1in constant time. - Refuse it if
tis more than 5 minutes from your clock, so an old delivery can’t be replayed.
Each attempt is signed afresh when it is sent, so a retried delivery has a new t.
With Express:
import crypto from 'node:crypto';import express from 'express';
const secret = process.env.SPLEETZ_WEBHOOK_SECRET; // whsec_...const app = express();
app.post('/spleetz/webhooks', express.raw({ type: 'application/json' }), (req, res) => { const header = req.get('X-Spleetz-Signature') ?? ''; const parts = Object.fromEntries(header.split(',').map((p) => p.split('=', 2))); const timestamp = Number(parts.t); const body = req.body.toString('utf8');
const expected = crypto.createHmac('sha256', secret).update(`${parts.t}.${body}`).digest('hex'); const valid = typeof parts.v1 === 'string' && parts.v1.length === expected.length && crypto.timingSafeEqual(Buffer.from(parts.v1), Buffer.from(expected)); const fresh = Math.abs(Date.now() / 1000 - timestamp) <= 300;
if (!valid || !fresh) { return res.sendStatus(400); }
const event = JSON.parse(body); // Deliveries can repeat: skip an event.id you have already handled. handle(event).catch(console.error); res.sendStatus(200);});With ASP.NET Core:
using System.Security.Cryptography;using System.Text;
app.MapPost("/spleetz/webhooks", async (HttpRequest request) =>{ var secret = builder.Configuration["Spleetz:WebhookSecret"]!; // whsec_... using var reader = new StreamReader(request.Body, Encoding.UTF8); var body = await reader.ReadToEndAsync();
var parts = request.Headers["X-Spleetz-Signature"].ToString() .Split(',', StringSplitOptions.RemoveEmptyEntries) .Select(p => p.Split('=', 2)) .Where(p => p.Length == 2) .ToDictionary(p => p[0], p => p[1]);
if (!parts.TryGetValue("t", out var t) || !parts.TryGetValue("v1", out var v1) || !long.TryParse(t, out var timestamp) || Math.Abs(DateTimeOffset.UtcNow.ToUnixTimeSeconds() - timestamp) > 300) { return Results.BadRequest(); }
var hash = HMACSHA256.HashData(Encoding.UTF8.GetBytes(secret), Encoding.UTF8.GetBytes($"{t}.{body}")); var expected = Convert.ToHexString(hash).ToLowerInvariant();
if (!CryptographicOperations.FixedTimeEquals(Encoding.ASCII.GetBytes(expected), Encoding.ASCII.GetBytes(v1))) { return Results.BadRequest(); }
// Deliveries can repeat: skip an event id you have already handled. return Results.Ok();});Answering, retries and duplicates
Section titled “Answering, retries and duplicates”- Answer with any
2xxwithin 30 seconds. Anything else, or no answer in time, counts as a failure, and the delivery is tried again. - A delivery gets 12 attempts over about three days. After a failure, the next attempt comes
1 minute later, then 5 minutes, 30 minutes, 2 hours, 5 hours, and then every 10 hours.
After the 12th attempt fails, the delivery stops and is listed under Failed deliveries for
that endpoint in the dashboard (Settings, Webhooks). Once your server is fixed, choose
Redeliver there, for one delivery or all of them. A redelivery goes to the endpoint’s
current address, keeps its delivery id, and gets another 12 attempts. You can also catch up
with
GET /transactions. - A delivery can arrive more than once. Use
X-Spleetz-Delivery(the body’sid) to skip one you have already handled. - Deliveries can arrive out of order. Use the payment’s
status, or fetch it, rather than the order events arrive in. - Each endpoint gets its own delivery, with its own id and signature.
- Answer first and do slow work afterwards, so a delivery doesn’t time out while you process it.
Rolling a secret
Section titled “Rolling a secret”Roll a secret in the dashboard, or with POST /webhook-endpoints/{id}/roll-secret for an app’s
endpoint. The new secret signs every delivery from then on, including retries of deliveries
queued before the roll, and the old one stops working at once. Deploy the new secret straight
away.