Developer Suite
Register Sandbox
Register Sandbox
  1. Ecommerce Checkout
  • Overview
  • API Endpoints
  • Ecommerce Checkout
    • Purchase
      POST
    • Get a transaction details
      POST
    • Close transaction
      POST
    • Check transaction
      POST
    • Refund API
      POST
    • Get transaction list
      POST
    • Exchange rate
      POST
  • Checkout Plugins
    • Prestashop
    • Woocommerce
  • Credentials on File
    • Link Account
      POST
    • Link Card
      POST
    • Purchase using token
      POST
    • Remove account token
      POST
    • Remove card token
      POST
    • Get linked account details
      POST
  • ABA QR API
    • QR API
      POST
  • Payment Link
    • Create payment link
      POST
    • Get payment link details
      POST
  • Pre-auth
    • Complete pre-auth transactions
      POST
    • Complete pre-auh transaction with payout
      POST
    • Cancel pre-purchase transaction
      POST
  • Payout
    • Payout
    • Update a beneficiary status
    • Add a beneficiary to whitelist
  • KHQR Guideline
  • Resources
  1. Ecommerce Checkout

Purchase

POST
api/payment-gateway/v1/payments/purchase
The Purchase API is used to initiate a payment transaction between a customer and a merchant through PayWay. It allows merchants to request a payment by providing transaction details such as the amount, currency, item list, and other relevant data.
Once the API is called, the customer is redirected to PayWay’s hosted checkout page, bottom sheet, or modal popup—depending on your integration option—where they can complete the payment using the available methods (e.g., card, ABA PAY, KHQR, digital wallets). After the transaction is completed, PayWay will return the transaction result to the merchant via the configured return URL or callback.

Request

Header Params
Content-Type
string 
required
Example:
multipart/form-data
Body Params multipart/form-data
req_time
string 
required
Request date and time in UTC format as YYYYMMDDHHmmss.
merchant_id
string 
required
A unique merchant key which provided by ABA Bank.
<= 30 characters
tran_id
string 
required
A unique transaction identifier for the payment.
<= 20 characters
firstname
string 
optional
Buyer's first name.
<= 20 characters
lastname
string 
optional
Buyer's last name.
<= 20 characters
email
string 
optional
Buyer's email.
<= 50 characters
phone
string 
optional
Buyer's phone.
<= 20 characters
type
string 
optional
Type of the transaction, default value is purchase. Supported value:
pre-auth : for pre purchase
purchase : for full purchase
Note: pre-auth only support ABA PAY, KHQR and Card Payment.
<= 20 characters
payment_option
string 
optional
Payment Methods for Transactions:
cards: For card payments.
abapay: QR payment, allowing users to pay only with ABA Mobile.
abapay_khqr: QR payment that can be scanned and paid using ABA PAY and other KHQR member banks.
abapay_khqr_deeplink: Allows customers to pay using ABA PAY and other KHQR member banks. The payment gateway will respond with a JSON object containing qr_string, abapay_deeplink, and checkout_qr_url. See the sample response in the response section below.
alipay: Allows customers to pay using Alipay Wallet.
wechat: Allows customers to pay using WeChat Wallet.
google_pay: Allows customers to pay using Google Pay Wallet.
If no value is provided, the payment gateway will automatically display the supported payment options based on your profile, allowing the customer to choose a preferred payment method.
<= 20 characters
items
string 
optional
A base64-encoded JSON array describing the items being purchased.
PHP Sample Code
Note: This is only description/remark. The price or quantity in this info will not be used for calculation or any validation purposes
<= 500 characters
shipping
number 
optional
Shipping fee.
amount
number 
required
Purchase amount.
currency
string 
optional
Transaction currency of the payment. If you don't pass any value, it will take default value from your merchant profile (the first account's the currency of the first account you registered). Supported values are KHR or USD.
return_url
string 
optional
The URL to which PayWay will send the payment notification upon success.
cancel_url
string 
optional
The URL to redirect to after the user closes the payment dialog or when user cancel the payment.
continue_success_url
string 
optional
The URL to redirect to after a successful payment.
return_deeplink
string 
optional
The deep link for redirecting to the app after a successful payment from ABA Mobile. Must be base64-encoded and include both iOS and Android schemes. This field is mandatory for mobile integration.
PHP Sample Code
custom_fields
string 
optional
Additional information that you want to attach to the transaction. This information will appear in the transaction list, transaction details and export report. It's base64-encoded JSON info.
PHP Sample Code
return_params
string 
optional
Information to include when PayWay calls your return URL after a successful payment.
view_type
string 
optional
Defines the view type for the payment page.
hosted_view : redirect payer to a new tab
popup : Display as a bottom sheet on mobile web browsers and as a modal popup on desktop web browsers.
payment_gate
integer 
optional
If your merchant profile also supports the QR Payment API service, please set this parameter to 0 to use the Checkout service.
payout
string 
optional
Base64-encoded JSON string representing payout details.
PHP Sample Code
additional_params
string 
optional
Currently, we support WeChat Mini Program. These are the values key wechat sub_appid and wechat_sub_openid.
PHP Sample Code
lifetime
integer 
optional
The payment's lifetime in minutes, once it exceeds customer will not allow to make payment. Default value is no expiry.
Min: 3 mins
Max: 30 days
For ABA PAY or Card: Transaction will not go throught.
KHQR: In case payment happen after exceed life time, PayWay will also reject. Fund will be reverse back to payer.
WeChat & Alipay: No reversal.
google_pay_token
string 
optional
This field is required if payment_option is set to google_pay and the payment selection is managed by the merchant. For detailed instructions, please refer to the Google Pay integration guidelines.
hash
string 
required
Base64 encode of hash hmac sha512 encryption of concatenates values req_time,merchant_id,tran_id,amount,items,shipping,firstname,lastname,email,phone,type,payment_option,return_url,cancel_url,continue_success_url,return_deeplink,currency,custom_fields,return_params,payout,lifetime,additional_params, and google_pay_token with public_key.
PHP Sample Code

Request samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'api/payment-gateway/v1/payments/purchase' \
--header 'Content-Type: multipart/form-data' \
--form 'req_time=""' \
--form 'merchant_id=""' \
--form 'tran_id=""' \
--form 'firstname=""' \
--form 'lastname=""' \
--form 'email=""' \
--form 'phone=""' \
--form 'type=""' \
--form 'payment_option=""' \
--form 'items=""' \
--form 'shipping=""' \
--form 'amount=""' \
--form 'currency=""' \
--form 'return_url=""' \
--form 'cancel_url=""' \
--form 'continue_success_url=""' \
--form 'return_deeplink=""' \
--form 'custom_fields=""' \
--form 'return_params=""' \
--form 'view_type=""' \
--form 'payment_gate=""' \
--form 'payout=""' \
--form 'additional_params=""' \
--form 'lifetime=""' \
--form 'google_pay_token=""' \
--form 'hash=""'

Responses

🟢200Success
text/html
Body
object {0}
Example
<!DOCTYPE html>
<html data-capo="">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalab
<title>PayWay - Checkout</title>
...
</head>
<body>
...
</body>
</html>
🟢200OK
🟢200Exception
Previous
Ecommerce Checkout
Next
Get a transaction details