# Get a transaction details

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /api/payment-gateway/v1/payments/transaction-detail:
    post:
      summary: Get a transaction details
      deprecated: false
      description: >-
        This API allows you to retrieve details of a purchase transaction,
        including its history and related operations, for both online and
        in-store payments.



        :::highlight orange 🚨
         Note: This API does not support real-time payment status checks during payment processing.
        :::


        - You can retrieve details for any past transaction.

        - Limited to 10 requests per minute. This limit cannot be increased.
      tags:
        - Ecommerce Checkout
      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.
                merchant_id:
                  type: string
                  description: A unique merchant key provided by ABA Bank.
                  title: ''
                  maxLength: 20
                tran_id:
                  type: string
                  description: The purcahse transaction ID.
                  title: ''
                  maxLength: 20
                hash:
                  type: string
                  title: ''
                  description: >-
                    A Base64-encoded HMAC SHA-512 hash generated by
                    concatenating `req_time`, `merchant_id`, and `tran_id`,
                    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 . $tran_id;

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

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

                    ```
              required:
                - req_time
                - merchant_id
                - tran_id
                - hash
              x-apidog-orders:
                - req_time
                - merchant_id
                - tran_id
                - hash
            example:
              req_time: '20250213084236'
              merchant_id: ec000002
              tran_id: '17394277693'
              hash: QskVi2gEctW...j7Td6kEi/KLPvGcK3ZiA==
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      transaction_id:
                        type: string
                        description: Your `tran_id`.
                      payment_status_code:
                        type: number
                        description: |-
                          Supported values:
                          - `0` - APPROVED, PRE-AUTH
                          - `2` - PENDING
                          - `3` - DECLINDED
                          - `4` - REFUNDED
                          - `7` - CANCELLED
                      payment_status:
                        type: string
                        description: >-
                          The transaction status. Possible values:


                          - `APPROVED` – Payment was completed successfully or
                          captured.

                          - `PRE-AUTH` – Payment is held under
                          pre-authorization, pending capture.

                          - `PENDING` – Awaiting completion from the payer.

                          - `DECLINED` – The payment was declined.


                          - `REFUNDED` – The payment has been refunded fully or
                          partially.

                          - `CANCELLED` – The transaction or pre-authorization
                          was cancelled.
                      original_amount:
                        type: number
                        description: Original transaction amount before discount.
                      original_currency:
                        type: string
                        description: Original transaction currency.
                      payment_amount:
                        type: number
                        description: Amount that the customer has paid.
                      payment_currency:
                        type: string
                        description: Payment currency that the customer used to pay.
                      total_amount:
                        type: number
                        description: Amount that customer suppose to pay after discount.
                      refund_amount:
                        type: number
                        description: 'Total refunded amount. '
                      discount_amount:
                        type: number
                        description: >-
                          Discounted amount and its currency follow original
                          curency.
                      apv:
                        type: string
                        description: Transaction appoval code.
                      transaction_date:
                        type: string
                        description: >-
                          Created date of the transaction in payment gateway
                          database.
                      first_name:
                        type: string
                        description: Payer's first name.
                      last_name:
                        type: string
                        description: Payer's last name.
                      email:
                        type: string
                        description: Payer's email.
                      phone:
                        type: string
                        description: Payer's phone number.
                      bank_ref:
                        type: string
                        description: >-
                          Unique booking entry reference number from ABA Core
                          banking system
                      payment_type:
                        type: string
                        description: >-
                          Payment method that the customer used to make payment.
                          Possible values:

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

                          - `Alipay` : Transaction made with Alipay.

                          - `Wechat` : Transaction made with WeChat pay.

                          - `KHQR` : Trnasaction made with KHQR.

                          - `VISA` : Transaction made with Visa card.

                          - `MC` : Transacion made with Mastercard.

                          - `JCB` : Transaction made with JCB card

                          - `CUP` : Transaction made with UPI card.
                      payer_account:
                        type: string
                        description: >-
                          Masked ABA Account Number or Masked Card PAN. For
                          other payment options, it will be blank.
                      bank_name:
                        type: string
                        description: >-
                          If payment is made with ABA PAY, it will show ABA Bank
                          and if payment made using KHQR it will show issuer
                          bank name.
                      card_source:
                        type: string
                        description: >-
                          Possible values:

                          - `ONUS` : Transaction is made with ABA bank card.

                          - `OFFUS_DOMESTIC` : Transaction is made with other
                          local bank card.

                          - `OFFUS_INTERNATIONAL` : Transaction is made with
                          other international bank card
                      transaction_operations:
                        type: array
                        items:
                          type: object
                          properties:
                            status:
                              type: string
                              description: >-
                                Payment operation status. Possible values:

                                - `Completed` : Full purchase

                                - `Pre-Auth` : Purchase with pre-auth

                                - `Completed Pre-Auth` : Indicates a
                                pre-authorization was completed.

                                - `Cancelled Pre-Auth` :  Indicates a
                                pre-authorization was cancelled.

                                - `Refunded` : Refund operation
                            amount:
                              type: number
                              description: Amount based on operation type.
                            transaction_date:
                              type: string
                              description: Operation date and time.
                            bank_ref:
                              type: string
                              description: >-
                                Unique booking entry id from ABA core banking
                                (only for ABA PAY). Other payment options, this
                                field will be empty.
                          x-apidog-orders:
                            - status
                            - amount
                            - transaction_date
                            - bank_ref
                        description: History of the payments
                      status:
                        type: object
                        properties:
                          code:
                            type: string
                            title: ''
                            description: |-
                              Possible  response code:
                              - `00` : Success!
                              - `5` : Wrong hash
                              - `6` : Transaction not found
                              - `8` : Invalid merchant profile
                              - `11` : Internal server error
                              - `429` : Rate limit exceeded
                          message:
                            type: string
                            title: ''
                            description: >-
                              See the `code` field for a detailed error
                              explanation.
                          tran_id:
                            type: string
                            title: ''
                            description: Request reference generated by payment gateway.
                        x-apidog-orders:
                          - code
                          - message
                          - tran_id
                    x-apidog-orders:
                      - transaction_id
                      - payment_status_code
                      - payment_status
                      - original_amount
                      - original_currency
                      - payment_amount
                      - payment_currency
                      - total_amount
                      - refund_amount
                      - discount_amount
                      - apv
                      - transaction_date
                      - first_name
                      - last_name
                      - email
                      - phone
                      - bank_ref
                      - payment_type
                      - payer_account
                      - bank_name
                      - card_source
                      - transaction_operations
                      - status
                x-apidog-orders:
                  - data
          headers: {}
          x-apidog-name: OK
      security: []
      x-apidog-folder: Ecommerce Checkout
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/831852/apis/api-14530824-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://checkout-sandbox.payway.com.kh/
    description: StillZeroBug
security: []

```
