| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/b2bzend/ |
Upload File : |
<?php
function GUIDD() {
if (function_exists('com_create_guid') === true) {
return trim(com_create_guid(), '{}');
}
return sprintf('%04X%04X%04X%04X%04X%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
}
$requestdata = array(
"customer_details" => array("customer_id" => "12345",
"customer_email" => "prashant@catpl.co.in",
"customer_phone" => "9015562063"),
"order_amount" => 4,
"order_currency" => "INR",
"order_note" => "test order",
"order_meta" => array(
"return_url" => "https://globaltravelexchange.com/returnCashfee.php?order_id={order_id}"
),
"order_tags" => [
"name" => "Walter White",
"nick" => "Heisenberg",
"company" => "AMC"
]
);
//echo json_encode($requestdata);
$result["payment_session_id"] = "";
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.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 => json_encode($requestdata),
CURLOPT_HTTPHEADER => [
"Accept: application/json",
"Content-Type: application/json",
"x-api-version: 2022-09-01",
"x-client-id:19138011231ce93919277859ef083191",
"x-client-secret:6ad71d5ec9371a77301b9d3ff1476652d82d53cb"
],
]);
$response = curl_exec($curl);
echo "<pre>";print_r($response);exit;
$err = curl_error($curl);
curl_close($curl);
if ($err) {
header('Content-Type: application/json; charset=utf-8');
echo json_encode(array("error" => 1));
echo "cURL Error #:" . $err;
die();
} else {
$result = json_decode($response, true);
$filename = 'abcd.txt';
file_put_contents($filename, $response);
}
if ($result["payment_session_id"] != "") {
?>
<html>
<head></head>
<body>
<script src="https://sdk.cashfree.com/js/ui/2.0.0/cashfree.prod.js"></script>
<script>
const paymentSessionId = "<?php echo $result["payment_session_id"]; ?>";
const cf = new Cashfree(paymentSessionId);
cf.redirect();
</script>
</body>
</html>
<?php } ?>