Webhooks
How you learn a payment succeeded. The only authoritative signal.
We POST a signed JSON body to the URL you give us, and retry for 24 hours across 12 attempts with exponential backoff. Return any 2xx to acknowledge.
Endpoints are managed in your dashboard: add one per environment, read its signing secret, and send yourself a test event to prove your handler end to end.
POST https://your-server.example.com/webhooks/cleonpay
Content-Type: application/json
CleonPay-Signature: t=1755789326,v1=5257a869e7ecebeda32affa62cdca3fa...
CleonPay-Event-Type: payment.settled
{
"id": "0f6b3c1e-8a52-4d7e-9c0b-2f4e6a1d9b73",
"type": "payment.settled",
"created": "2026-08-21T13:15:26.438Z",
"livemode": true,
"data": { "payment_id": "3743881d-0fce-416c-b3de-8bc3f5d414b1" }
}
Endpoints are per environment: sandbox events only ever reach your
sandbox endpoint, and live events your live one. livemode
repeats that in the body so a misconfigured handler can double-check.
Per-request webhook URL
Most integrations set one endpoint in the dashboard and stop there. If
you route callbacks by URL — one URL per connection, store or flow — pass
webhook_url when you create a payment or payout instead. Every
event for that payment (its refunds included) or payout then goes to that
URL instead of your dashboard endpoint, with the same body,
headers and retries.
POST /v1/payouts
{
"recipient_id": "6d4ff39f-72fb-44c4-9e13-9c724683d40a",
"method": "card_payout",
"amount": 5000,
"currency": "EUR",
"webhook_url": "https://your-server.example.com/webhooks/cleonpay/connection-42"
}
- It must be a public
https://URL. Private, internal and local addresses are refused with400. - Deliveries to it are signed with your account signing secret, shown on the Webhooks page of your dashboard, one per environment. Verify them exactly as below.
- The payment or payout echoes it back as
webhook_url. Without it, events go to your dashboard endpoint as always — you can use both styles side by side.
What the body carries
An event says what happened and to which object, nothing
more. The object's ID sits in data, under a key that depends on
the event family. Read type first, then the matching key:
| Events | data contains | Fetch with |
|---|---|---|
payment.* | payment_id | GET /v1/payments/{id} |
refund.* | refund_id and payment_id | GET /v1/refunds/{id} |
payout.* | payout_id | GET /v1/payouts/{id} |
crypto.payment.* | crypto_payment_id | GET /v1/crypto/payments/{id} |
ping | note (dashboard test only) | — |
A payout event, for example:
{
"id": "04a55e05-2080-4b8c-a3ad-22f1aac3b470",
"type": "payout.completed",
"created": "2026-10-22T07: 11: 33.419Z",
"livemode": true,
"data": { "payout_id": "500b593c-c202-4ca1-b920-e606f8041c6d" }
}
payment_id for every event.
A handler that does will acknowledge payout events with a 2xx but find no ID,
and silently drop them. Switch on type, then fetch the object for
its current status: events can arrive out of order or more than once, and the
object is always the truth. Use the event id to ignore duplicates.Events
| Event | Meaning |
|---|---|
payment.settled | Money moved. Fulfil here. |
payment.authorized | Customer paid; not yet settled |
payment.awaiting_customer | Redirect issued; customer has not paid yet |
payment.failed | Declined or errored |
payment.cancelled | Abandoned or cancelled |
payment.expired | Never completed |
refund.settled | Refund reached the customer |
refund.failed | Refund was refused; the money stays with you |
payout.submitted | Payout accepted, queued at the bank |
payout.sent | Payout handed to the scheme |
payout.completed | Payout reached the recipient |
payout.failed | Payout was rejected; the money stays with you |
payout.returned | Payout bounced back |
crypto.payment.received | Crypto deposit confirmed on-chain. Fulfil here. |
crypto.payment.underpaid | Deposit confirmed, but less than the amount due |
crypto.payment.held | Deposit held for review — source failed sanctions screening. Do not fulfil. |
crypto.payment.expired | No deposit before the window closed |
crypto_payment_id,
not payment_id — e.g. "data": { "crypto_payment_id": "…" }.
Fetch it with GET /v1/crypto/payments/{id}. See
Crypto payments. They only fire when crypto is
enabled on your account.Verifying the signature
import { createHmac, timingSafeEqual } from 'node:crypto';
function verify(secret, header, rawBody, toleranceSeconds = 300) {
const parts = Object.fromEntries(
header.split(',').map((p) => p.split('=').map((s) => s.trim())),
);
if (!parts.t || !parts.v1) return false;
// Reject anything old, so a captured delivery cannot be replayed later.
if (Math.abs(Date.now() / 1000 - Number(parts.t)) > toleranceSeconds) return false;
const expected = createHmac('sha256', secret)
.update(parts.t + '.' + rawBody)
.digest('hex');
const a = Buffer.from(expected, 'hex');
const b = Buffer.from(parts.v1, 'hex');
return a.length === b.length && timingSafeEqual(a, b);
}
Duplicates
A retry after your server timed out means the same event arrives twice.
Deduplicate on the event id and treat a repeat as a no-op.