Events

When something happens, we POST an Event object to your webhook URL. Verify the signature, process the event, return 200.

Webhook delivery is at-least-once. Your endpoint must be idempotent — use the event id to dedupe replays.

Delivery order is not guaranteed. A later event can arrive before an earlier one.

Your endpoint must start responding within 5 seconds. With no 2xx by then we retry, so the same event can arrive again.

Related: Webhook setup overview.

EVENT PAYLOAD
JSON
1{
2 "id": "evt_01JQX...",
3 "object": "event",
4 "type": "payment_intent.succeeded",
5 "created": 1744050900,
6 "createdAt": "2026-04-07T18:35:00.000Z",
7 "apiVersion": "2026-01-01",
8 "livemode": false,
9 "merchantOrgId": "morg_01JQX...",
10 "data": {
11 "object": {
12 "paymentIntentId": "pi_01JQX...",
13 "amount": 5000,
14 "amountReceived": 5000,
15 "currency": "USD",
16 "status": "succeeded",
17 "chargeId": "ch_01JQX...",
18 "clientReferenceCode": "ORD-123",
19 "customerId": "cus_01JQX..."
20 }
21 }
22}

The Event object

idstring
Unique event id, prefixed evt_. Use this to deduplicate.
objectstring
Always "event".
typestring
The event type. See the table on the right.
createdinteger
Unix timestamp (seconds) when the event was emitted.
createdAtstring
ISO-8601 timestamp when the event was emitted.
apiVersionstring
The API version in effect when the event was generated.
livemodeboolean
Test or live mode.
merchantOrgIdstring
The MerchantOrg this event belongs to.
requestobject | null
Correlation/idempotency context for the API call that produced the event. Carries id (the correlation id) and idempotencyKey (nullable).
pendingWebhooksinteger
Number of webhook deliveries still pending for this event.
data.objectobject
The resource that triggered the event, nested under data.object. For payment_intent.* events this is a Payment Intent; for checkout_session.* events this is a Checkout Session. Fields use camelCase domain naming (e.g. amountReceived, customerId), not the snake_case REST shape.
THE EVENT OBJECT
JSON
1{
2 "id": "evt_01JQX...",
3 "object": "event",
4 "type": "payment_intent.succeeded",
5 "created": 1744050900,
6 "createdAt": "2026-04-07T18:35:00.000Z",
7 "apiVersion": "2026-01-01",
8 "livemode": false,
9 "merchantOrgId": "morg_01JQX...",
10 "data": {
11 "object": {
12 "paymentIntentId": "pi_01JQX...",
13 "amount": 5000,
14 "amountReceived": 5000,
15 "currency": "USD",
16 "status": "succeeded",
17 "chargeId": "ch_01JQX...",
18 "clientReferenceCode": "ORD-123",
19 "customerId": "cus_01JQX..."
20 }
21 }
22}

Was this section helpful?

Event types

These four matter most for hosted checkout — subscribe at minimum to payment_intent.succeeded. The full catalog follows.

payment_intent.succeeded
Fires when a payment is captured. This is the one that means "you got paid." Fulfill the order on this event.
payment_intent.payment_failed
Card declined or processing error. Show the failure to your customer; the original session is still open and they can retry.
checkout_session.completed
The customer finished checkout: the payment succeeded, the payment was authorized for manual capture, or a setup-mode session saved a card. It does not fire on a decline. With manual capture it can mean authorized only, so payment_intent.succeeded is the paid signal.
checkout_session.expired
Session timed out without payment. Optionally notify the customer; they need a new session to retry.

Full catalog

Every event type is {resource}.{action}. Subscribe to exact event types, or to * for every event. A family wildcard such as payment_intent.* is accepted but never matches, so it delivers nothing. The family names below only group the list.

payment_intent.*
succeeded, payment_failed, processing, requires_action, amount_capturable_updated, canceled, expired, updated. The uncertain and requires_review statuses can appear when you retrieve a PaymentIntent, but they send no webhook. A saved-card charge made with the customer absent never sends requires_action: a refused card sends payment_failed, and an unknown outcome sends processing.
charge.*
captured, failed, pending, refunded, voided. charge.refunded fires only on a full refund. There is no partial-refund charge event; a partial refund sends only refund.created. charge.failed and charge.pending carry a cut-down charge: the ids, status and amounts, the card brand, last four and expiry, the outcome, the 3D Secure result and the error, with no processing details and no billing details. charge.captured and charge.voided no longer say who acted.
refund.*
created, failed, updated. Refunds run synchronously, so refund.created carries the outcome in status, normally succeeded, and no longer says who refunded. refund.failed fires when the refund is declined. refund.updated fires only when a pending refund resolves later.
checkout_session.*
completed, expired, canceled, updated.
payment_link.*
created, updated, deactivated, used, completed, expired.
return_domain.*
created, deleted. A change to this mode's return domains. The payload in data.object contains returnDomainId, origin and actor. Actor ids use camelCase keyId or userId; staff actors contain only type: "staff".
payment_method.*
attached, detached, automatically_updated, expired, compromised, deleted, vault_failed. payment_method.vault_failed means a payment succeeded but its card could not be saved. payment_method.detached is permanent: the card cannot be attached again. payment_method.compromised no longer carries reason.
setup_intent.*
succeeded, setup_failed, requires_action, canceled, updated. setup_intent.requires_action carries the type of the action only.
mandate.*
created, revoked. mandate.created is the signal that a card can be charged off-session.
customer.*
created, updated, deleted. customer.deleted no longer carries deletedBy.
other
team.invited, team.removed.
reserved
Not currently sent; reserved: dispute.opened, payout.settled, export.ready, payment_method.activated, payment_link.activated, payment_link.opened, payment_link.exhausted, mandate.updated, refund.succeeded.
RETRY TIMELINE
1If your endpoint returns non-2xx or times out:
2 attempt 1: immediate
3 attempt 2: about 5 seconds later
4 attempt 3: about 30 seconds later
5 attempt 4: about 2 minutes later
6 attempt 5: about 10 minutes later
7 attempt 6: about 1 hour later
8 attempt 7: about 4 hours later
9 attempt 8: about 12 hours later (~17h total)
10These delays are approximate: a retry can run up to
11about 5 minutes after its scheduled time.
12After all retries fail, the delivery is marked failed.

Was this section helpful?

Verifying signatures

Every webhook includes a X-CXPay-Signature header:

X-CXPay-Signature: t=1712345678,v1=a3b2c1d4e5f6...

Verification steps

1. Parse
Extract t (timestamp) and v1 (signature).
2. Check freshness
Reject if the timestamp is older than 5 minutes.
3. Compute
HMAC-SHA256(secret, "{t}.{raw_body}"), hex-encoded.
4. Compare
Constant-time compare to v1.
VERIFY
1import crypto from "crypto";
2
3function verifyWebhook(rawBody, header, secret) {
4 const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
5 const { t: timestamp, v1: signature } = parts;
6
7 const age = Math.abs(Date.now() / 1000 - parseInt(timestamp));
8 if (age > 300) throw new Error("Webhook too old");
9
10 const expected = crypto
11 .createHmac("sha256", secret)
12 .update(`${timestamp}.${rawBody}`)
13 .digest("hex");
14
15 if (!crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected))) {
16 throw new Error("Invalid signature");
17 }
18 return JSON.parse(rawBody);
19}

Was this section helpful?

Powered by CX Pay