MOON
Server: Apache
System: Linux ip-208-109-13-31.ip.secureserver.net 3.10.0-1160.119.1.el7.tuxcare.els4.x86_64 #1 SMP Sat Aug 31 06:58:57 UTC 2024 x86_64
User: durgeshpandey215 (1013)
PHP: 8.1.29
Disabled: NONE
Upload Files
File: /home/durgeshpandey215/public_html/zeeroprice.skilladders.com/pgint.php
<?php
require "application_top.php";
require "protect.php";
$packid = isset($_POST['packid'])? $_POST['packid'] : "";
$order_id = $_SESSION['useridsess'].date('YmdHis');

//Get package details
$db->where('id',$packid);
$rowpack = $db->getOne('pointspackage');

//Get User details
$db->where('userid',$_SESSION['useridsess']);
$rowu = $db->getOne('register');

$custemailid = ($rowu['emailid'])? $rowu['emailid'] : "info@".DOMAIN;
$cashArr = array(
  "order_id" => $order_id,
  "order_amount" => $rowpack['cost'],
  "order_currency" => $rowpack['currency'],
  "order_note" => $rowpack['packagename']." Coins:".$rowpack['points'],
  "customer_details" => array(
   "customer_id" => "".$_SESSION['useridsess']."",
    "customer_name" => $rowu['fullname'],
    "customer_email" => $custemailid,
    "customer_phone" => $rowu['mobno']
  ),
  "order_meta"=> array(
	"return_url" => HTTP_SERVER."cashfree-response.php?order_id={order_id}",
	"notify_url" => HTTP_SERVER."cashfree-notify.php"
  )
);
$jsonFieldsArr = json_encode($cashArr);
/*
"order_id":"string",
"order_amount":10.15,
"order_currency":"INR",
"customer_details":{"customer_id":"7112AAA812234",
	"customer_email":"john@cashfree.com",
	"customer_phone":"9908734801",
	"customer_bank_account_number":"1518121112",
	"customer_bank_ifsc":"CITI0000001",
	"customer_bank_code":3333
	},
"terminal":{"terminal_phone_no":6309291183,
	"terminal_id":1,
	"terminal_type":"SPOS"
	},
"order_meta":{"return_url":"http://localhost/zeeroprice.com/contact-us.php?order_id={order_id}",
	"notify_url":"http://localhost/zeeroprice.com/about-us.php"},
"order_expiry_time":"2024-07-29T00:00:00Z",
"order_note":"Test order",
"order_tags":{"additionalProp":"string"},
"order_splits":[{"vendor_id":"Vendor01",
	"amount":"100.1"}]",
*/ 
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://sandbox.cashfree.com/pg/orders",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => $jsonFieldsArr,
  CURLOPT_HTTPHEADER => [
    "accept: application/json",
    "content-type: application/json",
    "x-api-version: 2022-09-01",
	"x-client-id: TEST362983010987cf24fea23cf6df389263",
	"x-client-secret: TEST3484cc1ff3ee2571e561ce17bc0b7c6ff31143fd"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
	$respo = json_decode($response, true);
  //print_r($respo);
  if(isset($respo['payment_session_id'])){
//If you get payment_session_id record data in transaction table
	//insert in transaction table
	$insertdata = array(
	'userid'=>$_SESSION['useridsess'],
	'transactionid'=> $order_id,
	'amount'=>$rowpack['cost'],
	'credited'=> $rowpack['points'],
	'remark'=> $rowpack['packagename'],
	'postedon'=> CURDATETIME
	);
	$db->insert('transactions',$insertdata);
	
  }else{
	  $_SESSION['msg']= "Error: ".$respo['message'];
	  header('location:'.HTTP_SERVER."wallet.php");exit;
  }
}

?>
<body onload="render()">
<script src="https://sdk.cashfree.com/js/ui/2.0.0/cashfree.sandbox.js"></script>
<script>
function render() {
  let paymentSessionId = document.getElementById("paymentSessionId").value;
  if (paymentSessionId == "") {
    alert("No session_id specified");
    return
  };
const cf = new Cashfree(paymentSessionId);
  cf.redirect();
  };
</script>
<h4>
Processing...<br/>
DO NOT PRESS Refresh/Back Button.
</h4>
<input type="hidden" id="paymentSessionId" value="<?=$respo['payment_session_id'];?>" class="inputText">
<!-- 
<p>
  <p class="order-token">Choose components</p>
  <input class="drops" type="checkbox" value="order-details" checked>
  Order Details
  </input>
  <input class="drops" type="checkbox" value="card" checked>
  Card
  </input>
  <input class="drops" type="checkbox" value="upi">
  UPI
  </input>
  <input class="drops" type="checkbox" value="app">
  Wallets
  </input>
  <input class="drops" type="checkbox" value="netbanking">
  Netbanking
  </input>
<input class="drops" type="checkbox" value="paylater">
  Paylater
  </input>
<input class="drops" type="checkbox" value="credicardemi">
  Credit Card EMI
  </input>
<input class="drops" type="checkbox" value="cardlessemi">
  Cardless EMI
  </input>
</p>
<div class="style-container" style="display:none">
<p class="order-token">Style your Dropin</p>
  <input class="style-dropin" type="text"
   id="backgroundColor"      placeholder="Background Color"></input>
<input class="style-dropin" type="text"     id="theme" placeholder="Theme">
<input class="style-dropin" type="text"  id="color" placeholder="Color">
<input class="style-dropin" type="text"  id="errorColor" placeholder="Error Color">
<input class="style-dropin" type="text" id="fontSize" placeholder="Font Size">
<input class="style-dropin" type="text" id="fontFamily" placeholder="Font Family">
</div> 
<button class="btn-render" onclick=render()>Render</button>
-->
</div>
<!-- <div class="dropin-parent" id="drop_in_container">
  Your drop will come here
</div> -->