# ABA QR API

## 1. Introduction
The **ABA QR API** is a payment solution that allows businesses to generate dynamic QR codes for customers to scan and pay using **ABA KHQR**, **WeChat Pay**, or **Alipay**.
It enables fast and cashless transactions across multiple digital wallets and banking apps.


**Common Use Cases**

<Tabs>
     <Tab title="Cashier Screens & POS">
  
          1. The cashier processes the payment by selecting either **ABA KHQR**, **WeChat**, or **Alipay**.

2. A **payment QR code appears on the screen** for the customer to scan.  
3. The customer **scans and completes the QR payment** using ABA Mobile or any KHQR member bank's app, WeChat wallet or Alipay wallet.  
4. Once the payment is processed, your system receives a **pushback notification** with the payment status.
5. Your system **verifies the payment and confirms the order**.
  </Tab>
  <Tab title="Self-service kiosks">
     
         1. The customer processes payment via self-service kiosks by selecting either **ABA KHQR**, **WeChat**, or **Alipay**.

2. A **payment QR code appears on the screen** for the customer to scan.  
3. The customer **scans and completes the QR payment** using ABA Mobile or any KHQR member bank's app, WeChat wallet, or Alipay wallet.
4. Once the payment is processed, your system receives a **pushback** notification with the payment status.
5. Your system **verifies the payment and confirms the order**.
  </Tab>

  <Tab title="QR on invoices or receipts">
          
1.       The cashier enters the purchased items and prints the receipt with a unique QR code.
      2. The QR code is printed on the invoice or receipt.
3. The customer scans the QR code using ABA Mobile, a KHQR member bank’s app, WeChat Wallet, or Alipay Wallet and completes the payment in their app.
4. PayWay updates the system with the payment status via `callback_url`.
5. The system is notified that the invoice is `paid`.
      
  </Tab>
</Tabs>

## 2. Set up your QR display UI
To ensure a smooth payment experience, your platform **must** include a UI to accommodate QR payment acceptance. This includes:
- A screen for customers to choose the payment options you offer (ABA PAY, WeChat or Alipay).
- An area to display the generated QR code for payment
- A confirmation/success screen after the payment is completed.

:::caution[]
You **must** follow **[PayWay QR payment display guidelines](https://www.figma.com/design/5AJmZJwZha5QFfpIKmREBr/Displaying-Payment-QR-Code---Integration-Guideline?node-id=0-320&t=xB5i9Lf49UCKU6t7-4)** to ensure proper QR placement. 
:::

## 3. Integration steps

:::tip[]
Before you start, make sure you have the following:
-  PayWay Sandbox Account – **[Register here](https://sandbox.payway.com.kh/register-sandbox/)** to test transactions.
-  Sandbox Merchant ID & API Key – You will receive these via email after registering for the sandbox.
:::


To integrate QR on Display, follow these steps:


<Steps>
  <Step title="Generate a QR Code (QR Payment API)">
Use the **[QR Payment API](https://developer.payway.com.kh/qr-api-14530840e0.md)** to generate a payment QR code and display it where customers can scan and pay. 
      
      Upon a successful request, the API will respond with a JSON object containing all necessary information, which you can display in your preferred payment interface.

**Sample Response**
      
```json
{
  "qrString": "000201010212...9",
  "qrImage": "data:image/png;base64, ---REMOVED DATA---",
  "abapay_deeplink": "abamobilebank://ababank.com?...63041A49",
  "app_store": "https://itunes.apple.com/a...0649?mt=8",
  "play_store": "https://play.google.com/...com.paygo24.ibank",
  "amount": 0.01,
  "currency": "USD",
  "status": {
    "code": "0",
    "message": "Success.",
    "trace_id": "65bdc1fde8eea8254a437e51b606b328"
  }
}
```
#### **Customize QR Image Template (Optional)**
      
      The `qrImage` comes with various options to suit your needs. Please check API document ([QR API](https://developer.payway.com.kh/qr-api-14530840e0.md)) on how to customize the `qrImage`.
    

      :::warning[]
      
      The QR images included with the templates are high-resolution and can be up to 0.5 MB in size, which may cause network issues during download.

If  your production environments has  internet constraints or if network optimization is needed, we recommend using the QR string to generate the QR code on your end. Use the KHQR frame template as a static frame for display.

:::
      
      
![template1.png](https://api.apidog.com/api/v1/projects/831852/resources/363894/image-preview)

![template2.png](https://api.apidog.com/api/v1/projects/831852/resources/363897/image-preview)

![template3.png](https://api.apidog.com/api/v1/projects/831852/resources/363896/image-preview)
      
![template4.png](https://api.apidog.com/api/v1/projects/831852/resources/363899/image-preview)

![template5.png](https://api.apidog.com/api/v1/projects/831852/resources/363895/image-preview)


![template6.jpg](https://api.apidog.com/api/v1/projects/831852/resources/368430/image-preview)



      

  </Step>
  <Step title="Handle Callback URL for payment status updates">
      
      Once a payment is made using the QR code, the payment gateway will send a payment notification to your `callback_url`.
      
       Your `callback_url` must accept HTTP `POST` method.
      
      Here is the sample response of pushback notification:
      ```json
      {
          "tran_id": "123456789",
          "apv": 123456,
          "status": "0",
          "merchant_ref_no": "ref0001"
      }
      ```
      ------
      tran_id  `string` 
      Payment transaction ID generated by the payment gateway.
      `Max. Lenght: 20`
      
      -----
      apv `int`
      Transaction approval code.
      `Length: 6`
      
      ---
      status `string`
      Request status `00`
      
      ---
      merchant_ref_no `string`
      Your payment link reference number.
      
      ---
   

      
  </Step>
    <Step title="Verify Payment Status">
        
        In addition to verifying the payment status via `callback_url`, you must also use the **[Check transaction API](https://developer.payway.com.kh/check-transaction-14530826e0.md)** to ensure the payment is successfully marked as `PAID` and was processed correctly.


  </Step>
</Steps>




