Payment Sessions

Create a payment session

Changed on

Creates a payment session that defines what is being paid — amount, asset, and target. Optionally configure execution behavior, expiry deadlines, redirect URLs, and metadata.

If expiry deadlines are omitted, sensible defaults are applied (1 day for authorization, 7 days for capture, 30 days for refund). Expiries must be in ascending order — see the expiries object for details and constraints.

Returns the session in created status. Next step: call one of the authorization endpoints (wallet or Coinbase) to authorize the payment.

post/v2/payment-sessions

Request

  • Base URL
    https://api.cdp.coinbase.com/platform
  • Auth
    HTTP bearer

Headers

X-Idempotency-Key, string

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

CreatePaymentSessionRequest required

A request to create a new payment session.

amount, string required

A decimal representation of the payment amount, denominated in asset.

asset, string required

The symbol of the asset for the payment amount.

target, union required

The target of the payment session.

expiries, PaymentExpiries

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.

redirect, PaymentRedirect

Redirect URLs used to direct the payer after a web-based payment flow completes or fails.

autoCapture, boolean

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.

externalReferenceId, string

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.

customerDisplay, CustomerDisplay

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.

metadata, Metadata

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.

compliance, PaymentSessionCompliance

Compliance context for this payment session. Carries buyer information required by some entity configurations to meet regulatory requirements.

Example request

{
  "amount": "1.00",
  "asset": "usdc",
  "target": {
    "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "network": "base"
  },
  "expiries": {
    "authorizationExpiresAt": "2025-12-31T23:59:59.000Z",
    "captureExpiresAt": "2026-01-15T23:59:59.000Z",
    "refundExpiresAt": "2026-02-15T23:59:59.000Z"
  },
  "redirect": {
    "failureUrl": "https://merchant.example.com/payment/failed",
    "successUrl": "https://merchant.example.com/payment/success"
  },
  "externalReferenceId": "merchant-order-abc123",
  "customerDisplay": {
    "merchantName": "Acme Store",
    "displayAmount": {
      "amount": "1.37",
      "currency": "cad"
    }
  },
  "metadata": {
    "customer_id": "cust_12345",
    "order_reference": "order-67890"
  },
  "compliance": {
    "buyer": {
      "name": "John Doe",
      "address": {
        "line1": "123 Market St",
        "city": "San Francisco",
        "state": "CA",
        "postCode": "94105",
        "countryCode": "US"
      }
    }
  }
}

Response

Successfully created payment session.

PaymentSession required

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.

paymentSessionId, string

The unique identifier of the payment session.

entityId, string

The ID of the entity that owns the payment session.

amount, string

A decimal representation of the payment amount, denominated in asset.

asset, string

The symbol of the asset for the payment amount.

target, union

The target of the payment session.

autoCapture, boolean

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.

expiries, PaymentExpiries

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.

source, union

The source of the payment session. Set after a successful authorization. Not present before authorization.

status, 'created' | 'canceled' | 'authorization_pending' | 'authorization_succeeded' | 'authorization_failed' | 'capture_pending' | 'capture_succeeded' | 'capture_failed' | 'void_pending' | 'void_succeeded' | 'void_failed' | 'refund_pending' | 'refund_succeeded' | 'refund_failed'

The most recent meaningful event on the payment session.

balances, PaymentSessionBalances

Running totals tracking how funds move through the session. All amounts are decimal representations denominated in the session's asset.

authorizations, Authorization[]

The authorizations for this payment session.

captures, Capture[]

The captures for this payment session.

voids, Void[]

The voids for this payment session.

refunds, Refund[]

The refunds for this payment session.

url, string uri

A URL to the hosted payment page where the payer can complete this payment session.

x402Url, string uri

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, PaymentRedirect

Redirect URLs used to direct the payer after a web-based payment flow completes or fails.

customerDisplay, CustomerDisplay

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.

metadata, Metadata

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.

externalReferenceId, string

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.

cancellationReason, string

The reason the payment session was canceled. Only present when the session has been canceled.

createdAt, string date-time

The UTC ISO 8601 timestamp at which the payment session was created.

updatedAt, string date-time

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 property oneOf list for the response status

    • warning

      added the new policy_not_applicable enum value to the errorType response property for the response status

    • warning

      added the new policy_not_applicable enum value to the errorType response property for the response status

    3 more changes in this revision