File: /home/durgeshpandey215/www/zeeroprice.skilladders.com/pg4mrp.php
<? require "application_top.php";
$orderid = isset($_REQUEST['idtopg'])? decode($_REQUEST['idtopg']):'';
$sql = "select * from orders where orderid = ? and istatus = ? limit 1";
$param = array($orderid,0);
$rows = $db->rawQuery($sql,$param);
if(count($rows)){
//require "instamojo/src/Instamojo.php";
//$api = Instamojo\Instamojo::init($authType,["client_id" =>'e1553103ecd05360bdd4bb1349286d31',"client_secret" => '1f45c89037441f3f9f5d5604bad1b55f']);
require "Instamojo.php";
//for test
$api = new Instamojo\Instamojo('test_e859b91b54ac056c861c954168a', 'test_0f91a8a7327439c93f5a9305dcb');
//For Live
//$api = new Instamojo\Instamojo('e1553103ecd05360bdd4bb1349286d31', '1f45c89037441f3f9f5d5604bad1b55f');
try {
$response = $api->paymentRequestCreate(array(
"purpose" => "OrderId: ".$orderid ,
"amount" => $rows[0]['totalamount'],
"buyer_name" => $_SESSION['fullnamesession'],
"phone" => "9222369691",
"send_email" => false,
"email" => $_SESSION['emailidsession'],
"redirect_url" => HTTP_SERVER."handle_redirect.php"
));
//print_r($response);exit;
if($response['longurl']){
//update orders table with paymentrequestid
$updatedata = array(
'paymentrequestid'=>$response['id']
);
$db->where('orderid',$orderid);
$db->update('orders',$updatedata);
header('location:'.$response["longurl"]);exit;
}
}
catch (Exception $e) {
print('Error: ' . $e->getMessage());
}
}else{
$_SESSION['msg']="Something went wrong";
header('location:index.php');exit;
}
?>