# Get transactions

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /api/payment-gateway/v1/payments/get-transactions-by-mc-ref:
    post:
      summary: Get transactions
      deprecated: false
      description: >-
        This API allows you to retrieve  purchase transactions using
        `merchant_ref` number, for both online and in-store payments.


        - You can retrieve details for any past transaction and we response only
        the last 50 transactions.

        - Limited to 10 requests per minute. This limit cannot be increased.
      tags:
        - KHQR Guideline
      parameters:
        - name: Content-Type
          in: header
          description: ''
          required: true
          example: application/json
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                req_time:
                  type: string
                  title: ''
                  description: Request date and time in UTC format as YYYYMMDDHHmmss.
                hash:
                  type: string
                  title: ''
                  description: >-
                    A Base64-encoded HMAC SHA-512 hash generated by
                    concatenating `req_time`, `merchant_id`, and `merchant_ref`,
                    encrypted using your `public_key`.



                    **PHP Sample Code**


                    ```php

                    // public key provided by ABA Bank

                    $api_key = "API KEY PROVIDED BY ABA BANK";

                    // Prepare the data to be hashed

                    $b4hash = $req_time . $merchant_id . $merchant_ref;

                    // Generate the HMAC hash using SHA-512 and encode it in
                    Base64 

                    $hash = base64_encode(hash_hmac('sha512', $b4hash, $api_key,
                    true));

                    ```
                merchant_id:
                  type: string
                  description: A unique merchant key provided by ABA Bank.
                  title: ''
                  maxLength: 20
                merchant_ref:
                  type: string
                  description: 'Merchant reference #.'
                  title: ''
                  maxLength: 20
              required:
                - req_time
                - merchant_id
                - merchant_ref
                - hash
              x-apidog-orders:
                - req_time
                - merchant_id
                - merchant_ref
                - hash
            example:
              req_time: '20250213084236'
              merchant_id: ec000002
              merchant_ref: '17394277693'
              hash: QskVi2gEctW...j7Td6kEi/KLPvGcK3ZiA==
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        transaction_id:
                          type: string
                          description: Transaction id
                        transaction_date:
                          type: string
                          description: Created date & time of the transaction.
                        apv:
                          type: string
                          description: Transaction approval code
                        payment_status:
                          type: string
                          description: >-
                            Possible values:

                            - `APPROVED` : Transaction successfully completed
                            with the full purchase amount.

                            - `REFUNDED` : Transaction has been fully or
                            partially refunded.
                        payment_status_code:
                          type: integer
                          description: |-
                            - `0` : APPROVED
                            - `4` : REFUNDED
                        original_amount:
                          type: number
                          format: double
                          description: Original amount of the transaction (before discount)
                        original_currency:
                          type: string
                          description: |-
                            Original transaction currency.
                            - `KHR` : For Khmer Riel transaction
                            - `USD` : For US Dollar transaction
                        total_amount:
                          type: number
                          format: double
                          description: >-
                            Amount to pay after discount. Its currency follow
                            original currency.
                        discount_amount:
                          type: number
                          format: double
                          description: >-
                            Discounted amount. Its currency follow original
                            currency.
                        refund_amount:
                          type: number
                          format: double
                          description: 'Total refunded amount. '
                        payment_amount:
                          type: number
                          format: double
                          description: >-
                            The amount that the customer has paid. Example:
                            Customer supposed to pay 1$, but customer paid from
                            his KHR account then this payment amount will be
                            4,000.00.
                        payment_currency:
                          type: string
                          description: >-
                            Payment currency. Example: Customer supposed to pay
                            1$, but customer paid from his KHR account then this
                            payment currency will be KHR.
                        bank_ref:
                          type: string
                          description: >-
                            Unique booking entry id from ABA core banking. This
                            value only exist in the API response if configure on
                            profile.
                        payer_account:
                          type: string
                          description: 'Masked acccount #'
                        bank_name:
                          type: string
                          description: >-
                            If payment is made with ABA Pay, it will show ABA
                            Bank or If payment made using KHQR it will show
                            issuer bank name.
                        payment_type:
                          type: string
                          description: >-
                            Payment method that the customer use to make
                            payment. This value only exist in the API response
                            if configure on profile. Possible values:

                            - `ABA Pay` : Transaction made with ABA Account (ABA
                            Mobile)

                            - `KHQR` : Trnasaction made with KHQR.
                        merchant_ref:
                          type: string
                          description: >-
                            Your reference number that you embed  in tag
                            `62.01`.
                      x-apidog-orders:
                        - transaction_id
                        - transaction_date
                        - apv
                        - payment_status
                        - payment_status_code
                        - original_amount
                        - original_currency
                        - total_amount
                        - discount_amount
                        - refund_amount
                        - payment_amount
                        - payment_currency
                        - bank_ref
                        - payment_type
                        - payer_account
                        - bank_name
                        - merchant_ref
                      required:
                        - merchant_ref
                  status:
                    type: object
                    properties:
                      code:
                        anyOf:
                          - type: string
                          - type: integer
                        description: |-
                          - `00` : Success!
                          - `1` : Wrong hash
                          - `8` : Invalid merchant profile
                          - `11` : Internal server error
                          - `429` : Rate limit exceeded.
                      message:
                        type: string
                        title: ''
                        description: >-
                          Please see the property reponse `code` for the
                          details.
                      merchant_ref:
                        type: string
                        title: ''
                        description: 'Merchant reference #'
                    x-apidog-orders:
                      - code
                      - message
                      - merchant_ref
                x-apidog-orders:
                  - data
                  - status
          headers: {}
          x-apidog-name: OK
      security: []
      x-apidog-folder: KHQR Guideline
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/831852/apis/api-22366268-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://checkout-sandbox.payway.com.kh/
    description: StillZeroBug
security: []

```
