Payment Sessions

Refund a payment session

Changed on

Returns captured funds to the payer. The session must have a positive refundable balance and the refundExpiresAt deadline must not have passed.

This is an asynchronous operation. The refund is returned in pending status and transitions to succeeded or failed.

If amount is omitted, the full remaining refundable amount is refunded. Multiple partial refunds are supported.

post/v2/payment-sessions/{paymentSessionId}/refunds

Request

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

Path parameters

paymentSessionId, string required

The ID of the payment session, a UUID prefixed by paymentSession_.

Example:paymentSession_82c879c1-84e1-44ed-a8c2-1ac239cf09ad

The unique identifier of the payment session.

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

CreateRefundRequest required

A request to create a refund for a payment session.

source, union required

The source from which to fund the refund. Can be a CDP account, an onchain address, or a Coinbase retail account.

amount, string

A decimal representation of the amount to refund, denominated in the session's asset. If omitted, the full remaining refundable amount is refunded.

reason, string

The reason for the refund.

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

An optional merchant-provided internal identifier for this refund, from the merchant's own system—not visible to the payer.

customerDisplay, OperationCustomerDisplay

Optional customer-facing display data for this refund, shown to the payer. Falls back to the session's orderCode when referenceCode is omitted.

Example request

{
  "source": {
    "accountId": "account_af2937b0-9846-4fe7-bfe9-ccc22d935114",
    "asset": "usdc"
  },
  "amount": "0.50",
  "reason": "Customer returned the item."
}

Response

Successfully created refund.

Refund required

A return of previously captured funds to the payer. Multiple partial refunds are allowed up to the total captured amount.

refundId, string

The unique identifier of the refund.

paymentSessionId, string

The ID of the payment session this refund belongs to.

source, union

The source from which the refund is funded. Can be a CDP account, an onchain address, or a Coinbase retail account.

status, 'pending' | 'succeeded' | 'failed'

The current status of the refund.

amount, string

A decimal representation of the refunded amount, denominated in the session's asset.

reason, string

The reason for the refund.

error, PaymentError

An error that occurred during a payment operation.

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 refund, from the merchant's own system—not visible to the payer. Present only when supplied on the create refund request.

customerDisplay, OperationCustomerDisplay

Customer-facing display data for this refund, shown to the payer. Present when supplied on the create refund request or when the session's orderCode fallback applies; otherwise omitted.

onchainTransactions, OnchainTransaction[]

The onchain transactions associated with this refund.

createdAt, string date-time

The UTC ISO 8601 timestamp at which the refund was created.

updatedAt, string date-time

The UTC ISO 8601 timestamp at which the refund was last updated.

Example response

{
  "refundId": "refund_82c879c1-84e1-44ed-a8c2-1ac239cf09ad",
  "paymentSessionId": "paymentSession_82c879c1-84e1-44ed-a8c2-1ac239cf09ad",
  "source": {
    "accountId": "account_af2937b0-9846-4fe7-bfe9-ccc22d935114",
    "asset": "usdc"
  },
  "status": "succeeded",
  "amount": "0.50",
  "reason": "Customer returned the item.",
  "onchainTransactions": [
    {
      "transactionHash": "0x012345678901234567890abcdef1234567890abcdef1234567890abcdef1234",
      "network": "base"
    }
  ],
  "metadata": {
    "customer_id": "cust_12345"
  },
  "createdAt": "2025-06-15T12:40:00.000Z",
  "updatedAt": "2025-06-15T12:41:00.000Z"
}

Changes

    • breaking

      added to the 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

    5 more changes in this revision