> ## 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.

# Refund Debit Wallet

> Processes a refund for a previously debited transaction from a user's sub-wallet. The refund operation 
credits the amount back to the user's sub-wallet, effectively reversing a debit transaction:
- `GIFT_PPI`: Credits amount back to gift wallet.
- `CLOSED_LOOP_PPI` and `SMALL_PPI`: Credits amount back to the respective sub-wallet.
- Refund amount cannot exceed the original debit amount.


<AccordionGroup>
  <Accordion title="Refund Status Descriptions" defaultOpen={true}>
    The following table outlines the possible status values returned in the refund response:

    | **Status** | **Description**                                                                                                                                                                    |
    | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `SUCCESS`  | The refund has been processed successfully and the amount has been credited back to the user's sub-wallet. The transaction is complete.                                            |
    | `PENDING`  | The refund request has been accepted and is currently being processed. The amount will be credited to the wallet shortly. Check the status later or wait for webhook notification. |
  </Accordion>
</AccordionGroup>


## OpenAPI

````yaml /openapi/ppi/ppi.yaml post /ppi/wallet/refund
openapi: 3.0.3
info:
  title: PPI Wallet API
  description: >-
    API for managing PPI (Prepaid Payment Instrument) wallets and sub-wallets,
    including credit and debit operations.
  version: 1.0.0
  contact:
    name: PPI Service Team
    email: support@cashfree.com
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
servers:
  - url: https://api.cashfree.com
    description: Production server.
  - url: https://sandbox.cashfree.com
    description: Sandbox server.
security:
  - XClientID: []
    XClientSecret: []
tags:
  - name: Wallet Management
    description: Operations related to PPI wallet management.
  - name: User Management
    description: Operations related to user management within the PPI system.
  - name: Beneficiary Management
    description: Operations related to beneficiary management for users.
  - name: KYC Management
    description: Operations related to KYC (Know Your Customer) management.
  - name: Transfers
    description: Operations related to transfer.
paths:
  /ppi/wallet/refund:
    post:
      tags:
        - Wallet Management
      summary: Refund Debit Wallet
      description: >
        Processes a refund for a previously debited transaction from a user's
        sub-wallet. The refund operation 

        credits the amount back to the user's sub-wallet, effectively reversing
        a debit transaction:

        - `GIFT_PPI`: Credits amount back to gift wallet.

        - `CLOSED_LOOP_PPI` and `SMALL_PPI`: Credits amount back to the
        respective sub-wallet.

        - Refund amount cannot exceed the original debit amount.
      operationId: refundWallet
      parameters:
        - $ref: '#/components/parameters/global_x_api_version'
      requestBody:
        description: >-
          Request parameters to refund a previous debit transaction back to the
          user's wallet.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WalletRefundRequest'
            examples:
              refundTransaction:
                summary: Wallet refund example
                description: Example of refunding a previously debited transaction.
                value:
                  refund_id: REFUND420984
                  debit_id: DEBIT1244
                  user_id: USER827364
                  wallet_id: WALLET936721
                  cf_sub_wallet_id: '35246543210987654321'
                  amount: 100.5
                  remarks: Wallet Refund
                  notes:
                    example_key1: example_value1
                    example_key2: example_value2
      responses:
        '200':
          description: Success response for refunding a wallet debit.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WalletRefundResponse'
              examples:
                SUCCESS_GIFT_WALLET:
                  summary: Successful refund to GIFT_WALLET
                  value:
                    refund_id: REFUND420984
                    debit_id: DEBIT1244
                    cf_refund_id: '8901234567890123456'
                    user_id: USER827364
                    wallet_id: WALLET936721
                    sub_wallet:
                      cf_sub_wallet_id: '35246543210987654321'
                      name: Gift Wallet
                      type: GIFT_PPI
                      status: ACTIVE
                      balance: 1500.75
                      available_balance: 1500.75
                      funds_on_hold: 0
                    status: SUCCESS
                    refunded_gift_codes:
                      - code: GHO-8900-HKDH-8899
                        amount_refunded: 50
                        value: 150
                        expiry: '2026-07-28T10:30:00Z'
                      - code: ABC-1234-WXYZ-5678
                        amount_refunded: 50.5
                        value: 200.5
                        expiry: '2026-12-31T23:59:59Z'
                    amount: 100.5
                    remarks: Wallet Refund
                    notes:
                      example_key1: example_value1
                      example_key2: example_value2
                    initiated_at: '2025-07-28T10:30:00Z'
                    processed_at: '2025-07-28T10:30:00Z'
                SUCCESS_CLOSED_WALLET:
                  summary: Successful refund to CLOSED_WALLET
                  value:
                    refund_id: REFUND420984
                    debit_id: DEBIT1244
                    cf_refund_id: '8901234567890123456'
                    user_id: USER827364
                    wallet_id: WALLET936721
                    sub_wallet:
                      cf_sub_wallet_id: '35246543210987654321'
                      name: Meal Wallet
                      type: CLOSED_LOOP_PPI
                      status: ACTIVE
                      balance: 1500.75
                      available_balance: 1500.75
                      funds_on_hold: 0
                    status: SUCCESS
                    amount: 100.5
                    remarks: Wallet Refund
                    notes:
                      example_key1: example_value1
                      example_key2: example_value2
                    initiated_at: '2025-07-28T10:30:00Z'
                    processed_at: '2025-07-28T10:30:00Z'
                SUCCESS_SMALL_PPI_WALLET:
                  summary: Successful refund to SMALL_PPI_WALLET
                  value:
                    refund_id: REFUND420984
                    debit_id: DEBIT1244
                    cf_refund_id: '8901234567890123456'
                    user_id: USER827364
                    wallet_id: WALLET936721
                    sub_wallet:
                      cf_sub_wallet_id: '35246543210987654321'
                      name: Meal Wallet
                      type: SMALL_PPI
                      status: ACTIVE
                      balance: 1500.75
                      available_balance: 1500.75
                      funds_on_hold: 0
                    status: SUCCESS
                    amount: 100.5
                    remarks: Wallet Refund
                    notes:
                      example_key1: example_value1
                      example_key2: example_value2
                    initiated_at: '2025-07-28T10:30:00Z'
                    processed_at: '2025-07-28T10:30:00Z'
        '400':
          description: Bad request - Invalid input parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StructuredErrorResponse'
              examples:
                refund_id_missing:
                  $ref: '#/components/examples/refund_id_missing'
                auth_mode_missing:
                  $ref: '#/components/examples/auth_mode_missing'
                auth_mode_invalid:
                  $ref: '#/components/examples/auth_mode_invalid'
                auth_data_missing:
                  $ref: '#/components/examples/auth_data_missing'
                auth_notification_modes_missing:
                  $ref: '#/components/examples/auth_notification_modes_missing'
                auth_notification_modes_too_many:
                  $ref: '#/components/examples/auth_notification_modes_too_many'
                auth_notification_modes_null:
                  $ref: '#/components/examples/auth_notification_modes_null'
                auth_notification_modes_duplicate:
                  $ref: '#/components/examples/auth_notification_modes_duplicate'
                debit_id_missing:
                  summary: Debit ID missing
                  value:
                    code: debit_id_missing
                    type: validation_error
                    message: debit_id is missing in the request
                user_id_missing:
                  summary: User ID missing
                  value:
                    code: user_id_missing
                    type: validation_error
                    message: user_id is missing in the request
                wallet_id_missing:
                  summary: Wallet ID missing
                  value:
                    code: wallet_id_missing
                    type: validation_error
                    message: wallet_id is missing in the request
                cf_sub_wallet_id_missing:
                  summary: Sub-wallet ID missing
                  value:
                    code: cf_sub_wallet_id_missing
                    type: validation_error
                    message: cf_sub_wallet_id is missing in the request
                amount_missing:
                  summary: Amount missing
                  value:
                    code: amount_missing
                    type: validation_error
                    message: amount is missing in the request
                userWalletMismatch:
                  summary: User-Wallet mismatch
                  value:
                    message: wallet does not belong to provided user
                    code: wallet_id_value_invalid
                    type: validation_error
                userSubWalletMismatch:
                  summary: User-SubWallet mismatch
                  value:
                    message: sub-wallet does not belong to provided user
                    code: sub_wallet_id_value_invalid
                    type: validation_error
                cf_sub_wallet_id_invalid:
                  summary: Sub-wallet ID is Invalid
                  value:
                    code: cf_sub_wallet_id_invalid
                    type: validation_error
                    message: cf_sub_wallet_id is invalid in the request
                refund_id_value_invalid:
                  summary: Refund ID value is invalid
                  value:
                    code: refund_id_value_invalid
                    type: validation_error
                    message: refund_id value is invalid in the request
                debit_id_value_invalid:
                  summary: Debit ID value is invalid
                  value:
                    code: debit_id_value_invalid
                    type: validation_error
                    message: debit_id value is invalid in the request
                invalidAmount:
                  summary: Invalid amount format
                  value:
                    code: amount_value_invalid
                    type: validation_error
                    message: amount should be a positive number
                missingClientId:
                  summary: Missing client ID
                  value:
                    message: x-client-id is missing in the request
                    code: x-client-id_missing
                    type: validation_error
                missingClientSecret:
                  summary: Missing client secret
                  value:
                    message: x-client-secret is missing in the request
                    code: x-client-secret_missing
                    type: validation_error
        '401':
          $ref: '#/components/responses/Response401'
        '403':
          description: Forbidden - Access denied.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StructuredErrorResponse'
              examples:
                ipNotWhitelisted:
                  summary: IP not whitelisted
                  value:
                    code: ip_not_whitelisted
                    type: authentication_error
                    message: Authentication error (IP not whitelisted)
        '404':
          description: Not found - Wallet, sub-wallet or debit transaction not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StructuredErrorResponse'
              examples:
                walletNotFound:
                  summary: Wallet not found
                  value:
                    code: wallet_id_not_found
                    type: invalid_request_error
                    message: The specified wallet_id does not exist
                subWalletNotFound:
                  summary: Sub-wallet not found
                  value:
                    code: sub_wallet_id_not_found
                    type: invalid_request_error
                    message: The specified cf_sub_wallet_id does not exist
                debitTransactionNotFound:
                  summary: Debit transaction not found
                  value:
                    code: debit_id_not_found
                    type: invalid_request_error
                    message: The specified debit_id does not exist
        '409':
          description: Conflict - Refund already processed or invalid refund request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StructuredErrorResponse'
              examples:
                duplicateRefund:
                  summary: Duplicate refund request
                  value:
                    code: refund_id_already_exists
                    type: validation_error
                    message: >-
                      Refund request with the same refund_id has already been
                      processed
                debitAlreadyRefunded:
                  summary: Debit transaction already fully refunded
                  value:
                    code: debit_already_refunded
                    type: validation_error
                    message: >-
                      The specified debit transaction has already been fully
                      refunded
        '422':
          description: Unprocessable Entity - Business rule validation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StructuredErrorResponse'
              examples:
                refundAmountExceeded:
                  summary: Refund amount exceeds available refund amount
                  value:
                    code: refund_amount_exceeded
                    type: validation_error
                    message: >-
                      Refund amount exceeds the available refund amount for this
                      debit transaction
                invalidDebitStatus:
                  summary: Invalid debit transaction status for refund
                  value:
                    code: invalid_debit_status
                    type: validation_error
                    message: >-
                      Debit transaction must be in SUCCESS status to be eligible
                      for refund
        '429':
          description: Too Many Requests - Rate limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StructuredErrorResponse'
              examples:
                rateLimitExceeded:
                  summary: Rate limit exceeded
                  value:
                    code: rate_limit_exceeded
                    type: rate_limit_error
                    message: Rate limit exceeded. Please try again after some time
        '500':
          $ref: '#/components/responses/Response500'
      security:
        - XClientID: []
          XClientSecret: []
components:
  parameters:
    global_x_api_version:
      description: API version to be used. Format is in YYYY-MM-DD.
      name: x-api-version
      in: header
      required: true
      schema:
        type: string
        default: '2025-11-01'
        example: '2025-11-01'
      example: '2025-11-01'
  schemas:
    WalletRefundRequest:
      type: object
      required:
        - refund_id
        - debit_id
        - user_id
        - wallet_id
        - cf_sub_wallet_id
        - amount
      properties:
        refund_id:
          type: string
          description: >-
            Unique identifier that you create to identify the refund transaction
            in your system. Maximum 50 characters. Only alphanumeric characters,
            periods (.), hyphens (-), and underscores (_) are allowed.
          example: REFUND420984
          minLength: 1
          maxLength: 50
        debit_id:
          type: string
          description: >-
            Unique identifier of the original debit transaction for which the
            refund is being initiated.
          example: DEBIT1244
          minLength: 1
          maxLength: 50
        user_id:
          type: string
          description: >-
            Unique identifier for the user, as provided by you during PPI user
            creation.
          example: USER827364
          minLength: 1
          maxLength: 50
        wallet_id:
          type: string
          description: >-
            Unique identifier for the wallet, as provided by you during wallet
            creation.
          example: WALLET936721
          minLength: 1
          maxLength: 50
        cf_sub_wallet_id:
          type: string
          description: >-
            Unique identifier of the sub-wallet from which the original debit
            was made and to which the refund will be credited.
          example: '35246543210987654321'
          minLength: 1
          maxLength: 50
        amount:
          type: number
          format: double
          description: >-
            Amount to refund. Decimal values are allowed. The amount should be
            greater than 0 and cannot exceed the original debit amount or the
            remaining refundable amount.
          example: 100.5
          minimum: 0.01
        remarks:
          type: string
          description: >-
            Additional remarks for the refund request. Alphanumeric and
            whitespaces are allowed. The maximum character limit is 500.
          example: Wallet Refund
          maxLength: 500
        notes:
          $ref: '#/components/schemas/Notes'
    WalletRefundResponse:
      type: object
      properties:
        refund_id:
          type: string
          description: >-
            Unique identifier for the refund transaction, as provided by you
            during the refund request.
          example: REFUND420984
        debit_id:
          type: string
          description: >-
            Unique identifier of the original debit transaction for which this
            refund was initiated.
          example: DEBIT1244
        cf_refund_id:
          type: string
          description: Unique identifier for the refund transaction, generated by Cashfree.
          example: '8901234567890123456'
        user_id:
          type: string
          description: >-
            Unique identifier for the user, as provided by you during PPI user
            creation.
          example: USER827364
        wallet_id:
          type: string
          description: Primary wallet ID to which the refund amount has been credited.
          example: WALLET936721
        sub_wallet:
          $ref: '#/components/schemas/SubWallet'
        status:
          type: string
          description: >
            Status of the refund operation:

            - `SUCCESS`: Refund has been processed successfully and amount
            credited to wallet

            - `PENDING`: Refund is being processed and will be credited shortly
          enum:
            - SUCCESS
            - PENDING
          example: SUCCESS
        refunded_gift_codes:
          type: array
          description: >-
            List of gift codes that were refunded in the transaction. This is
            applicable only for GIFT_PPI type wallets and when the refund is
            successful.
          items:
            $ref: '#/components/schemas/RefundedGiftCode'
        amount:
          type: number
          format: double
          description: Amount that was refunded to the wallet.
          example: 100.5
        remarks:
          type: string
          description: Remarks for the refund transaction.
          example: Wallet Refund
        notes:
          $ref: '#/components/schemas/Notes'
        initiated_at:
          type: string
          format: date-time
          description: Timestamp when the refund transaction was initiated.
          example: '2025-07-28T10:30:00Z'
        processed_at:
          type: string
          format: date-time
          nullable: true
          description: >-
            Timestamp when the refund transaction was processed. Will be null if
            status is PENDING.
          example: '2025-07-28T10:30:00Z'
    StructuredErrorResponse:
      type: object
      properties:
        type:
          type: string
          description: A broad category of the error.
          example: internal_error
        code:
          type: string
          description: A machine-readable error code specific to the issue.
          example: internal_server_error
        message:
          type: string
          description: >-
            A message providing more details about the error, dynamic based on
            the specific issue.
          example: Internal server error
    Notes:
      type: object
      description: >-
        Optional key-value pairs for any extra information. Keys and values must
        be strings.
      properties:
        example_key:
          type: string
          description: value of the note
          example: example_value
    SubWallet:
      type: object
      properties:
        cf_sub_wallet_id:
          type: string
          description: >-
            Unique identifier for the sub-wallet provided in response while
            creating the wallet.
          example: '5432109876543210987'
        name:
          type: string
          description: Name for the sub-wallet.
          example: Gift Wallet
        type:
          type: string
          description: Type of the sub-wallet.
          example: GIFT_PPI
        status:
          type: string
          description: Status of the sub-wallet.
          example: ACTIVE
        balance:
          type: number
          format: double
          description: Current balance of the sub-wallet.
          example: 1500.75
        available_balance:
          type: number
          format: double
          description: Available balance in the sub-wallet.
          example: 1500.75
        funds_on_hold:
          type: number
          format: double
          description: Funds on hold in the sub-wallet.
          example: 0
    RefundedGiftCode:
      type: object
      properties:
        code:
          type: string
          description: Unique identifier for the gift code.
          example: GIFT-2025-XYZ133
        amount_refunded:
          type: number
          format: double
          description: Amount refunded to the gift code.
          example: 100
        value:
          type: number
          format: double
          description: Total value of the gift code.
          example: 100
        expiry:
          type: string
          format: date-time
          description: Expiry date of the gift code.
          example: '2026-07-28T10:30:00Z'
  examples:
    refund_id_missing:
      summary: Refund ID missing
      value:
        code: refund_id_missing
        type: validation_error
        message: refund_id is missing in the request
    auth_mode_missing:
      summary: auth.mode missing
      value:
        code: auth_mode_missing
        type: validation_error
        message: auth.mode is required
    auth_mode_invalid:
      summary: auth.mode invalid
      value:
        code: auth_mode_invalid
        type: validation_error
        message: only OTP_VERIFICATION mode is supported
    auth_data_missing:
      summary: auth.data missing for OTP_VERIFICATION
      value:
        code: auth_data_missing
        type: validation_error
        message: auth.data is required for OTP_VERIFICATION
    auth_notification_modes_missing:
      summary: auth.data.notification_modes missing or empty
      value:
        code: auth_notification_modes_missing
        type: validation_error
        message: >-
          auth.data.notification_modes must contain at least one channel for
          OTP_VERIFICATION
    auth_notification_modes_too_many:
      summary: auth.data.notification_modes too many entries
      value:
        code: auth_notification_modes_too_many
        type: validation_error
        message: auth.data.notification_modes must contain at most 5 entries
    auth_notification_modes_null:
      summary: auth.data.notification_modes contains null
      value:
        code: auth_notification_modes_null
        type: validation_error
        message: auth.data.notification_modes cannot contain null entries
    auth_notification_modes_duplicate:
      summary: auth.data.notification_modes contains duplicates
      value:
        code: auth_notification_modes_duplicate
        type: validation_error
        message: auth.data.notification_modes must not contain duplicates
  responses:
    Response401:
      description: Unauthorised - Invalid or missing authentication.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/StructuredErrorResponse'
          examples:
            invalidCredentials:
              summary: Invalid client credentials
              value:
                code: authentication_failed
                type: authentication_error
                message: Invalid client ID and client secret combination
    Response500:
      description: Internal server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/StructuredErrorResponse'
          examples:
            internalError:
              summary: Internal server error
              value:
                code: internal_server_error
                type: internal_error
                message: An internal error occurred while processing the request
  securitySchemes:
    XClientID:
      type: apiKey
      in: header
      name: x-client-id
      description: >-
        Your unique client identifier issued by Cashfree. You can find this in
        your [Merchant
        Dashboard](https://merchant.cashfree.com/merchants/landing?env=prod).
    XClientSecret:
      type: apiKey
      in: header
      name: x-client-secret
      description: >-
        The secret key associated with your client ID. Use this to authenticate
        your API requests. You can find this in your [Merchant
        Dashboard](https://merchant.cashfree.com/merchants/landing?env=prod).

````