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

# Cancel Refund

> This endpoint cancels an already existing refund object

<Danger>
  A request to cancel the refund can only be made if the refund object is in the `initiated` state. If the refund is in any other state, the API call will result in an error.
</Danger>


## OpenAPI

````yaml post /v3/refund/{id}/cancel
openapi: 3.1.0
info:
  title: sandbox
  version: '3'
servers:
  - url: https://service-sandbox.tazapay.com
security:
  - sec0: []
paths:
  /v3/refund/{id}/cancel:
    post:
      summary: Cancel Refund
      description: This endpoint cancels an already existing refund object
      operationId: cancel-refund
      parameters:
        - name: id
          in: path
          description: ID of the existing refund object to be cancelled
          schema:
            type: string
          required: true
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Result:
                  value:
                    status: success
                    message: refund cancelled successfully.
                    data:
                      id: rfd_afiuabfia23wifaiofnioa12nfianff
                      object: refund
                      payin: chk_cirsp2sl4ar024j0akj0
                      amount: 5000
                      currency: USD
                      customer_receives: {}
                      payment_attempt: pat_ahbfiuahfiuaiofnioain
                      reason: Damaged Goods
                      metadata: {}
                      status: cancelled
                      status_description: ''
                      webhook_url: https://mystore.webhook.tazapay.refund/
                      created_at: '2023-07-23 23:59:56'
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: >-
                      Indicates whether the refund creation request was
                      successful.
                  message:
                    type: string
                    description: Describes the outcome of the refund operation.
                  data:
                    $ref: '#/components/schemas/RefundData'
                  balance_transaction:
                    type: string
                    description: Balance transaction associated with the refund
                  reference_id:
                    type: string
                    description: Reference id linked to the refund
                  holding_currency:
                    type: string
                    description: Holding currency to which the refund is credited
      deprecated: false
components:
  schemas:
    RefundData:
      type: object
      description: Contains detailed information about a refund.
      properties:
        id:
          type: string
          description: Unique identifier for the refund object.
        object:
          type: string
          description: Type of object returned, typically 'refund'.
        payin:
          type: string
          description: Unique identifier of the payin linked to this refund.
        amount:
          type: integer
          description: Refund amount in the smallest currency unit (e.g., cents).
          default: 0
        currency:
          type: string
          description: Currency of the refund (ISO 4217 format).
        customer_receives:
          type: object
          description: >-
            Amount and currency the customer will receive after processing the
            refund.
          properties:
            currency:
              type: string
              description: Currency in which the customer will receive the refund.
            amount:
              type: integer
              description: >-
                Amount that the customer will receive after processing the
                refund.
        payment_attempt:
          type: string
          description: >-
            Unique identifier of the payment attempt associated with this
            refund.
        reason:
          type: string
          description: Reason provided for initiating the refund.
        metadata:
          $ref: '#/components/schemas/Metadata'
        status:
          type: string
          description: >-
            Current status of the refund process (e.g., pending, processing,
            succeeded, failed).
        status_description:
          type: string
          description: Detailed explanation of the current refund status.
        webhook_url:
          type: string
          description: Webhook URL to which refund updates will be sent.
        created_at:
          type: string
          description: Timestamp indicating when the refund was created (ISO 8601 format).
        balance_transaction:
          type: string
          description: Balance transaction associated with the refund.
        reference_id:
          type: string
          description: Reference id linked to the refund.
        holding_currency:
          type: string
          description: Holding currency to which the refund is credited.
    Metadata:
      type: object
      description: Custom metadata key-value pairs attached to the object
      additionalProperties:
        type: string
      nullable: true
  securitySchemes:
    sec0:
      type: http
      scheme: basic

````