CleonPay

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 with 400.
  • 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:

Eventsdata containsFetch with
payment.*payment_idGET /v1/payments/{id}
refund.*refund_id and payment_idGET /v1/refunds/{id}
payout.*payout_idGET /v1/payouts/{id}
crypto.payment.*crypto_payment_idGET /v1/crypto/payments/{id}
pingnote (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" }
}
Don't read 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

EventMeaning
payment.settledMoney moved. Fulfil here.
payment.authorizedCustomer paid; not yet settled
payment.awaiting_customerRedirect issued; customer has not paid yet
payment.failedDeclined or errored
payment.cancelledAbandoned or cancelled
payment.expiredNever completed
refund.settledRefund reached the customer
refund.failedRefund was refused; the money stays with you
payout.submittedPayout accepted, queued at the bank
payout.sentPayout handed to the scheme
payout.completedPayout reached the recipient
payout.failedPayout was rejected; the money stays with you
payout.returnedPayout bounced back
crypto.payment.receivedCrypto deposit confirmed on-chain. Fulfil here.
crypto.payment.underpaidDeposit confirmed, but less than the amount due
crypto.payment.heldDeposit held for review — source failed sanctions screening. Do not fulfil.
crypto.payment.expiredNo deposit before the window closed
Crypto events carry 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

Verify before you act. An endpoint that trusts any POST can be told a payment succeeded by anyone who finds the URL.
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);
}
Use the raw body. Verify against the exact bytes received. Parsing to JSON and re-serialising changes whitespace and key order, and the signature will never match.

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.