How to use PayOn Library
Sign is a digital signature for verifying the authenticity of digital messages or documents. Only a valid API's sign can be interact with PAYON's server.
Initialize PAYON's Library
import com.payon.pg.aggregator.ecommerce.gateway.client.CheckoutURIBuilder;
import com.payon.pg.aggregator.ecommerce.gateway.client.CheckoutURIBuilder.Environment;
public class OrderController {
public static void main(String[] args) throws IOException, InterruptedException {
CheckoutURIBuilder checkoutURIBuilder = CheckoutURIBuilder.builder()
.env(Environment.UAT)// UAT:for TEST,PRODUCTION: production
.apiKey(YOUR API KEY)
.merchantId(YOUR MERCHANT ID)
.termId(YOUR TERMINAL ID)
.txId(YOUR TRANSACTION ID)
.amount(YOUR CHECK OUT AMOUNT)
.currency(YOUR CURRENCY)
.build();
}
}<?php
require_once('CheckoutURIBuilder.php');
$lang = "en";
$merchantId = "YOUR MERCHANT ID";
$termId = "YOUR TERM ID";
$amount = "YOUR CHECK OUT AMOUNT";
$txId = "YOUR TRANSACTION ID";
$currency = "YOUR CURRENCY";
$apiKey = "YOUR API KEY";
$checkoutURIBuilder = new CheckoutURIBuilder($lang, $merchantId, $termId, $txId, $amount, $currency, $redirectUri, $apiKey);
$env = new Environment();
// get test url function $env::getTestUrl() and get real url function $env::getRealUrl()
$url = $checkoutURIBuilder::toCheckoutUrlString($env::getTestUrl());
echo "<a href='".$url."'>Click to Pay</a><br/>";
?>
Get Checkout Link
String checkoutURI = checkoutURIBuilder.toCheckoutUrlString() <?php
$checkoutURI = $checkoutURIBuilder::toCheckoutUrlString();
?>Get API's Signature
String sign = checkoutURIBuilder.getSign() <?php
$checkoutURI = $checkoutURIBuilder::getSign();
?>Arguments
env
environment mode(TEST,PRODUCTION)
apiKey
Merchant's API key, will provided after merchant registration.
termId
Merchant's terminal identification
merchantId
Merchant's identification
amount
Total amount
Currency
Currency code (KHR, USD)
Last updated
Was this helpful?