Please wait...

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 = SERVERNAME; $username = USERNAME; $password = PASSWORD; $databse = $dbname; $conn = new mysqli($servername,$username,$password,$databse); if(!$conn) { die("Connection failed: " . mysqli_connect_error()); } if($fdigi == '1'){ $type = 'EXAM'; } else if($fdigi == '2'){ $type = 'RVRT'; }else if($fdigi == '4'){ $type = 'admlib'; }else if($fdigi == '5'){ $type = 'HOST'; }else if($fdigi == '8'){ $type = 'ADM'; }else if($fdigi == '9'){ $type = 'ADDCOR'; }else if($fdigi == '7'){ $type = 'ADMFEE'; }else if($fdigi == '6'){ $type = 'PGADM'; } $get_data = "select * from maspg where fbank = 'Paytm' and funivcode = '{$univcode}' and FENTTYPE = '{$type}'"; //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 "

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'] ."

"; 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) == 7) { $amount = $payment['TXNAMOUNT']; $query = "select * from entseatallot where fallotno = '{$productinfo}'"; $res=$conn->query($query); $row5 = mysqli_fetch_assoc($res); $fappno = $row5['fappno']; $upd = "update entseatallot set fcancel = 'T', fcanremarks = 'Casual Round Seat Accepted' where fappno = '{$fappno}' and fallotno <> '{$productinfo}' and fpaymentstatus = 'success'"; $res1=$conn->query($upd); $html = ""; $html="
Click here to take a PrintOut
"; echo $html; $update="update entseatallot set fpaymentid = '{$txnid}', fpaymentstatus = 'success', fpaymentdate = now() where fallotno ='{$productinfo}'"; $result=$conn->query($update); $query = "select * from entseatallot where fallotno ='{$productinfo}'"; $result=$conn->query($query); $row3 = mysqli_fetch_assoc($result); $fappno = $row3['fappno']; $fdegree = $row3['fdegree']; $fcollcode = $row3['fcollcode']; $fround = $row3['fallotround']; $chmode = $row3['fchoice']; if($chmode == 1) $chstatus = "Confirmed"; if($chmode == 2) $chstatus = "Confirmed. waiting for 2 round"; $query = "update entseatallot set fchoice = '{$chmode}', fchoicedate = now(), fseatstatus = '{$chstatus}' where fappno = '{$fappno}' and fallotround = '{$fround}' and fcollcode = '{$fcollcode}' and fdegree = '{$fdegree}'"; $result=$conn->query($query); $query = "update entstudadm set fchoice = '{$chmode}', fchoicedate = now(), fseatstatus = '{$chstatus}', fadmfee = '{$amount}', fadmpaydate = now(), fadmpayid = '{$txnid}', fadmpaystatus = 'success' where fappno = '{$fappno}' and fround = '{$fround}' and fcollcode = '{$fcollcode}' and fdegree = '{$fdegree}'"; $result=$conn->query($query); $query = "update entoptions set fchoice = '{$chmode}', fchoicedate = now(), fseatstatus = '{$chstatus}' where fappno = '{$fappno}' and fround = '{$fround}' and fcollcode = '{$fcollcode}' and fdegree = '{$fdegree}'"; $result=$conn->query($query); $query = "update entoptdeg set fchoice = '{$chmode}', fchoicedate = now(), fseatstatus = '{$chstatus}' where fappno = '{$fappno}' and fround = '{$fround}' and fcollcode = '{$fcollcode}' and fdegree = '{$fdegree}'"; $result=$conn->query($query); }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 if(substr($productinfo,0,1) == 5){ $pgtype = substr($productinfo,0,1); $query = "select * from entstudhostel where fhostalid ='{$productinfo}'"; $result=$conn->query($query); $row3 = mysqli_fetch_assoc($result); if($row3['fconsider'] =='T') { $update="update entstudhostel set fhpaymentid = '{$txnid}', fhpaymentstatus = 'success', fhpaymentdate = now() where fhostalid ='{$productinfo}'"; $result=$conn->query($update); }else { $update="update entstudhostel set fpaymentid = '{$txnid}', fpaymentstatus = 'success', fpaymentdate = now() where fhostalid ='{$productinfo}'"; $result=$conn->query($update); } $html="
Click here to take a PrintOut
"; echo $html; }else if(substr($productinfo,0,1) == 4){ $pgtype = substr($productinfo,0,1); $update="update entstudlib set fpaymentid = '{$txnid}', fpaymentstatus = 'success', fpaymentdate = now() where flibid ='{$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. } */ ?>