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

# Initiate Refund

> To initiate a refund of an existing paid transaction back to source

<Note>
  **Not all the payment methods support refunds!**

  Depending on the payment method, Tazapay may not be able to process refunds. For more info, read our [FAQ](https://support.tazapay.com/what-payment-methods-are-unsupported-for-refunds)
</Note>

* For refunding a payment made by Promptpay, WeChat, Linepay, Shopeepay and Truemoney in Thailand, the customer's phone number is required. You can choose to pass it to Tazapay in the customer\_details field of the checkout API. You can also use the Update Customer endpoint to attach the phone number to an existing customer you want to refund.


## OpenAPI

````yaml post /v3/refund
openapi: 3.1.0
info:
  title: sandbox
  version: '3'
servers:
  - url: https://service-sandbox.tazapay.com
security:
  - sec0: []
paths:
  /v3/refund:
    post:
      summary: Initiate Refund
      description: To initiate a refund of an existing paid transaction back to source
      operationId: refund-api
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - payin
              properties:
                payin:
                  type: string
                  description: ID of the payin for which refund is being created
                amount:
                  type: integer
                  description: >-
                    Amount to be refunded. If omitted, the request will be
                    registered for a refund of the full transaction amount. For
                    decimal handling for various currencies, refer to <a
                    href="/API-Reference/appendix/Decimal-Currencies"
                    target="_blank"> the guide here</a>
                  format: int32
                currency:
                  type: string
                  description: Three-letter ISO currency code in lowercase
                reason:
                  type: string
                  description: Reason for the refund
                payment_attempt:
                  type: string
                  description: >-
                    ID of the payment Attempt for which the refund is being
                    created
                metadata:
                  $ref: '#/components/schemas/MetadataInput'
                customer_details:
                  $ref: '#/components/schemas/RefundCustomerDetails'
            examples:
              Request Example:
                value:
                  payin: chk_cirsp2sl4ar024j0akj0
                  amount: 90000
                  currency: USD
                  reason: Customer Return
                  webhook_url: https://mystore.webhook.tazapay.refund/
      responses:
        '200':
          description: '200'
          content:
            application/json:
              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'
        '202':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  message:
                    type: string
                  data:
                    $ref: '#/components/schemas/RefundData'
              examples:
                Accepted:
                  summary: Accepted
                  value:
                    status: success
                    message: refund created successfully
                    data:
                      id: rfd_afiuabfia23wifaiofnioa12nfianf
                      object: refund
                      payin: chk_cirsp2sl4ar024j0akj0
                      amount: 90000
                      currency: USD
                      customer_receives:
                        currency: ''
                        amount: null
                      payment_attempt: pat_ahbfiuahfiuaiofnioain
                      reason: Customer Returns
                      metadata: {}
                      status: pending
                      status_description: ''
                      webhook_url: https://mystore.webhook.tazapay.refund/
                      created_at: '2023-07-23 23:59:56'
          description: Accepted
      deprecated: false
components:
  schemas:
    MetadataInput:
      type: string
      description: >-
        Set of key-value pairs that can be attached to the object (JSON string
        format)
      format: json
      example: '{"key1": "value1", "key2": "value2"}'
    RefundCustomerDetails:
      type: object
      description: Customer details for refund operations
      required:
        - email
      properties:
        email:
          type: string
          description: Customer Email
        phone:
          $ref: '#/components/schemas/Phone'
    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.
    Phone:
      type: object
      description: Phone contact details
      properties:
        calling_code:
          type: string
          description: >-
            Calling country code (for example, '1' for United States, '91' for
            India)
        number:
          type: string
          description: Phone Number
    Metadata:
      type: object
      description: Custom metadata key-value pairs attached to the object
      additionalProperties:
        type: string
      nullable: true
  securitySchemes:
    sec0:
      type: http
      scheme: basic

````