Base URL: https://checkout-sandbox.payway.com.kh/Copy to clipboard
POST

This API allows you to create a payment link from your application.

Request

Header Params
stringrequired

Example: multipart/form-data

Body Params multipart/form-data

stringrequired

Request date and time in UTC format as YYYYMMDDHHmmss.

stringrequired

A unique merchant key provided by ABA Bank.

stringrequired

A JSON string containing a JSON object with the following fields: mc_id, title, amount, currency, description, payment_limit, expired_date, return_url, merchant_ref_no, and payout. The JSON string must be encrypted using OpenSSL and the RSA public key provided by PayWay.


mc_id string mandatory
The same value as merchant_id


title string mandatory
Title of the payment link. Max. Lenght 250.


amount string mandatory
Payment link amount. Must be at least 100 KHR or 0.01 USD. Cannot be null or zero.


currency string mandatory
Transaction currency code (Mandatory). Supported values: KHR or USD.


description string
Description of the payment link. Optional. Max. Lenght 250


payment_limit string
Maximum number of transactions allowed for this payment link (Optional). If left blank, there is no limit..


expired_date string mandatory
The date and time when the payment link expires. Must be a future date; there is no maximum limit. Set to null to create a link with no expiration.


return_url string mandatory
Once a payment is made on the payment link, the payment gateway will call this URL to send the payment details. This URL must be encrypted in Base64.


merchant_ref_no string optional
Your payment link ID. We suggest using a unique ID. PayWay does not validate duplicates. This ID will be included in the callback when the payment is completed. Max length: 50.


payout string optional
Payout instruction of the payment link. Total payout amount must equal to payment link amount.


PHP Sample Code

function opensslEncryption($source, $publicKey)
{
    $maxlength = 117;
    $output = '';
    while (!empty($source)) {
        $input = substr($source, 0, $maxlength);
        openssl_public_encrypt($input, $encrypted, $publicKey);
        $output .= $encrypted;
        $source = substr($source, $maxlength);
    }
    return base64_encode($output);
}

$rsa_public_key = "RSA PUBLIC KEY PROVIDED BY ABA BANK";

$data = json_encode([
    'mc_id' => $merchant_id,
    'title' => 'Test curl 001',
    'amount' => 0.03,
    'currency' => 'USD',
    'description' => 'Payment link created from curl',
    'payment_limit' => 5,
    'expired_date' => time(),
    'return_url' => base64_encode('https://domain.com'),
    'merchant_ref_no' => 'ref00001',
    'payout' => '[
        {"acc":"122092016015926","amt":0.01},
        {"acc":"122091511120425","amt":0.02}
    ]',
]);
$merchant_auth = opensslEncryption($data, $rsa_public_key);
stringoptional

An image associated with the payment link

  • Maximum file size: 3MB
  • Supported file formats: JPG, JPEG, PNG
stringrequired

Base64-encoded HMAC SHA-512 hash of the concatenated values: request_time, merchant_id, and merchant_auth with public_key.

PHP Sample Code

// public key provided by ABA Bank
$api_key = "API KEY PROVIDED BY ABA BANK";
// Prepare the data to be hashed
$b4hash = $request_time . $merchant_id . $merchant_auth;
// Generate the HMAC hash using SHA-512 and encode it in Base64
$hash = base64_encode(hash_hmac('sha512', $b4hash, $api_key, true));

Example

{
  "request_time": "",
  "merchant_id": "",
  "merchant_auth": "",
  "image": "",
  "hash": ""
}
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R

Responses