-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrequest.php
66 lines (59 loc) · 2.15 KB
/
request.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
ob_start();
include 'header.php';
include 'partials/_categories_nav.php';
if(!isset($_POST['orderId'])){
header('location:index.php');
}
?>
<?php
$mode = "TEST"; //<------------ Change to TEST for test server, PROD for production
extract($_POST);
$secretKey = ""; /* enter secret key here */
$postData = array(
"appId" => $appId,
"orderId" => $orderId,
"orderAmount" => $orderAmount,
"orderCurrency" => $orderCurrency,
"orderNote" => $orderNote,
"customerName" => $customerName,
"customerPhone" => $customerPhone,
"customerEmail" => $customerEmail,
"returnUrl" => $returnUrl,
"notifyUrl" => $notifyUrl,
);
ksort($postData);
$signatureData = "";
foreach ($postData as $key => $value){
$signatureData .= $key.$value;
}
$signature = hash_hmac('sha256', $signatureData, $secretKey,true);
$signature = base64_encode($signature);
if ($mode == "PROD") {
$url = "https://www.cashfree.com/checkout/post/submit";
} else {
$url = "https://test.cashfree.com/billpay/checkout/post/submit";
}
?>
<form action="<?php echo $url; ?>" id="payForm" name="frm1" method="post">
<p>Please wait.......</p>
<input type="hidden" name="signature" value='<?php echo $signature; ?>'/>
<input type="hidden" name="orderNote" value='<?php echo $orderNote; ?>'/>
<input type="hidden" name="orderCurrency" value='<?php echo $orderCurrency; ?>'/>
<input type="hidden" name="customerName" value='<?php echo $customerName; ?>'/>
<input type="hidden" name="customerEmail" value='<?php echo $customerEmail; ?>'/>
<input type="hidden" name="customerPhone" value='<?php echo $customerPhone; ?>'/>
<input type="hidden" name="orderAmount" value='<?php echo $orderAmount; ?>'/>
<input type ="hidden" name="notifyUrl" value='<?php echo $notifyUrl; ?>'/>
<input type ="hidden" name="returnUrl" value='<?php echo $returnUrl; ?>'/>
<input type="hidden" name="appId" value='<?php echo $appId; ?>'/>
<input type="hidden" name="orderId" value='<?php echo $orderId; ?>'/>
</form>
<script type="text/javascript">
$(document).ready(function(){
$('#payForm').submit();
});
</script>
<?php
include 'partials/_footer.php';
?>