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

# Create Refund by Payment ID

> Use this API to create a refund for a specific payment transaction. This API allows merchants to process partial or full refunds for successful payment transactions.




## OpenAPI

````yaml /openapi/payments/flowwise.yaml post /payments/{payment_id}
openapi: 3.0.3
info:
  title: Flowwise Native API
  version: 1.0.0
  description: >
    Manage orders, payments, refunds, and customers using the Flowwise Native
    API.

    [Source](https://cashfree.atlassian.net/wiki/spaces/ORC/pages/1084032020/API+Documentation)
servers:
  - url: https://sandbox.flowwise.com/router
    description: Sandbox
  - url: https://app.flowwise.com/router
    description: Production
security:
  - ApiKeyAuth: []
    ApiSecret: []
paths:
  /payments/{payment_id}:
    post:
      summary: Create Refund by Payment ID
      description: >
        Use this API to create a refund for a specific payment transaction. This
        API allows merchants to process partial or full refunds for successful
        payment transactions.
      parameters:
        - $ref: '#/components/parameters/PaymentId'
      requestBody:
        required: true
        description: Request parameters to create a new refund.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RefundRequest'
            example:
              refund_id: refund_summer_fashion_001_size_issue
              refund_amount: 1149.75
              refund_type: MERCHANT_INITIATED
              refund_note: >-
                Customer requested size exchange - partial refund for size
                difference
      responses:
        '200':
          description: Success response for refund creation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RefundResponse'
              example:
                payment_id: pay_summer_fashion_001_upi
                order_id: order_summer_fashion_001
                refund_id: refund_summer_fashion_001_size_issue
                refund_amount: 1149.75
                refund_status: SUCCESS
                refund_type: MERCHANT_INITIATED
                refund_note: >-
                  Customer requested size exchange - partial refund for size
                  difference
                refund_message: >-
                  Refund processed successfully. Amount will be credited within
                  5-7 business days
                gateway_details:
                  refund_reference_id: RFD434512345678901234
                  refund_utr: REF434512345678
        '400':
          description: Bad Request - Invalid refund request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: Invalid refund amount or refund exceeds payment amount
                code: invalid_refund
                type: validation_error
        '401':
          description: Unauthorized - Invalid or missing authentication credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: Invalid API credentials provided
                code: unauthorized
                type: authentication_error
        '404':
          description: Not Found - Payment not found or not eligible for refund
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: Payment not found or not eligible for refund
                code: payment_not_found
                type: resource_error
        '500':
          description: Internal Server Error - Refund processing failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: Refund processing failed due to server error
                code: refund_failed
                type: server_error
      security:
        - ApiKeyAuth: []
          ApiSecret: []
components:
  parameters:
    PaymentId:
      name: payment_id
      in: path
      required: true
      description: Unique identifier for the payment transaction.
      schema:
        type: string
        example: pay_summer_fashion_001_upi
  schemas:
    RefundRequest:
      type: object
      required:
        - refund_id
        - refund_amount
        - refund_type
      properties:
        refund_id:
          type: string
          description: Unique identifier for the refund transaction.
          example: refund_summer_fashion_001_size_issue
        refund_amount:
          type: number
          description: Amount to be refunded to the customer.
          example: 1149.75
        refund_type:
          type: string
          enum:
            - MERCHANT_INITIATED
            - AUTO_REFUND
          description: Type of refund being processed.
          example: MERCHANT_INITIATED
        refund_note:
          type: string
          description: Additional notes or reason for the refund.
          example: >-
            Customer requested size exchange - partial refund for size
            difference
    RefundResponse:
      type: object
      properties:
        payment_id:
          type: string
          description: Unique identifier for the original payment transaction.
          example: pay_summer_fashion_001_upi
        order_id:
          type: string
          description: Unique identifier for the associated order.
          example: order_summer_fashion_001
        refund_id:
          type: string
          description: Unique identifier for the refund transaction.
          example: refund_summer_fashion_001_size_issue
        refund_amount:
          type: number
          description: Amount that was refunded to the customer.
          example: 1149.75
        refund_status:
          type: string
          description: Current status of the refund transaction.
          example: SUCCESS
        refund_type:
          type: string
          description: Type of refund that was processed.
          example: MERCHANT_INITIATED
        refund_note:
          type: string
          description: Additional notes or reason for the refund.
          example: >-
            Customer requested size exchange - partial refund for size
            difference
        refund_message:
          type: string
          description: Message describing the refund status or outcome.
          example: >-
            Refund processed successfully. Amount will be credited within 5-7
            business days
        gateway_details:
          type: object
          description: Details from the payment gateway regarding the refund.
          properties:
            refund_reference_id:
              type: string
              description: Reference identifier for the refund from the gateway.
              example: RFD434512345678901234
            refund_utr:
              type: string
              nullable: true
              description: Unique Transaction Reference number for the refund.
              example: REF434512345678
    ErrorResponse:
      type: object
      description: Error response structure returned when an API request fails.
      properties:
        message:
          type: string
          description: Human-readable error message describing what went wrong.
        code:
          type: string
          description: Machine-readable error code for programmatic handling.
        type:
          type: string
          description: Category or type of error that occurred.
      required:
        - message
        - code
        - type
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-client-id
      description: >-
        Client app ID. You can find your app ID in the [Merchant
        Dashboard](https://merchant.cashfree.com/auth/login/pg/developers/api-keys?env=prod).
    ApiSecret:
      type: apiKey
      in: header
      name: x-client-secret
      description: >-
        Client secret key. You can find your secret key in the [Merchant
        Dashboard](https://merchant.cashfree.com/auth/login/pg/developers/api-keys?env=prod).

````