Guide

How It Works

The payment lifecycle from checkout to cash — big picture first, then details.

Big Picture

Every payment flows through three objects:

ObjectWhat it isYou create it?
Checkout SessionA payment page for your customerYes — POST/v1/checkout-sessions
Payment IntentTracks the payment through its lifecycleAuto-created with the session
ChargeThe actual money movement (auth, capture, settle)Auto-created when customer pays

Create the session, then check its PaymentIntent from your server to confirm the payment result. CX Pay handles the payer-facing payment flow.

Checkout flow
Your Server
CX Pay
Customer
POST /v1/checkout-sessions
{ id, url, payment_intent }
Redirect or embed the payment form
Enters card details
3DS challenge (if needed)
Charge created
PI → succeeded
webhook: payment_intent.succeeded
Fulfill the order ✓

Payment Intent Lifecycle

The Payment Intent is the source of truth for "did they pay?" Here are the states you'll see:

Payment Intent lifecycle
requires_payment_method
just created
customer submits card
processing
payment in flight
succeeded
money captured
requires_payment_method
declined; retry allowed

The states that matter to you:

StatusWhat it meansWhat to do
succeededMoney captured. Done.Fulfill the order
processingPayment submitted, waiting on the network. No fixed time limit: it does not expire and cannot be canceled. With no result after about 24 hours, it moves to uncertainWait for the webhook or retrieve the PaymentIntent
uncertainThe gateway result is not yet known. No webhook is sent for this statusRetrieve the PaymentIntent; do not create another charge
requires_reviewAutomated recovery exhausted; manual review required. No webhook is sent for this statusKeep the order pending and contact support
requires_payment_methodWaiting for the customer to enter a cardNothing — they haven't paid yet
requires_actionCustomer needs to complete 3DSNothing — we handle it
requires_captureAuth held, awaiting capture (manual capture flow)Call capture when you're ready to take the funds
canceledCustomer or session expiredShow "payment canceled"
expiredSession timed outOffer to try again

Payment Intent vs Charge

  • Payment Intent = the intention to collect money. Tracks the full lifecycle.
  • Charge = the actual money movement. Created when the payment is attempted.

A Payment Intent can have multiple Charges (e.g., if the first attempt fails and the customer retries). You almost never need to think about Charges — just check the Payment Intent status.

Rule of thumb: Check payment_intent.status to know if you got paid. Ignore Charges unless you're debugging.

Checkout Session vs Payment Intent

"When do I use which?"

  • Checkout Session = what you create. Use its url for hosted checkout or its id with CxPay.embed() for the payment form.
  • Payment Intent = what you check. The payment_intent ID from the session response is your reference for payment status.
Checkout Session · cs_…
owns
Payment Intent · pi_…
owns
Charge · ch_…

You create the session. You check the intent. You ignore the charge. Simple.

Powered by CX Pay