> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cdp.coinbase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Refund payment

> Refund funds using the payment ID. This simplified endpoint fetches payment details from the database.



## OpenAPI

````yaml api-reference/payment-acceptance/payment-acceptance-api.yaml post /api/v1/payments/{paymentId}/refund
openapi: 3.1.1
info:
  title: Coinbase Commerce API
  description: API for processing payments on the PaymentEscrow smart contract protocol.
  version: v0.0.1
servers:
  - url: https://payments.coinbase.com
security: []
tags:
  - name: Payments
    description: >-
      Endpoints focused on handling payment transactions.


      This includes operations for authorizing funds without immediate capture,
      and capturing previously authorized funds directly via the PaymentEscrow
      smart contract protocol. The endpoints help ensure secure and controlled
      payment processing, including verifying signatures, and updating payment
      statuses.
  - name: Rewards
    description: >-
      Endpoints for managing reward operations.


      These endpoints allow you to independently allocate, distribute, send, and
      deallocate rewards on previously successful payment operations.
  - name: Campaigns
    description: >-
      Endpoints for managing reward campaigns.


      Create and manage campaigns that integrate with the Flywheel smart
      contract to provide reward functionality. Campaigns allow merchants to
      define reward structures with customizable parameters including reward
      percentages and maximum limits.
  - name: coinbase.engine.operator_api.v1.OperatorApiService
paths:
  /api/v1/payments/{paymentId}/refund:
    post:
      tags:
        - Payments
      summary: Refund payment
      description: >-
        Refund funds using the payment ID. This simplified endpoint fetches
        payment details from the database.
      operationId: OperatorApiService_PostPaymentRefundById
      parameters:
        - schema:
            type: string
          name: paymentId
          description: The unique identifier of the payment to refund.
          in: path
          required: true
        - schema:
            type: string
          name: x-idempotency-key
          description: Unique identifier to ensure request idempotency
          in: header
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                amount:
                  type: string
                  description: >-
                    Amount to refund (must be less than or equal to the
                    captured/charged amount).
                  title: Amount
                  examples:
                    - '50.00'
                metadata:
                  type: object
                  description: >-
                    Metadata for the payment operation that will be returned in
                    the webhook.
                  title: Metadata
                  examples:
                    - key: value
              description: Request payload for refunding a payment using the payment ID.
              title: PostPaymentRefundByIdRequest
              required:
                - amount
              examples:
                - paymentId: pm_abc123
                  amount: '50.00'
        required: true
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                type: object
                properties:
                  operationId:
                    type: string
                    description: Identifier for the payment operation.
                    title: Operation Id
                    examples:
                      - op-2341434
                description: Response payload for payment refund requests.
                title: PostPaymentRefundResponse
                required:
                  - operationId
                examples:
                  - operationId: op-2341434
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    format: int32
                  message:
                    type: string
                  details:
                    type: array
                    items:
                      type: object
                      properties:
                        '@type':
                          type: string
                      additionalProperties: {}
      security:
        - Bearer: []
components:
  securitySchemes:
    Bearer:
      type: apiKey
      description: >-
        Authorization header using the Bearer scheme. Learn more about JWT
        tokens in the Coinbase Developer Portal.
      name: Authorization
      in: header

````