-
Notifications
You must be signed in to change notification settings - Fork 1
/
pay.php
59 lines (51 loc) · 1.32 KB
/
pay.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
<?php
session_start();
/*ini_set('display_errors', 1);*/
$cust_name= $_POST['cust_name'];
$allvalues= $_SESSION['kela'];
$total= $_POST['total_price'];
$delivery= $_POST['delivery'];
$pay_type= $_POST['pay_type'];
//print_r($cust_name);
$some= json_decode($allvalues);
//print_r($some);
$sent= array();
$items = array();
foreach($some as $arr) {
foreach($arr as $key => $value) {
$items[$key] = $value;
}
/*print_r($items);
echo "<br />";*/
}
if($delivery == 1){
$total= $total + 50;
}
elseif($delivery == 2) {
$total= $total + 150;
}
$_SESSION['del']= $delivery;
if($pay_type ==1){
include("./instamojo/Instamojo.php");
$api = new Instamojo\Instamojo('test_1893cda3724555853115c973acd', 'test_e5f0906c73a453e3cc3283ff86a','https://test.instamojo.com/api/1.1/');
try {
$response = $api->paymentRequestCreate(array(
"purpose" => "Grocery Store",
"amount" => $total,
"send_email" => true,
"email" => $cust_name,
"allow_repeated_payments" => false,
"redirect_url" => "http://localhost/Vegykart/pay_success.php",
));
print_r($response);
$pay_url=$response['longurl'];
header("location:$pay_url");
}
catch (Exception $e) {
print('Error: ' . $e->getMessage());
}
}
else{
header("location:order_success.php");
}
?>