Skip to main content
A payment session is the central object in Payment Acceptance. It tracks the full lifecycle of a payment from creation through settlement, including authorization, capture, void, and refund.

Creating a session

Create a payment session by specifying the amount, asset, and target:
The response includes a url field — a hosted payment page where the buyer can complete the payment.

Target types

The target determines where captured funds settle. Account target (most common for PSPs):
Wallet target:
Payment sessions created with a wallet target also include an x402Url in the response — a CDP-hosted URL that you can give to an x402-enabled agent. The agent makes a POST request to this URL, and CDP returns the x402 payment requirements in the PAYMENT-REQUIRED header, including the supported USDC payment options. After the agent completes the x402 payment flow, the session follows the normal lifecycle — you can capture, void, or refund it using the same APIs as other wallet-authorized sessions. See Authorization for the full x402 flow.

Expiries

Every session has three deadlines controlling when each action can be performed. If omitted, sensible defaults are applied: Expiries must satisfy: authorizationExpiresAt <= captureExpiresAt <= refundExpiresAt.
Expiry deadlines are guards, not automatic state transitions. When a deadline passes, the corresponding action is blocked, but the session stays in its current status. You must explicitly cancel (pre-auth) or void (post-auth) to move the session to a terminal state.
To set custom expiries:

Balances

The balances object tracks running totals as funds move through the session:

Example: partial capture flow

  1. Authorization succeeds for $100 — capturable: 100, captured: 0
  2. Capture $60 — capturable: 40, captured: 60, refundable: 60
  3. Capture $30 — capturable: 10, captured: 90, refundable: 90
  4. Void remaining — capturable: 0, captured: 90, refundable: 90
  5. Refund $20 — capturable: 0, captured: 90, refundable: 70, refunded: 20

Auto-capture

Set autoCapture: true to automatically capture the full authorized amount after a successful authorization:
When auto-capture is enabled, you don’t need to call the captures endpoint — a capture is created automatically after authorization_succeeded. This is useful when you don’t need to delay capture for fulfillment. When autoCapture is false (default), you must create captures manually via the captures endpoint.

Final capture

When capturing partially, set finalCapture: true on the last capture to release remaining funds to the buyer:
After finalCapture: true settles, any remaining capturable balance is released back to the buyer. If finalCapture is false, the remaining hold stays open for subsequent partial captures (subject to captureExpiresAt). Has no effect when capturing the full capturable balance, since no remaining balance exists.

Customer display

Use customerDisplay to show merchant branding and local-currency amounts to the buyer during checkout:
customerDisplay is purely presentational. The authoritative settlement amount is always the session’s amount and asset.

Redirect URLs

For web-based payment flows, configure redirect URLs to send the buyer back to your site after payment:

External reference ID

Attach your own identifier (order ID, invoice number) to the session for reconciliation:
Stored and returned as-is. Not interpreted by Coinbase — use it to match sessions with your internal records. Maximum 256 characters.

Metadata

Attach up to 10 key-value pairs to a session, capture, void, refund, or authorization:
Never store sensitive data like passwords, account numbers, or PII in metadata.

Reserved keys for settlement reporting

A few metadata keys are reserved — settlement reports read them out of the generic metadata object and surface them as dedicated report columns. Pass these exact key names if you want the corresponding column populated. They don’t require any request field beyond the standard metadata object shown above. merchantId and merchantReference are set per capture or refund, not once at session creation — unlike externalReferenceId, which applies to the whole session.

Cancellation

Cancel a session before any funds are authorized:
Cancel only works when the session is in created status and no authorization is pending. Once canceled, no further actions can be performed. This is the only way to terminate a pre-authorization session — expiry deadlines block actions but don’t automatically move the session to a terminal state.

Authorization

Wallet, Coinbase, and x402 authorization flows

Hosted Checkout

Redirect flow and the embeddable web component

Disbursements

Send funds independent of a payment session

Webhooks

Get notified on every status change

API Reference

Full API specification