query($get_data);
if (mysqli_num_rows($result) > 0)
{
while($row = mysqli_fetch_assoc($result))
{
$key = $row['fkey'];
$mid = $row['fmid'];
$fworkingid = $row['fworkingid'];
$fmode = $row['fmode'];
$freturnurl = $row['freturnurl'];
}
}
$paytmChecksum = isset($_POST["CHECKSUMHASH"]) ? $_POST["CHECKSUMHASH"] : ""; //Sent by Paytm pg
//Verify all parameters received from Paytm pg to your application. Like MID received from paytm pg is same as your application�s MID, TXN_AMOUNT and ORDER_ID are same as what was sent by you to Paytm PG for initiating transaction etc.
$isValidChecksum = verifychecksum_e($paramList, $key, $paytmChecksum); //will return TRUE or FALSE string.
if($isValidChecksum == "TRUE") {
$status = $_POST["STATUS"];
//echo $status;
//print_r($_POST);
$orderid = $_POST["ORDERID"];
$productinfo = $_POST["MERC_UNQ_REF"];
$txnid = $_POST["TXNID"];
$MID = $_POST["MID"];
$CHECKSUMHASH = $_POST["CHECKSUMHASH"];
//echo $productinfo;
//$productinfo = '103E3050155';
$MID = $mid;
$requestParamList = array();
$responseParamList = array();
$requestParamList = array("MID" => "{$MID}" , "ORDERID" => "{$orderid}", "MERC_UNQ_REF" => "{$productinfo}");
$checkSum = getChecksumFromArray($requestParamList,$key);
$requestParamList['CHECKSUMHASH'] = urlencode($checkSum);
$data_string = "JsonData=".json_encode($requestParamList);
$ch = curl_init(); // initiate curl
//$url = "https://securegw-stage.paytm.in/merchant-status/getTxnStatus";
// where you want to post data
//$url = "https://securegw.paytm.in/merchant-status/getTxnStatus";
//$url = "https://securegw.paytm.in/merchant-status/getTxnStatus";
$url = "https://securegw-stage.paytm.in/merchant-status/getTxnStatus";
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, true); // tell curl you want to post something
curl_setopt($ch, CURLOPT_POSTFIELDS,$data_string); // define what you want to post
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // return the output in string format
$headers = array();
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$output = curl_exec($ch); // execute
$info = curl_getinfo($ch);
$data = json_decode($output, true);
//echo $data;
if ($data["STATUS"] == "TXN_SUCCESS") {
$servername = "logisys.cluster-cv9maxyrxjgg.ap-south-1.rds.amazonaws.com";
$username = "admin";
$password = "Logisys2104";
$dbname = "logisys3_comexam";
$conn = new mysqli($servername, $username, $password, $dbname);
$get_data = "select * from dbname where funivcode ='{$univcode}'";
//var_dump($get_data);
$result1=$conn->query($get_data);
if (mysqli_num_rows($result1) > 0)
{
$dbnames = array();
$uniname = "";
$ffolder = "";
while($row = mysqli_fetch_assoc($result1))
{
$dbnames[$row['FUNIVCODE']] = $row['FDBNAME'];
$uniname = $row['FUNIVNAME'];
$FUNIVCODE = $row['FUNIVCODE'];
$ffolder = $row['FFOLDER'];
}
}
$servername = "logisys.cluster-cv9maxyrxjgg.ap-south-1.rds.amazonaws.com";
$username = "admin";
$password = "Logisys2104";
$dbname = $dbnames[$univcode];
//$dbname = "logisys3_bcu";
/*$servername = "localhost";
$username = "root";
$password = "";
$dbname = "logisys3_dud";*/
$conn = new mysqli($servername, $username, $password, $dbname);
$status = $data["STATUS"];
$ORDERID = $data["ORDERID"];
$productinfo = $data["MERC_UNQ_REF"];
$txnid = $data["TXNID"];
$MID = $data["MID"];
//$CHECKSUMHASH = $data["CHECKSUMHASH"];
$txnid = $data['TXNID'];
$firstname = 'Paytm';
echo " ";
echo "
";
echo $html;
$update_pg="update pgdet set ftxnid = '{$txnid}', fstatus = '{$status}', fupddate = now()
where appno = '{$productinfo}' and forderid = '{$ORDERID}'";
// $result_pg=$conn->query($update_pg);
$update="update studadm set FPAYREMARKS = '{$txnid}',FPAYID = '{$txnid}',
FPAYSTATUS = 'success', FPAYDATE = now(), FPAYTYPE = 'Paytm'
where fappno ='{$productinfo}'";
$result=$conn->query($update);
echo "
"; } // if (isset($_POST) && count($_POST)>0 ) // { // foreach($_POST as $paramName => $paramValue) { // echo "
" . $paramName . " = " . $paramValue; // } // } } else { echo "Checksum mismatched."; //Process transaction as suspicious. } ?>
".$uniname."
Thank You. Your Payment is success
"; echo "Your Transaction ID for this transaction is : ".$data['TXNID'].".
"; echo "We have received a payment of Rs. : " . $data['TXNAMOUNT'] ."
"; $html="Thank You. Your order status is success
"; echo "Your Transaction ID for this transaction is ".$data['TXNID'].".
"; echo "We have received a payment of Rs. " . $data['TXNAMOUNT'] ."
"; $html="
Click here to take a PrintOut
";
echo $html;
}
else {
echo "Transaction status is failure" . ""; } // if (isset($_POST) && count($_POST)>0 ) // { // foreach($_POST as $paramName => $paramValue) { // echo "
" . $paramName . " = " . $paramValue; // } // } } else { echo "Checksum mismatched."; //Process transaction as suspicious. } ?>