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.
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) andidempotencyKey(nullable). pendingWebhooksinteger- Number of webhook deliveries still pending for this event.
data.objectobject- The resource that triggered the event, nested under
data.object. Forpayment_intent.*events this is a Payment Intent; forcheckout_session.*events this is a Checkout Session. Fields use camelCase domain naming (e.g.amountReceived,customerId), not the snake_case REST shape.
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
openand 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.succeededis 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. Theuncertainandrequires_reviewstatuses can appear when you retrieve a PaymentIntent, but they send no webhook. A saved-card charge made with the customer absent never sendsrequires_action: a refused card sendspayment_failed, and an unknown outcome sendsprocessing.charge.*captured,failed,pending,refunded,voided.charge.refundedfires only on a full refund. There is no partial-refund charge event; a partial refund sends onlyrefund.created.charge.failedandcharge.pendingcarry 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.capturedandcharge.voidedno longer say who acted.refund.*created,failed,updated. Refunds run synchronously, sorefund.createdcarries the outcome instatus, normallysucceeded, and no longer says who refunded.refund.failedfires when the refund is declined.refund.updatedfires 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 indata.objectcontainsreturnDomainId,originandactor. Actor ids use camelCasekeyIdoruserId; staff actors contain onlytype: "staff".payment_method.*attached,detached,automatically_updated,expired,compromised,deleted,vault_failed.payment_method.vault_failedmeans a payment succeeded but its card could not be saved.payment_method.detachedis permanent: the card cannot be attached again.payment_method.compromisedno longer carriesreason.setup_intent.*succeeded,setup_failed,requires_action,canceled,updated.setup_intent.requires_actioncarries the type of the action only.mandate.*created,revoked.mandate.createdis the signal that a card can be charged off-session.customer.*created,updated,deleted.customer.deletedno longer carriesdeletedBy.otherteam.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.
1If your endpoint returns non-2xx or times out:2 attempt 1: immediate3 attempt 2: about 5 seconds later4 attempt 3: about 30 seconds later5 attempt 4: about 2 minutes later6 attempt 5: about 10 minutes later7 attempt 6: about 1 hour later8 attempt 7: about 4 hours later9 attempt 8: about 12 hours later (~17h total)10These delays are approximate: a retry can run up to11about 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) andv1(signature). 2. Check freshness- Reject if the timestamp is older than 5 minutes.
3. ComputeHMAC-SHA256(secret, "{t}.{raw_body}"), hex-encoded.4. Compare- Constant-time compare to
v1.
1import crypto from "crypto";23function verifyWebhook(rawBody, header, secret) {4 const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));5 const { t: timestamp, v1: signature } = parts;67 const age = Math.abs(Date.now() / 1000 - parseInt(timestamp));8 if (age > 300) throw new Error("Webhook too old");910 const expected = crypto11 .createHmac("sha256", secret)12 .update(`${timestamp}.${rawBody}`)13 .digest("hex");1415 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?
- Need help? Contact Support.
- Check out our changelog.
- Questions? Contact Sales.
- LLM? Read llms.txt.
Powered by CX Pay