// PRIVATE Merchant Authtoken
$base_url = "https://sampath.paycorp.lk/webinterface/qw/confirm";
$auth_Token = "7c0c1c98-0f1e-4da9-9e93-1d4939d9282f";
// Construct the payment confirmation request
// Set CURLOPT_RETURNTRANSFER so that the content is returned as a variable.
// Set CURLOPT_FOLLOWLOCATION to true to follow redirects.
curl_setopt($ch, CURLOPT_URL, $base_url.'?csrfToken='.$csrfToken.'&authToken='.$auth_Token);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
//Execute the request, Get the Errors & close the cURL handle
$response = curl_exec($ch);
$errors = curl_error($ch);
// The response data will be in x-www-form-urlencode format
// Explode String data using "&" and "=".
$params = explode('&', $response);
foreach ($params as $element) {
list($key, $value) = explode('=', $element);
// Display payment response
echo "<center>⚞<b>------Payment Complete Response------</b>⚟</br></br>";
echo "☛ "."Request ID : ".$csrfToken."</br></br>";
echo "☛ "."Client Ref : ".$results['clientRef']."</br></br>";
echo "☛ "."Comment : ".$results['comment']."</br></br></center>";
echo "☛ "."Card Type : ".$results['cardType']."</br></br>";
echo "☛ "."Card Holder Name : ".$results['cardHolderName']."</br></br>";
echo "☛ "."Card Number : ".$results['cardNumber']."</br></br>";
echo "☛ "."Card Expiry : ".$results['cardExpiry']."</br></br>";
echo "☛ "."Payment Amount : ".$results['paymentAmount']."</br></br>";
echo "☛ "."Currency : ".$results['currency']."</br></br>";
echo "☛ "."Transaction ref number : ".$results['txnReference']."</br></br>";
echo "☛ "."Response Code : ".$results['responseCode']."</br></br>";
echo "☛ "."Response Text : ".$results['responseText']."</br></br>";
// FURTHER PROCESSING OF THE PAYMENT.......