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

# Query Payment

> Payment gateway checks the existing payment status.

The following input parameters are expected to be provided by the merchant to verify transaction status or to obtain more details on the payment before approving the customer’s order.



## OpenAPI

````yaml /openapi.json get /api/services/app/PaymentGateway/Query
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/Query:
    get:
      tags:
        - PaymentGateway
      summary: Query Payment
      description: >-
        Payment gateway checks the existing payment status.


        The following input parameters are expected to be provided by the
        merchant to verify transaction status or to obtain more details on the
        payment before approving the customer’s order.
      operationId: ApiServicesAppPaymentgatewayQueryGet
      parameters:
        - name: TransactionNumber
          in: query
          schema:
            type: string
            maxLength: 24
          description: >-
            Unique CAP Transaction Number **(Conditional: If it is query for
            specific transaction in either normal transaction or session
            transaction, then need pass the transaction number)**
        - name: Timestamp
          in: query
          schema:
            type: integer
            format: int64
            example: 1621851652617
          description: new Date().getTime()
        - $ref: '#/components/parameters/AbpTenantId'
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/CapSignature'
        - schema:
            type: string
            maxLength: 24
          in: query
          name: SessionNumber
          description: >-
            Unique CAP Session Number **(Conditional: If the query is query the
            session, then need pass the session number)**
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueryPaymentOutputDto'
              examples:
                Example Response:
                  value:
                    transactionNumber: string
                    paymentSessionNumber: string
                    referenceCode: string
                    status: 0
                    currencyCode: MYR
                    amount: 1000
                    channelId: 1
                    providerTransactionNumber: string
                    creationTime: '2022-02-10T08:50:30.565Z'
                    remark: string
                    providerChannelId: string
                    providerPaymentMethod: string
                    providerErrorMessage: string
                    loyaltyType: 1
                    redemptionPoint: 100
                    redemptionAmount: 100
                    rewardPoint: 100
                    paidAmount: 900
                    loyaltyRedemptionStatus: 0
                    loyaltyRewardStatus: 0
            text/json:
              schema:
                $ref: '#/components/schemas/QueryPaymentOutputDto'
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:
    QueryPaymentOutputDto:
      type: object
      additionalProperties: false
      x-examples: {}
      properties:
        transactionNumber:
          type: string
          description: Unique CAP transaction number
          maxLength: 24
          nullable: true
        paymentSessionNumber:
          type: string
          description: Unique CAP session number
          maxLength: 24
          nullable: true
        referenceCode:
          type: string
          description: Merchant Reference Code
          maxLength: 50
          nullable: true
        status:
          $ref: '#/components/schemas/PaymentStatus'
        currencyCode:
          type: string
          description: Currency code with a 3-letter ISO 4217 standard code
          example: MYR
          maxLength: 3
          nullable: true
        amount:
          type: integer
          format: int64
          description: |
            This is Request Amount.
          example: 100
        channelId:
          type: integer
          format: int32
          description: >-
            Refer to endpoints in [Get Channel
            List](/api-reference/get-tenant-channels-by-country)
        providerTransactionNumber:
          type: string
          description: Provider Transaction Number
          nullable: true
        creationTime:
          type: string
          format: date-time
          description: Payment Transaction Creation Time
          example: '2022-02-10T08:50:30.565Z'
        remark:
          type: string
          description: >-
            A description that additional information or clarify details for the
            transaction.
          nullable: true
        providerChannelId:
          type: string
          description: An identifier that represents the payment provider channel
          nullable: true
        providerPaymentMethod:
          type: string
          description: Provider Payment Method
          nullable: true
        providerErrorMessage:
          type: string
          description: Provider Error Message
          nullable: true
        loyaltyType:
          $ref: '#/components/schemas/LoyaltyProviderType'
        redemptionPoint:
          type: integer
          format: int64
          description: '**[Conditional for Loyalty Payment]** Redemption Point.'
        redemptionAmount:
          type: integer
          format: int64
          description: '**[Conditional for Loyalty Payment]** Redemption Amount.'
        rewardPoint:
          type: integer
          format: int64
          description: '**[Conditional for Loyalty Payment]** Reward Point.'
        paidAmount:
          type: integer
          format: int64
          description: "**[Conditional for Loyalty Payment]** This is Paid Amount.\r\n"
          example: 100
        loyaltyRedemptionStatus:
          $ref: '#/components/schemas/LoyaltyRedemptionStatus'
        loyaltyRewardStatus:
          $ref: '#/components/schemas/LoyaltyRewardStatus'
    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'
    LoyaltyProviderType:
      title: LoyaltyProviderType
      enum:
        - 1
      description: |-
        **[Conditional for Loyalty Payment]**

        1 = BCard
    LoyaltyRedemptionStatus:
      title: LoyaltyRedemptionStatus
      enum:
        - 0
        - 1
        - 2
        - 3
      description: |-
        **[Conditional for Loyalty Payment]**

        0 = Pending, 1 = Success, 2 = Failed, 3 = Void
    LoyaltyRewardStatus:
      title: LoyaltyRewardStatus
      enum:
        - 0
        - 1
        - 2
        - 3
      description: |-
        **[Conditional for Loyalty Payment]**

        0 = Pending, 1 = Success, 2 = Failed, 3 = Void

````