Cancellation Payment
To perform financial transaction request to serve need to authorize your API token and API signature. API token will be generate every request authentication
In order to interact with PAYON's API. First you need to Obtain your API Key. Next generate API's signature for authorization between Merchant and PAYON's server. Finally, obtain your authentication's token for authenticate user account.
Cancellation Transaction
POST {{URL}}/pg/reversal
This endpoint allow you to process reversal request.
Request Body
sign
string
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.
txId*
string
Transaction identification
merchantId*
string
Merchant Identification
termId*
string
Merchant Terminal identification
{
"txId": "2435",
"merchantId": "EPAY00000000001",
"termId": "PAYONGT1",
"amount": 1.00,
"currency": "USD",
"resultCode": "0000",
"resultMessage": "Success",
"approvalNo": "538433",
"approvalDate": "09122020110737",
"acsUrl": null,
"refNo": "000004538433",
"transactionAmount": null
}Example Request
curl --location --request POST 'http://pgtest.payon.com.kh/pg/reversal' \
--data-raw '{
"txId":"159607654560937",
"merchantId":"C0000143",
"termId":"CT03000003"
}'POST /pg/reversal HTTP/1.1
Host: pgtest.payon.com.kh
{
"txId":"159607654560937",
"merchantId":"C0000143",
"termId":"CT03000003"
}<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('http://pgtest.payon.com.kh:36605/pg/reversal');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setBody('{\n "txId":"159607654560937",\n "merchantId":"C0000143",\n "termId":"CT03000003",\n "approvalNo":"1"\n\n\n}');
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://pgtest.payon.com.kh/pg/reversal",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"txId\":\"159607654560937\",\n \"merchantId\":\"C0000143\",\n \"termId\":\"CT03000003\",\n \"approvalNo\":\"1\"\n\n\n}",
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var settings = {
"url": "http://pgtest.payon.com.kh/pg/reversal",
"method": "POST",
"timeout": 0,
"data": "{\n \"txId\":\"159607654560937\",\n \"merchantId\":\"C0000143\",\n \"termId\":\"CT03000003\",\n \"approvalNo\":\"1\"\n\n\n}",
};
$.ajax(settings).done(function (response) {
console.log(response);
});var data = "{\n \"txId\":\"159607654560937\",\n \"merchantId\":\"C0000143\",\n \"termId\":\"CT03000003\",\n \"approvalNo\":\"1\"\n\n\n}";
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "http://pgtest.payon.com.kh/pg/reversal");
xhr.send(data);Last updated
Was this helpful?