Cancel a payment session
Changed onCancels a payment session before any funds have been authorized or captured. The session must be in created status. Cancel is blocked while any authorization action is pending.
Once canceled, no further actions can be performed on the session. This is the only way to terminate a pre-authorization session — expiry deadlines block actions but do not automatically transition the session to a terminal state.
Request
- Base URLhttps://api.cdp.coinbase.com/platform
- AuthHTTP bearer
Path parameters
The ID of the payment session, a UUID prefixed by paymentSession_.
The unique identifier of the payment session to cancel.
Headers
An optional string request header for making requests safely retryable. When included, duplicate requests with the same key will return identical responses. Refer to our Idempotency docs for more information on using idempotency keys.
Request body
A request to cancel a payment session.
The reason for cancelling the payment session.
Example request
{
"cancellationReason": "Customer requested cancellation."
}Response
Successfully canceled payment session.
Tracks the full lifecycle of a payment from creation through settlement. Typical flow: Create → Authorize (via payment method) → Capture. Optional: Void to release uncaptured funds, or Refund to return captured funds.
The unique identifier of the payment session.
The ID of the entity that owns the payment session.
A decimal representation of the payment amount, denominated in asset.
The symbol of the asset for the payment amount.
The target of the payment session.
When true, a capture is automatically created after a successful authorization. When false or omitted, the merchant must create captures manually via the captures endpoint.
Deadlines for each stage of the payment session lifecycle. All fields are optional; when omitted from a create request, the following defaults apply: authorizationExpiresAt = now + 1 day, captureExpiresAt = now + 7 days, refundExpiresAt = now + 30 days.
Expiries must satisfy authorizationExpiresAt ≤ captureExpiresAt ≤ refundExpiresAt. The API returns a 400 error if this constraint is violated.
Each deadline acts as a guard — after it passes, the corresponding action is rejected, but the session remains in its current status. No automatic state transitions occur; the merchant must take explicit action (e.g., cancel or void) to move the session to a terminal state.
The source of the payment session. Set after a successful authorization. Not present before authorization.
The most recent meaningful event on the payment session.
Running totals tracking how funds move through the session. All amounts are decimal representations denominated in the session's asset.
The authorizations for this payment session.
The captures for this payment session.
The voids for this payment session.
The refunds for this payment session.
A URL to the hosted payment page where the payer can complete this payment session.
URL for the hosted x402 payment flow. This endpoint expects an HTTP POST request (for example, submitting the x402 payment via request headers); do not treat it as a page opened with GET alone. Only present when the payment target supports a wallet source.
Redirect URLs used to direct the payer after a web-based payment flow completes or fails.
Merchant-provided display data shown to the payer during checkout. All fields are informational only — stored and returned as-is, with no effect on payment processing, settlement, or validation.
Optional metadata as key-value pairs. Use this to store additional structured information on a resource, such as customer IDs, order references, or any application-specific data. Up to 10 key/value pairs may be provided. Keys and values are both strings. Keys must be ≤ 40 characters; values must be ≤ 500 characters.
A merchant-provided internal identifier for this payment session, from the merchant's own system—not visible to the payer. It must not contain personally identifiable information (PII) or payment credentials.
The reason the payment session was canceled. Only present when the session has been canceled.
The UTC ISO 8601 timestamp at which the payment session was created.
The UTC ISO 8601 timestamp at which the payment session was last updated.
Example response
{
"paymentSessionId": "paymentSession_82c879c1-84e1-44ed-a8c2-1ac239cf09ad",
"entityId": "entity_af2937b0-9846-4fe7-bfe9-ccc22d935114",
"amount": "1.00",
"asset": "usdc",
"target": {
"address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"network": "base"
},
"autoCapture": false,
"expiries": {
"authorizationExpiresAt": "2025-12-31T23:59:59.000Z",
"captureExpiresAt": "2026-01-15T23:59:59.000Z",
"refundExpiresAt": "2026-02-15T23:59:59.000Z"
},
"status": "created",
"balances": {
"capturable": "0",
"captured": "0",
"refundable": "0",
"refunded": "0"
},
"url": "https://payments.coinbase.com/payment-sessions/paymentSession_82c879c1-84e1-44ed-a8c2-1ac239cf09ad",
"x402Url": "https://api.cdp.coinbase.com/platform/v2/payment-sessions/paymentSession_82c879c1-84e1-44ed-a8c2-1ac239cf09ad/authorizations/x402",
"redirect": {
"failureUrl": "https://merchant.example.com/payment/failed",
"successUrl": "https://merchant.example.com/payment/success"
},
"customerDisplay": {
"merchantName": "Acme Store",
"displayAmount": {
"amount": "1.37",
"currency": "cad"
}
},
"externalReferenceId": "merchant-order-abc123",
"metadata": {
"customer_id": "cust_12345",
"order_reference": "order-67890"
},
"createdAt": "2025-06-15T12:00:00.000Z",
"updatedAt": "2025-06-15T12:05:00.000Z"
}Changes
- breaking
added to the
refunds/items/source/allOf[#/components/schemas/RefundSource]response propertyoneOflist for the response status - warning
added the new
policy_not_applicableenum value to theerrorTyperesponse property for the response status - warning
added the new
policy_not_applicableenum value to theerrorTyperesponse property for the response status
4 more changes in this revision
- breaking