Payment Intents

A Payment Intent tracks the lifecycle of a single payment attempt — created when the customer starts checkout, transitioning through processing, and ending in succeeded, canceled, or back in requires_payment_method after a decline.

Create one directly via POST /v1/payment-intents for direct API integrations, off-session charging (MIT), or save-card-during-purchase. Or let Checkout Sessions create one for hosted-checkout flows.

The Payment Intent object

idstring
Unique identifier, prefixed pi_.
objectstring
Always "payment_intent".
client_secretstring
Secret used by Pay-UI to authenticate the hosted checkout client. The embedded form takes a Checkout Session ID in CxPay.embed({ session: sessionId }), not this secret.
urlstring|null
Hosted checkout URL. Redirect the customer here. Null for a saved-card charge: there is no hosted page for it.
statusenum
One of: requires_payment_method, requires_confirmation, requires_action, processing, uncertain, requires_capture, succeeded, canceled, expired, requires_review.
amountinteger
Amount in the smallest currency unit.
currencystring
ISO 4217 currency code.
return_urlstring|null
Where the customer is redirected after 3DS or hosted checkout.
cancel_urlstring|null
Where Pay-UI redirects on customer cancel.
customerstring|null
ID of the attached customer, if set.
payment_methodstring|null
ID of the saved PaymentMethod on success (when setup_future_usage was set).
off_sessionboolean
True for a saved-card charge made with the customer absent.
setup_future_usageenum|null
"off_session", "on_session", or null.
descriptionstring|null
Free-form, shown on receipts.
metadataobject
Arbitrary key-value pairs.
capture_methodenum
automatic captures on authorization; manual holds the funds until you capture.
latest_chargestring|null
ID of the most recent Charge on this PI. Retrieve it for the captured and refunded totals.
last_payment_errorobject|null
Most recent decline: { type, code, message, decline_code?, advice_code?, retryable }. retryable is false for a decline a retry cannot fix. advice_code is try_again_later, do_not_try_again or confirm_card_data, when the card's bank or network says. Null when no decline has occurred.
next_actionnull
Always null. A step the payer has to complete, such as 3-D Secure, is handled by the hosted page at url.
cancellation_reasonstring|null
Set when the PI is canceled.
attempt_countinteger
Failed confirm attempts on this PI (anti-card-testing).
locked_atstring|null
ISO-8601 when anti-fraud controls locked this PI, or null.
blocked_reasonenum|null
Why the PI was locked: attempt_cap, min_amount, velocity, bin_enumeration, or null.
livemodeboolean
Test or live mode.
expires_atstring|null
ISO-8601 when the PI expires. Null for a saved-card charge, which never expires.
created_atstring
ISO-8601 timestamp.
THE PAYMENT INTENT OBJECT
JSON
1{
2 "id": "pi_01JQX...",
3 "object": "payment_intent",
4 "client_secret": "pi_01JQX..._secret_abc123",
5 "url": "https://pay.cxpay.net/pay?client_secret=pi_01JQX..._secret_abc123",
6 "status": "succeeded",
7 "amount": 5000,
8 "currency": "USD",
9 "return_url": "https://merchant.com/return",
10 "cancel_url": null,
11 "customer": "cus_01JQX...",
12 "payment_method": "pm_01JQX...",
13 "off_session": false,
14 "setup_future_usage": null,
15 "description": null,
16 "metadata": { "order_id": "ORD-123" },
17 "capture_method": "automatic",
18 "latest_charge": "ch_01JQX...",
19 "last_payment_error": null,
20 "next_action": null,
21 "cancellation_reason": null,
22 "attempt_count": 0,
23 "locked_at": null,
24 "blocked_reason": null,
25 "livemode": false,
26 "expires_at": "2026-04-07T19:00:00.000Z",
27 "created_at": "2026-04-07T18:30:00.000Z"
28}
STATUS REFERENCE
succeeded
Money capturedDone. Fulfill the order.
processing
Payment in flightSubmitted to the network, waiting for its result. There is no fixed time limit: it does not expire and cannot be canceled. Wait for the webhook or retrieve the PaymentIntent. With no result after about 24 hours, it moves to uncertain.
requires_payment_method
Awaiting cardCustomer hasn't completed checkout yet, or a decline reset the PI.
requires_confirmation
Awaiting confirmCard collected but not yet confirmed (rare in hosted flows).
requires_action
3DS challengeCustomer is completing 3DS on our hosted page.
uncertain
UncertainThe result is not known yet. No webhook is sent for this status, so retrieve the PaymentIntent. Do not charge again. If it resolves, you get payment_intent.succeeded or payment_intent.payment_failed.
requires_capture
Auth heldManual capture flow. Capture when ready.
requires_review
Needs reviewAutomated recovery ran out and the result is still unknown. No webhook is sent and the status does not change on its own. Keep the order pending and contact support.
canceled
CanceledPayment was canceled.
expired
Session expiredCreate a new session if the customer wants to retry.

Was this section helpful?

Create a Payment Intent

POST/v1/payment-intents
For the current version, the regular checkout flow is to create a Checkout Session — it mints and owns the Payment Intent for you and renders the hosted payment page. Create a Payment Intent directly only to charge a saved card off-session (MIT).

Creates a Payment Intent directly. The fields below apply to both the direct call and the one a Checkout Session creates on your behalf.

Request body

amountintegerRequired
Amount in the smallest currency unit, at most 99999999.
currencystringRequired
ISO 4217 currency code.
customerstring
cus_... — optional. Attach a customer for save-card flows. Required for an off-session charge.
payment_methodstring
pm_...: a saved card, which must belong to customer. Only with confirm: true; otherwise the request is refused with 400.
off_sessionboolean
true → MIT mode; the cardholder is not present and cannot authenticate. Only with confirm: true; otherwise the request is refused with 400.
setup_future_usageenum
"off_session" | "on_session": save the card the customer pays with. "on_session" saves it with no Mandate, so it cannot be charged off-session. Cannot be combined with confirm: true.
confirmboolean
true charges a saved card immediately, with the customer absent. Requires customer, payment_method and off_session: true. The charge runs once per Idempotency-Key: the same key returns the same PaymentIntent and never charges twice, however long ago the first request was. A saved-card PaymentIntent has no url and never expires.
capture_methodenum
"automatic" | "manual" — default automatic.
return_urlstring
For 3DS challenge redirect / hosted checkout return.
cancel_urlstring
Where Pay-UI redirects on customer cancel.
payment_method_optionsobject
{ card: { stored_credential_usage } }: stored_credential_usage enum: recurring (a fixed schedule), installment (one of a set number of payments for one purchase) or unscheduled (no schedule, the default). Only with confirm: true.
expires_ininteger
Seconds until the PaymentIntent expires, 60 to 86400, default 1800. Refused with confirm: true.
descriptionstring
Free-form, up to 1000 characters.
metadataobject
Arbitrary key-value pairs.

Response

Returns the PaymentIntent object (see The Payment Intent object). A saved-card charge answers 200 with succeeded (or requires_capture for manual capture), 200 with processing when the outcome is not yet known, or 402 when the card refused.

Modes

Three common shapes:

  • Hosted checkout (default) — minimal body, redirect the customer to response.url.
  • Save card during purchase (CIT + auto-vault) — set customer + setup_future_usage: "off_session".
  • Off-session MIT — set customer + payment_method + off_session: true + confirm: true, with an Idempotency-Key that names the charge. See Off-session payments for the outcomes and retry rules.

Errors

400invalid_request
Missing/invalid amount, currency, customer, etc.
400UNSUPPORTED_CURRENCY_PRECISION
The currency does not use 2 decimals. 0- and 3-decimal currencies, such as JPY, KWD, IQD and LYD, are refused when a Checkout Session or PaymentIntent is created, when a payment starts and when it is confirmed.
400CURRENCY_NOT_SUPPORTED
Create does not check whether the currency is enabled. Starting or confirming the payment returns this code if it is not.
400AMOUNT_BELOW_MINIMUM
Amount is below the minimum (anti-card-testing). An amount of 0 (zero-auth verification) is exempt.
400VALIDATION_FAILED
A half-specified saved-card charge: off_session, payment_method or stored_credential_usage without confirm: true, confirm: true without off_session: true, customer or payment_method, or confirm: true with setup_future_usage or expires_in. Nothing was charged.
200 (declined, hosted)last_payment_error set
A decline on a hosted payment returns HTTP 200 with the PI in requires_payment_method status. last_payment_error carries the code, retryable and, when the bank advises, advice_code.
402saved-card charge refused
The card refused a saved-card charge, or it failed for a definite reason. error.code equals last_payment_error.code, and the PaymentIntent is at error.meta.payment_intent. See Off-session payments.
403OFF_SESSION_NOT_ALLOWED
Charging saved cards is not switched on for your account. Contact support.
409IDEMPOTENCY_KEY_CONFLICT
This key already names a charge with a different amount, currency, customer, card, stored_credential_usage or explicit capture_method. Nothing was charged by this request.
409MANDATE_INACTIVE
Off-session attempt against revoked/inactive mandate.
409MANDATE_REQUIRED
Off-session attempt with no mandate present, or one that another customer gave.
409PAYMENT_METHOD_DETACHED
The card was detached. Detach is permanent: the customer saves the card again.
422MISSING_BILLING_DETAILS
The saved card has no full billing details, which the charge needs and cannot supply. The customer saves the card again.
REQUEST · HOSTED CHECKOUT
1curl -X POST https://api.cxpay.net/v1/payment-intents \
2 -H "X-Key-Id: ak_test_..." \
3 -H "Content-Type: application/json" \
4 -H "Idempotency-Key: 550e8400-..." \
5 -H "X-Signature: <base64-hmac>" \
6 -H "X-Timestamp: 2026-04-07T18:30:00.000Z" \
7 -H "X-Nonce: 550e8400-..." \
8 -H "X-Body-Hash: <sha256-of-body>" \
9 -d '{
10 "amount": 4900,
11 "currency": "USD",
12 "return_url": "https://merchant.com/return"
13 }'
TestPOST /v1/payment-intents
REQUEST · SAVE CARD (CIT + auto-vault)
1curl -X POST https://api.cxpay.net/v1/payment-intents \
2 -H "X-Key-Id: ak_test_..." \
3 -H "Content-Type: application/json" \
4 -H "Idempotency-Key: 550e8400-..." \
5 -H "X-Signature: <base64-hmac>" \
6 -H "X-Timestamp: 2026-04-07T18:30:00.000Z" \
7 -H "X-Nonce: 550e8400-..." \
8 -H "X-Body-Hash: <sha256-of-body>" \
9 -d '{
10 "amount": 4900,
11 "currency": "USD",
12 "customer": "cus_01JQX...",
13 "setup_future_usage": "off_session",
14 "return_url": "https://merchant.com/return"
15 }'
TestPOST /v1/payment-intents
REQUEST · OFF-SESSION MIT
1curl -X POST https://api.cxpay.net/v1/payment-intents \
2 -H "X-Key-Id: ak_test_..." \
3 -H "Content-Type: application/json" \
4 -H "Idempotency-Key: renewal-2026-11-sub_8841" \
5 -H "X-Signature: <base64-hmac>" \
6 -H "X-Timestamp: 2026-04-07T18:30:00.000Z" \
7 -H "X-Nonce: 550e8400-..." \
8 -H "X-Body-Hash: <sha256-of-body>" \
9 -d '{
10 "amount": 4900,
11 "currency": "USD",
12 "customer": "cus_01JQX...",
13 "payment_method": "pm_01JQX...",
14 "off_session": true,
15 "confirm": true,
16 "payment_method_options": { "card": { "stored_credential_usage": "recurring" } }
17 }'
TestPOST /v1/payment-intents
RESPONSE
JSON
1{
2 "id": "pi_01JQX...",
3 "object": "payment_intent",
4 "client_secret": "pi_01JQX..._secret_abc123",
5 "url": "https://pay.cxpay.net/pay?client_secret=pi_01JQX..._secret_abc123",
6 "status": "requires_payment_method",
7 "amount": 4900,
8 "currency": "USD",
9 "return_url": "https://merchant.com/return",
10 "cancel_url": null,
11 "customer": null,
12 "payment_method": null,
13 "off_session": false,
14 "setup_future_usage": null,
15 "description": null,
16 "metadata": {},
17 "latest_charge": null,
18 "last_payment_error": null,
19 "next_action": null,
20 "cancellation_reason": null,
21 "attempt_count": 0,
22 "locked_at": null,
23 "blocked_reason": null,
24 "livemode": true,
25 "expires_at": "2026-04-07T19:00:00.000Z",
26 "created_at": "2026-04-07T18:30:00.000Z"
27}
RESPONSE · 402 CARD REFUSED (ABRIDGED)
JSON
1{
2 "error": {
3 "code": "insufficient_funds",
4 "message": "The card has insufficient funds.",
5 "meta": {
6 "advice_code": "try_again_later",
7 "payment_intent": {
8 "id": "pi_01JQX...",
9 "status": "requires_payment_method",
10 "url": null,
11 "latest_charge": "ch_01JQX...",
12 "last_payment_error": {
13 "type": "card_error",
14 "code": "insufficient_funds",
15 "message": "The card has insufficient funds.",
16 "advice_code": "try_again_later",
17 "retryable": true
18 }
19 }
20 }
21 }
22}

Was this section helpful?

Retrieve a Payment Intent

GET/v1/payment-intents/:id

Returns a Payment Intent by id. Use this when your webhook hasn't arrived after 5 minutes, or when you want to verify status server-side before fulfilling.

Path parameters

idstringRequired
The Payment Intent id, prefixed pi_. You receive this from the Checkout Session response.

Errors

401unauthorized
Bad signature, expired timestamp, or unknown key.
404not_found
Payment Intent doesn't exist or belongs to a different account.
429rate_limited
Too many requests.
REQUEST
1curl https://api.cxpay.net/v1/payment-intents/pi_01JQX... \
2 -H "X-Key-Id: ak_test_..." \
3 -H "X-Signature: <base64-hmac>" \
4 -H "X-Timestamp: 2026-04-07T18:30:00.000Z" \
5 -H "X-Nonce: 550e8400-..." \
6 -H "X-Body-Hash: <sha256-of-empty>"
TestGET /v1/payment-intents/pi_01JQX...
RESPONSE
JSON
1{
2 "id": "pi_01JQX...",
3 "object": "payment_intent",
4 "client_secret": "pi_01JQX..._secret_abc123",
5 "url": "https://pay.cxpay.net/pay?client_secret=pi_01JQX..._secret_abc123",
6 "status": "succeeded",
7 "amount": 5000,
8 "currency": "USD",
9 "return_url": "https://merchant.com/return",
10 "cancel_url": null,
11 "customer": "cus_01JQX...",
12 "payment_method": "pm_01JQX...",
13 "off_session": false,
14 "setup_future_usage": null,
15 "description": null,
16 "metadata": { "order_id": "ORD-123" },
17 "capture_method": "automatic",
18 "latest_charge": "ch_01JQX...",
19 "last_payment_error": null,
20 "next_action": null,
21 "cancellation_reason": null,
22 "attempt_count": 0,
23 "locked_at": null,
24 "blocked_reason": null,
25 "livemode": false,
26 "expires_at": "2026-04-07T19:00:00.000Z",
27 "created_at": "2026-04-07T18:30:00.000Z"
28}

Was this section helpful?

List Payment Intents

GET/v1/payment-intents

Returns a list of Payment Intents, newest first. Use this to render a customer's payment history, or to reconcile your own ledger after a webhook outage.

Query parameters

customerstring
Restrict the list to one customer. Recommended whenever you're rendering a per-customer view — un-filtered lists span the entire account.
statusenum
One of the PaymentIntent statuses. Useful for "show only processing" reconciliation views.
limitinteger
1–100, default 10.
cursorstring
Pagination cursor.
REQUEST
1curl "https://api.cxpay.net/v1/payment-intents?customer=cus_01JQX...&limit=20" \
2 -H "X-Key-Id: ak_test_..." \
3 -H "X-Signature: <base64-hmac>" \
4 -H "X-Timestamp: 2026-04-07T18:30:00.000Z" \
5 -H "X-Nonce: 550e8400-..." \
6 -H "X-Body-Hash: <sha256-of-empty>"
TestGET /v1/payment-intents?customer=cus_01JQX...&limit=20

Was this section helpful?

Update a Payment Intent

PATCH/v1/payment-intents/:id

Mutates fields on an in-flight PaymentIntent. The most common use is back-filling customer when you collected the email after creating the session — once attached, the resulting saved card lands on the right Customer.

Allowed states

PATCH is only valid while the PI is in requires_payment_method or requires_confirmation. Mutations on terminal states return 400 INVALID_PAYMENT_STATE.

Body parameters

customerstring
Attach a customer. Must be an existing customer id, or the request returns 404. Once set, it cannot be changed to a different customer (returns 409 CUSTOMER_ALREADY_ATTACHED); re-sending the same id is a no-op.
metadataobject
Replace the metadata map. Arbitrary key-value pairs.
descriptionstring
Free-form, max 1000 chars.
REQUEST
1curl -X PATCH https://api.cxpay.net/v1/payment-intents/pi_01JQX... \
2 -H "X-Key-Id: ak_test_..." \
3 -H "Content-Type: application/json" \
4 -H "Idempotency-Key: 550e8400-..." \
5 -H "X-Signature: <base64-hmac>" \
6 -H "X-Timestamp: 2026-04-07T18:30:00.000Z" \
7 -H "X-Nonce: 550e8400-..." \
8 -H "X-Body-Hash: <sha256-of-body>" \
9 -d '{ "customer": "cus_01JQX..." }'
TestPATCH /v1/payment-intents/pi_01JQX...

Was this section helpful?

Capture a Payment Intent

POST/v1/payment-intents/:id/capture

Captures a manual-capture PaymentIntent in requires_capture (its charge is authorized but uncaptured). Use capture_method: "manual" on create to authorize now and capture later.

Repeating this request with the same Idempotency-Key while the first is still running returns 202 with {"status":"processing"}. The first capture has not finished. This is not a PaymentIntent status: a capture does not move the PaymentIntent to processing. Wait, then retrieve the PaymentIntent or retry with the same key. See Idempotency.

Body parameters

amount_to_captureinteger
Amount to capture, in the smallest currency unit. Must be ≤ the authorized amount; the remainder is released. Defaults to the full authorized amount.

Errors

409 INVALID_PAYMENT_INTENT_STATE
The PI has no authorized charge to capture, or the network rejected the capture.
REQUEST
1curl -X POST https://api.cxpay.net/v1/payment-intents/pi_01JQX.../capture \
2 -H "X-Key-Id: ak_test_..." \
3 -H "Content-Type: application/json" \
4 -H "Idempotency-Key: 550e8400-..." \
5 -H "X-Signature: <base64-hmac>" \
6 -H "X-Timestamp: 2026-04-07T18:30:00.000Z" \
7 -H "X-Nonce: 550e8400-..." \
8 -H "X-Body-Hash: <sha256-of-body>" \
9 -d '{ "amount_to_capture": 5000 }'
TestPOST /v1/payment-intents/pi_01JQX.../capture

Was this section helpful?

Cancel a Payment Intent

POST/v1/payment-intents/:id/cancel

Cancels a PaymentIntent by voiding its authorized (uncaptured) charge. An optional cancellation_reason may be supplied.

A PaymentIntent created by a Checkout Session or payment link can be canceled here once it is requires_capture: the authorization is voided, the PaymentIntent becomes canceled, and the Checkout Session is not changed. In any other state this endpoint returns 400 OWNED_PAYMENT_INTENT; while the Checkout Session is still open, cancel the session instead.

Body parameters

cancellation_reasonstring
An optional reason for the cancellation. Defaults to requested_by_merchant when omitted or blank.

Errors

400 OWNED_PAYMENT_INTENT
The PI belongs to a Checkout Session or payment link and is not requires_capture.
409 INVALID_PAYMENT_INTENT_STATE
The PI has no authorized charge to void, or the void was not confirmed.
503 CHECKOUT_SESSION_COMPLETION_PENDING
The PI's Checkout Session has not recorded its completion yet. Retry shortly.
REQUEST
1curl -X POST https://api.cxpay.net/v1/payment-intents/pi_01JQX.../cancel \
2 -H "X-Key-Id: ak_test_..." \
3 -H "Content-Type: application/json" \
4 -H "Idempotency-Key: 550e8400-..." \
5 -H "X-Signature: <base64-hmac>" \
6 -H "X-Timestamp: 2026-04-07T18:30:00.000Z" \
7 -H "X-Nonce: 550e8400-..." \
8 -H "X-Body-Hash: <sha256-of-body>" \
9 -d '{ "cancellation_reason": "requested_by_merchant" }'
TestPOST /v1/payment-intents/pi_01JQX.../cancel

Was this section helpful?

Refund a Payment Intent

POST/v1/payment-intents/:id/refund

Refunds the captured charge on a PaymentIntent — the full amount, or a partial amount. The charge is derived from the PI's latest charge. Returns the created Refund.

To read the refunded total, retrieve latest_charge with GET /v1/charges/:id and read amount_refunded.

Body parameters

amountinteger
Amount to refund in the smallest currency unit. Must be ≤ the remaining refundable amount. Defaults to the full captured amount.
reasonenum
duplicate, fraudulent, or requested_by_customer.

Errors

409 INVALID_PAYMENT_INTENT_STATE
The refund did not succeed. The PI may have no captured charge to refund or be fully refunded already, the card's bank may have declined the refund (we send refund.failed), or the outcome may be uncertain (we send refund.created with status: "pending"). An uncertain refund can still complete, so don't retry with a new idempotency key. Contact support with the PaymentIntent id.

Refunds run synchronously. The response is the source of truth, and refund.created carries the same status, normally succeeded. A pending refund sends refund.updated when it later succeeds, or refund.failed if it fails.

REQUEST
1curl -X POST https://api.cxpay.net/v1/payment-intents/pi_01JQX.../refund \
2 -H "X-Key-Id: ak_test_..." \
3 -H "Content-Type: application/json" \
4 -H "Idempotency-Key: 550e8400-..." \
5 -H "X-Signature: <base64-hmac>" \
6 -H "X-Timestamp: 2026-04-07T18:30:00.000Z" \
7 -H "X-Nonce: 550e8400-..." \
8 -H "X-Body-Hash: <sha256-of-body>" \
9 -d '{ "amount": 5000, "reason": "requested_by_customer" }'
TestPOST /v1/payment-intents/pi_01JQX.../refund
THE REFUND OBJECT
JSON
1{
2 "id": "ref_01JQX...",
3 "object": "refund",
4 "payment_intent": "pi_01JQX...",
5 "charge": "ch_01JQX...",
6 "amount": 5000,
7 "currency": "USD",
8 "status": "succeeded",
9 "reason": "requested_by_customer",
10 "created_at": "2026-04-07T18:35:00.000Z"
11}

Was this section helpful?

Off-session charges (MIT)Beta

To charge a saved card without the customer present, create a PaymentIntent with customer and payment_method set, off_session: true, and confirm: true. We replay the PM's latest_network_transaction_id and the active Mandate as stored-credential evidence.

Required combination

  • customer — the customer that owns the saved PM
  • payment_method — a PM in active status, saved for off-session use
  • off_session: true — flags the charge as merchant-initiated
  • confirm: true: charge in the same call
  • An Idempotency-Key header. One key is one charge, with no expiry.

Optional payment_method_options.card.stored_credential_usage is recurring, installment or unscheduled (the default). You never send a network transaction id, a Mandate id or a reason code.

Outcomes

  • 200, succeeded: money captured. With capture_method: "manual" the status is requires_capture.
  • 402: the card refused the charge, or it failed for a definite reason. The PaymentIntent is at error.meta.payment_intent, back in requires_payment_method with last_payment_error set. error.code is the same value as last_payment_error.code, and error.meta.advice_code is present when the card's bank advised what to do next. Decide from retryable and advice_code (try_again_later, do_not_try_again, confirm_card_data).
  • 200, processing: the outcome is not yet known. Retry with the same Idempotency-Key. Never use a new one: the first request may have charged the card.
  • Another 4xx: the request was refused before anything was charged. No PaymentIntent exists, and the same key can be used again.

An off-session charge never returns requires_action. When the card's bank wants the cardholder to authenticate, the charge fails with authentication_required, and the customer has to pay again while present, through a new PaymentIntent or Checkout Session. There is no link to send the customer, and next_action is always null.

The same key after a 402 answers the same 402 with no new attempt on the card. See Charging saved cards for the retry rules and the stranded-charge answers (409 EFFECT_IN_PROGRESS, 409 PAYMENT_OUTCOME_UNKNOWN).

REQUEST
1curl -X POST https://api.cxpay.net/v1/payment-intents \
2 -H "X-Key-Id: ak_test_..." \
3 -H "Content-Type: application/json" \
4 -H "Idempotency-Key: renewal-2026-11-sub_8841" \
5 -H "X-Signature: <base64-hmac>" \
6 -H "X-Timestamp: 2026-04-07T18:30:00.000Z" \
7 -H "X-Nonce: 550e8400-..." \
8 -H "X-Body-Hash: <sha256-of-body>" \
9 -d '{
10 "amount": 4900,
11 "currency": "USD",
12 "customer": "cus_01JQX...",
13 "payment_method": "pm_01JQX...",
14 "off_session": true,
15 "confirm": true,
16 "payment_method_options": { "card": { "stored_credential_usage": "recurring" } }
17 }'
TestPOST /v1/payment-intents

Was this section helpful?

Mandate + setup_future_usageBeta

Set setup_future_usage on the PI body to vault the card alongside the charge — one round trip instead of a separate SetupIntent. On success the PI carries a non-null payment_method and an associated Mandate recording the customer's consent.

Allowed values

  • off_session — the customer is consenting to future unattended charges. Multi-use mandate.
  • on_session: the card is saved with no Mandate, so it cannot be charged with off_session: true.
  • Omit (or null) for a one-shot charge that does not save the card.

The resulting mandate

On success, a Mandate is created and linked to the saved payment_method. The mandate id is not echoed on the PaymentIntent response — retrieve it via the Mandates API or from the mandate.created webhook event.

payment_method_options.card.stored_credential_usage

On a saved-card charge, set payment_method_options.card.stored_credential_usage to say what kind of agreement the charge runs under: recurring, installment or unscheduled. Omitted, it is unscheduled. The old payment_method_options.card.mit block is refused with 400.

REQUEST WITH SETUP_FUTURE_USAGE
JSON
1{
2 "amount": 4900,
3 "currency": "USD",
4 "customer": "cus_01JQX...",
5 "setup_future_usage": "off_session"
6}
SAVED-CARD CHARGE
JSON
1{
2 "amount": 4900,
3 "currency": "USD",
4 "customer": "cus_01JQX...",
5 "payment_method": "pm_01JQX...",
6 "off_session": true,
7 "confirm": true,
8 "payment_method_options": {
9 "card": { "stored_credential_usage": "recurring" }
10 }
11}

Was this section helpful?

Powered by CX Pay