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

# Refund Payment

> **The payment gateway requests a refund payment**



## OpenAPI

````yaml /openapi.json post /api/services/app/PaymentGateway/RefundPayment
openapi: 3.0.1
info:
  title: CommercePay API
  version: v1
  description: >
    ---

    **Credentials Accounts**


    Every account is provided with separate keys for testing and for running
    live transactions. Once the merchant application has been approved,
    developers can begin the process of integrating the CommercePay API. The
    following details will be provided to get started with the integration. 


    <a href="https://docs.commercepay.asia/docs/api/d19b0f3289ae0-get-started"
    target="_blank">Get Started</a>
  contact: {}
servers:
  - description: Staging
    url: https://staging-payments.commerce.asia
  - url: https://payments.commerce.asia
    description: Production
security: []
paths:
  /api/services/app/PaymentGateway/RefundPayment:
    post:
      tags:
        - PaymentGateway
      summary: Refund Payment
      description: '**The payment gateway requests a refund payment**'
      operationId: ApiServicesAppPaymentgatewayRefundpaymentPost
      parameters:
        - $ref: '#/components/parameters/AbpTenantId'
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/CapSignature'
      requestBody:
        content:
          application/json-patch+json:
            schema:
              $ref: '#/components/schemas/RefundPaymentInputDto'
          application/json:
            schema:
              $ref: '#/components/schemas/RefundPaymentInputDto'
          text/json:
            schema:
              $ref: '#/components/schemas/RefundPaymentInputDto'
          application/*+json:
            schema:
              $ref: '#/components/schemas/RefundPaymentInputDto'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                x-examples:
                  Example 1:
                    tenantId: 0
                    transactionNumber: string
                    refundTransactionNumber: string
                    referenceCode: string
                    amount: 100
                    currencyCode: MYR
                    refundStatus: 0
                    responseMessage: string
                    paymentSessionNumber: string
                    refundPaymentList:
                      transactionNumber: string
                      amount: 100
                      currencyCode: MYR
                      refundReason: string
                      refundStatus: 0
                nullable: true
                properties:
                  tenantId:
                    type: integer
                  transactionNumber:
                    type: string
                  refundTransactionNumber:
                    type: string
                  referenceCode:
                    type: string
                  amount:
                    type: integer
                  currencyCode:
                    type: string
                  refundStatus:
                    type: integer
                  responseMessage:
                    type: string
                  paymentSessionNumber:
                    type: string
                  refundPaymentList:
                    type: object
                    properties:
                      transactionNumber:
                        type: string
                      amount:
                        type: integer
                      currencyCode:
                        type: string
                      refundReason:
                        type: string
                      refundStatus:
                        type: integer
              examples:
                Example 1:
                  value:
                    tenantId: 0
                    transactionNumber: string
                    refundTransactionNumber: string
                    referenceCode: string
                    amount: 0
                    currencyCode: string
                    refundStatus: 0
                    responseMessage: string
                    paymentSessionNumber: string
                    refundPaymentList:
                      transactionNumber: string
                      amount: 0
                      currencyCode: string
                      refundReason: string
                      refundStatus: 0
            text/json:
              schema:
                $ref: '#/components/schemas/RequestRefundOutputDto'
            text/plain:
              schema:
                $ref: '#/components/schemas/RequestRefundOutputDto'
components:
  parameters:
    AbpTenantId:
      schema:
        type: string
      in: header
      name: Abp-TenantId
      required: true
      description: Your unique Merchant ID assigned by CommercePay.
    Authorization:
      schema:
        type: string
      in: header
      name: Authorization
      required: true
      description: Your API credentials used for authentication (typically a Bearer token).
    CapSignature:
      schema:
        type: string
      in: header
      name: cap-signature
      required: true
      description: >-
        A unique security hash used to verify the integrity of the request body.
        See [Generate Signature](/docs/generate-signature) for how to generate
        this.
  schemas:
    RefundPaymentInputDto:
      type: object
      additionalProperties: false
      required:
        - transactionNumber
        - reason
        - timestamp
      properties:
        transactionNumber:
          type: string
          description: Unique CAP Transaction Number
          maxLength: 24
          nullable: true
        reason:
          type: string
          description: A description for refund.
          example: Purchase wrong item
          nullable: true
        amount:
          type: integer
          description: "Please take note: The Amount parameter only accepts integer units. For example, 1000 is equivalent to 10.00 for the backend.Show all...\r\n\r\n\r\nExample: 100\r\n\r\n[Please pass the required amount if issuing a partial refund; ignore this attribute if issuing a full refund.]"
          format: int32
          nullable: true
        timestamp:
          type: integer
          format: int64
          description: new Date().getTime()
          example: 1621851652617
    RequestRefundOutputDto:
      type: object
      additionalProperties: false
      x-internal: false
      properties:
        tenantId:
          type: integer
          format: int64
        transactionNumber:
          type: string
          description: Unique CAP transaction number
          maxLength: 24
          nullable: true
        refundTransactionNumber:
          type: string
          nullable: true
        referenceCode:
          type: string
          description: Merchant Reference Code
          nullable: true
        amount:
          type: number
          format: double
          description: "Please take note: The Amount parameter only accepts integer units. For example, 1000 is equivalent to 10.00 for the backend.\r\n\r\nInvalid Format: 1,000.00"
          example: 100
        currencyCode:
          type: string
          description: Currency code with a 3-letter ISO 4217 standard code
          example: MYR
          maxLength: 3
          nullable: true
        refundStatus:
          $ref: '#/components/schemas/PaymentStatus'
        responseMessage:
          type: string
          nullable: true
        paymentSessionNumber:
          type: string
          description: Unique CAP Session Number
          maxLength: 24
          nullable: true
        refundPaymentList:
          $ref: '#/components/schemas/RefundPaymentListDto'
      x-examples:
        Example 1:
          tenantId: 0
          transactionNumber: string
          paymentSessionNumber: string
          refundTransactionNumber: string
          referenceCode: string
          amount: 0
          currencyCode: string
          refundStatus: 0
          refundPaymentList:
            - transactionNumber: string
              amount: 0
              currencyCode: string
              refundReason: string
              refundStatus: 0
          responseMessage: string
    PaymentStatus:
      enum:
        - 0
        - 1
        - 2
        - 3
        - 4
        - 5
        - 6
        - 7
      type: integer
      format: int32
      x-enumNames:
        - Pending
        - Success
        - Failed
        - Cancelled
        - TransactionLimitExceeded
        - MinTransactionAmountNotMeet
        - InsufficientFunds
        - InvalidTransaction
      description: 'Payment Status: Refer on Appendix 3.1 Payment Status Code Table'
    RefundPaymentListDto:
      title: RefundPaymentListDto
      type: object
      properties:
        transactionNumber:
          type: string
          description: Unique CAP Transaction Number
          maxLength: 24
          nullable: true
        amount:
          type: integer
          format: int64
          description: Refund Amount.
          example: 100
        currencyCode:
          type: string
          description: Currency code with a 3-letter ISO 4217 standard code
          example: MYR
          maxLength: 3
          nullable: true
        refundReason:
          type: string
          description: A description for refund.
          nullable: true
        refundStatus:
          $ref: '#/components/schemas/PaymentStatus'

````