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

# Refund

> The Refund APIs allow merchants to process refunds for previously captured payments



## OpenAPI

````yaml POST /payments/merchant/refund
openapi: 3.0.1
info:
  title: xPay API Store
  description: ''
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.xpaycheckout.com
security:
  - basicAuth: []
paths:
  /payments/merchant/refund:
    post:
      description: >-
        The Refund APIs allow merchants to process refunds for previously
        captured payments
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        description: Refund API
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/refund'
        required: true
      responses:
        '200':
          description: Refund API response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/refund-response'
        '400':
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      schema:
        type: string
        maxLength: 255
        pattern: ^[a-zA-Z0-9\-_:\.]+$
      description: >-
        A unique key for making the request idempotent. Must match pattern:
        `^[a-zA-Z0-9\-_:\.]+$`. See [Idempotent
        Requests](/developer-resources/idempotency) for more details.
      example: KG5LxwFBepaKHyUD
  schemas:
    refund:
      required:
        - xIntentId
      type: object
      properties:
        xIntentId:
          description: Unique identifier of the intent
          type: string
          example: in_fooBOwYsaK50AEfK
        amount:
          description: >-
            The amount you want to refund, specified in the smallest unit of the
            currency (for example, cents for USD, paise for INR). 


            - If you want to issue a partial refund, provide the amount you wish
            to refund here. For example, if the original payment was $100 (i.e.,
            10000 cents), and you want to refund $20, you would enter 2000.

            - If you leave this field blank, the full payment amount will be
            refunded automatically.
          type: string
          example: '200'
        refundReferenceId:
          description: Your identifier for the refund
          type: string
          example: re123
    refund-response:
      type: object
      properties:
        refundId:
          type: string
          description: Unique identifier of the refund
          example: rf_fooBOwYsaK50AEaJ
        intentId:
          type: string
          description: Unique identifier of the payment intent
          example: in_fooBOwYsaK50AEfK
        amount:
          $ref: '#/components/schemas/Amount'
        currency:
          $ref: '#/components/schemas/Currency'
        refundedAt:
          $ref: '#/components/schemas/RefundedAt'
        refundReferenceId:
          description: Your identifier for the refund
          type: string
          example: re123
      required:
        - refundId
        - intentId
        - amount
        - currency
        - refundedAt
    Error:
      required:
        - errorCode
        - errorDescription
      type: object
      properties:
        errorCode:
          type: string
          example: bad_request
        errorDescription:
          type: string
          example: Failed to read request
    Amount:
      type: integer
      format: int64
      description: >-
        The amount in lowest count unit. e.g.: For USD 1, amount is 100
        representing 100 cents (The minimum amount should be greater than 1 USD)
      example: 2000
    Currency:
      type: string
      description: >-
        Three letter abbreviation of the currency. Refer [supported
        currencies](/get-started/currencies-supported)
      example: USD
    RefundedAt:
      type: integer
      format: int64
      description: Epoch timestamp in milliseconds of when the refund was processed
      example: 1727340330123
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic

````