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'];
}
}
$dbname = $dbnames[$univcode];
// $servername = "logisys.cluster-cv9maxyrxjgg.ap-south-1.rds.amazonaws.com";
// $username = "admin";
// $password = "Logisys2104";
$databse = $dbname;
$conn = new mysqli($servername,$username,$password,$databse);
if(!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}
$get_data = "select * from maspg where fbank = 'Paytm' and funivcode = '{$univcode}'";
//var_dump($get_data);
$result=$conn->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
//var_dump($paytmChecksum);
//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.
// echo $isValidChecksum;
if($isValidChecksum == "TRUE")
{
$status = $_POST["STATUS"];
//echo $status;
$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,PAYTM_MERCHANT_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";
$url = "https://securegw.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);
// var_dump($data);
if ($data["STATUS"] == "TXN_SUCCESS")
{
$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 "
"; } /* if (isset($_POST) && count($_POST)>0 ) { foreach($_POST as $paramName => $paramValue) { echo "
" . $paramName . " = " . $paramValue; } } */ } /* else { echo "Checksum mismatched."; //Process transaction as suspicious. } */ ?>
Thank You. Your Transaction status is success
"; echo "Your Transaction ID for this transaction is ".$data['TXNID'].".
"; echo "We have received a payment of Rs. " . $data['TXNAMOUNT'] ."
"; if(substr($productinfo,0,1) == 8){ $update="update entstudadm set FPAYREMARKS = '{$txnid}',FPAYID = '{$txnid}', FPAYSTATUS = 'success', FPAYDATE = now() where fappno ='{$productinfo}'"; $result=$conn->query($update); $html="
Click here to take a PrintOut
";
echo $html;
} else if(substr($productinfo,0,1) == 9) {
$update="update entaddcourse set FPAYID = '{$txnid}',
FPAYSTATUS = 'success', FPAYDATE = now() where faddappno ='{$productinfo}'";
$result=$conn->query($update);
$insert = "insert into entoptdeg(fappno, fdegree)
select a.fappno, b.fdegree from entaddcourse a, entdeg b
where faddappno = '{$productinfo}' and instr(a.fdegree, b.fdegree)";
$result=$conn->query($insert);
}else if(substr($productinfo,0,1) == 6){
$pgtype = substr($productinfo,0,1);
$update="update entseatallot set fpaymentid = '{$txnid}',
fpaymentstatus = 'success', fpaymentdate = now()
where fallotno ='{$productinfo}'";
$result=$conn->query($update);
$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. } */ ?>