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

# Close Wallet

> Closes a user's sub-wallet, making it inactive for future transactions. The closure process may require approval 
depending on the sub-wallet type and business rules:
- Any remaining balance is handled according to the configured closure policy.


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

    | **Status**         | **Description**                                                                                                                                                |
    | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `SUCCESS`          | The wallet closure has been processed successfully and the sub-wallet is now inactive. All remaining balance has been handled according to the closure policy. |
    | `PENDING`          | The closure request has been accepted and is currently being processed.                                                                                        |
    | `APPROVAL_PENDING` | The closure request requires manual approval.                                                                                                                  |
  </Accordion>
</AccordionGroup>


## OpenAPI

````yaml openapi/ppi/ppi.yaml post /ppi/wallet/closure
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: Users
    description: Operations related to PPI users.
  - name: User KYC
    description: Operations related to user KYC verification.
  - name: Wallets
    description: Operations related to PPI wallets.
  - name: Beneficiaries
    description: Operations related to user beneficiaries.
  - name: Transfers
    description: Operations related to transfers.
paths:
  /ppi/wallet/closure:
    post:
      tags:
        - Wallets
      summary: Close Wallet
      description: >
        Closes a user's sub-wallet, making it inactive for future transactions.
        The closure process may require approval 

        depending on the sub-wallet type and business rules:

        - Any remaining balance is handled according to the configured closure
        policy.
      operationId: closeWallet
      parameters:
        - $ref: '#/components/parameters/global_x_api_version'
      requestBody:
        description: Request parameters to close a user's wallet.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WalletClosureRequest'
            examples:
              closureTransaction:
                summary: Wallet closure example
                description: Example of closing a user's sub-wallet.
                value:
                  closure_id: CLOSURE420984
                  user_id: USER827364
                  wallet_id: WALLET936721
                  cf_sub_wallet_id: '35246543210987654321'
                  remarks: Wallet Closure
                  notes:
                    example_key1: example_value1
                    example_key2: example_value2
      responses:
        '200':
          description: Success response for closing a wallet.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WalletClosureResponse'
              examples:
                SUCCESS_GIFT_WALLET:
                  summary: Successful closure of GIFT_WALLET
                  value:
                    closure_id: CLOSURE420984
                    user_id: USER827364
                    cf_closure_id: '8901234567890123456'
                    wallet_id: WALLET936721
                    sub_wallet:
                      cf_sub_wallet_id: '35246543210987654321'
                      name: Gift Wallet
                      type: GIFT_PPI
                      status: CLOSED
                      balance: 0
                      available_balance: 0
                      funds_on_hold: 0
                    status: SUCCESS
                    remarks: Wallet Closure
                    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 closure of CLOSED_WALLET
                  value:
                    closure_id: CLOSURE420984
                    user_id: USER827364
                    cf_closure_id: '8901234567890123456'
                    wallet_id: WALLET936721
                    sub_wallet:
                      cf_sub_wallet_id: '35246543210987654321'
                      name: Meal Wallet
                      type: CLOSED_LOOP_PPI
                      status: CLOSED
                      balance: 0
                      available_balance: 0
                      funds_on_hold: 0
                    status: SUCCESS
                    remarks: Wallet Closure
                    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 closure of SMALL_PPI_WALLET
                  value:
                    closure_id: CLOSURE420984
                    user_id: USER827364
                    cf_closure_id: '8901234567890123456'
                    wallet_id: WALLET936721
                    sub_wallet:
                      cf_sub_wallet_id: '35246543210987654321'
                      name: Meal Wallet
                      type: SMALL_PPI
                      status: CLOSED
                      balance: 0
                      available_balance: 0
                      funds_on_hold: 0
                    status: SUCCESS
                    remarks: Wallet Closure
                    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:
                closure_id_missing:
                  summary: Closure ID missing
                  value:
                    code: closure_id_missing
                    type: validation_error
                    message: closure_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
                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
                closure_id_value_invalid:
                  summary: Closure ID value is invalid
                  value:
                    code: closure_id_value_invalid
                    type: validation_error
                    message: closure_id value is invalid in the request
                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 or sub-wallet 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
        '409':
          description: Conflict - Closure already processed or sub-wallet already closed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StructuredErrorResponse'
              examples:
                duplicateClosure:
                  summary: Duplicate closure request
                  value:
                    code: closure_id_already_exists
                    type: validation_error
                    message: >-
                      Closure request with the same closure_id has already been
                      processed
                walletAlreadyClosed:
                  summary: Sub-wallet already closed
                  value:
                    code: sub_wallet_already_closed
                    type: validation_error
                    message: The specified sub-wallet is already closed
        '422':
          description: Unprocessable Entity - Business rule validation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StructuredErrorResponse'
              examples:
                activeTransactionsPending:
                  summary: Active transactions pending
                  value:
                    code: sub_wallet_transaction_pending
                    type: validation_error
                    message: Cannot close sub-wallet with pending transactions
        '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:
    WalletClosureRequest:
      type: object
      required:
        - closure_id
        - user_id
        - wallet_id
        - cf_sub_wallet_id
      properties:
        closure_id:
          type: string
          description: >-
            Unique identifier that you create to identify the closure
            transaction in your system. Only alphanumeric characters, periods
            (.), hyphens (-), and underscores (_) are allowed.
          example: CLOSURE420984
          minLength: 1
          maxLength: 50
        user_id:
          type: string
          description: >-
            Unique identifier for the user, as provided by you during PPI user
            creation. Only alphanumeric characters, periods (.), hyphens (-),
            and underscores (_) are allowed.
          example: USER827364
          minLength: 1
          maxLength: 50
        wallet_id:
          type: string
          description: >-
            Unique identifier for the wallet, as provided by you during wallet
            creation. Only alphanumeric characters, periods (.), hyphens (-),
            and underscores (_) are allowed.
          example: WALLET936721
          minLength: 1
          maxLength: 50
        cf_sub_wallet_id:
          type: string
          description: >-
            Unique identifier of the sub-wallet to be closed. Only numeric
            characters are allowed.
          example: '35246543210987654321'
          minLength: 1
          maxLength: 19
        remarks:
          type: string
          description: >-
            Additional remarks for the closure request. Alphanumeric and
            whitespaces are allowed. The maximum character limit is 60.
          example: Wallet Closure
          maxLength: 60
        notes:
          $ref: '#/components/schemas/Notes'
    WalletClosureResponse:
      type: object
      properties:
        closure_id:
          type: string
          description: >-
            Unique identifier for the closure transaction, as provided by you
            during the closure request.
          example: CLOSURE420984
        user_id:
          type: string
          description: >-
            Unique identifier for the user, as provided by you during PPI user
            creation.
          example: USER827364
        cf_closure_id:
          type: string
          description: >-
            Unique identifier for the closure transaction, generated by
            Cashfree.
          example: '8901234567890123456'
        wallet_id:
          type: string
          description: Primary wallet ID from which the sub-wallet is being closed.
          example: WALLET936721
        sub_wallet:
          $ref: '#/components/schemas/SubWallet'
        status:
          type: string
          description: >
            Status of the refund operation:

            - `SUCCESS`: Closure has been processed successfully.

            - `PENDING`: Closure is being processed and will be completed
            shortly

            - `APPROVAL_PENDING` : closure requires manual approval
          enum:
            - SUCCESS
            - PENDING
            - APPROVAL_PENDING
          example: SUCCESS
        remarks:
          type: string
          description: Remarks for the closure transaction.
          example: Wallet Closure
        notes:
          $ref: '#/components/schemas/Notes'
        initiated_at:
          type: string
          format: date-time
          description: Timestamp when the closure transaction was initiated.
          example: '2025-07-28T10:30:00Z'
        processed_at:
          type: string
          format: date-time
          nullable: true
          description: >-
            Timestamp when the closure transaction was processed. Null if still
            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. The following constraints apply:

        - Maximum 10 entries.

        - Keys: maximum 50 characters. Alphanumeric characters, underscores (_),
        periods (.), commas (,), single quotes ('), ampersands (&), hyphens (-),
        and spaces are allowed.

        - Values: maximum 200 characters. Same character set as keys.
      properties:
        example_key:
          type: string
          description: >-
            A note value. Maximum 200 characters. Alphanumeric characters,
            underscores (_), periods (.), commas (,), single quotes ('),
            ampersands (&), hyphens (-), and spaces are allowed.
          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
  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).

````