-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstamojo.php
94 lines (80 loc) · 2.86 KB
/
instamojo.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
include 'config.php';
session_start();
// $product_total=$_GET['product_total'];
$user = $_SESSION['username'];
$db = new Database();
$db->select('options','site_name',null,null,null,null);
$site_name = $db->getResult();
// $db2=new Database();
// $db2->select('products','',null,null,null,null);
// $product_total=$db->getResult();
///$ch = curl_init();
///curl_setopt($ch, CURLOPT_URL, 'https://test.instamojo.com/api/1.1/payment-requests/');
///curl_setopt($ch, CURLOPT_HEADER, FALSE);
///curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
///curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
///curl_setopt($ch, CURLOPT_HTTPHEADER,
/// array("X-Api-Key:test_f95508c7ff3dc44e5240321ee4c",
/// "X-Auth-Token:test_6a29ac898bb6e073597e3c1ed8a"));
///$payload = Array(
/// 'purpose' => 'Payment to '.$site_name[0]['site_name'],
/// 'amount' => $_POST['product_total'],
// 'phone' => '',
/// 'buyer_name' => $user,
/// 'redirect_url' => $hostname.'/success.php',
// 'send_email' => true,
// 'webhook' => 'http://www.example.com/webhook/',
// 'send_sms' => true,
// 'email' => '[email protected]',
///'allow_repeated_payments' => false
///);
///curl_setopt($ch, CURLOPT_POST, true);
///curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($payload));
///$response = curl_exec($ch);
///curl_close($ch);
///$response = json_decode($response);
//echo '<pre>';
//print_r($response);
//exit;
///$_SESSION['TID'] = $response->payment_request->id;
$params1 = [
'item_number' => $_POST['product_id'],
/// 'txn_id' => $response->payment_request->id,
'payment_gross' => $_POST['product_total'],
'payment_status' => 'credit',
];
$params2 = [
'product_id' => $_POST['product_id'],
'product_qty' => $_POST['product_qty'],
'total_amount' => $_POST['product_total'],
'product_user' => $_SESSION['user_id'],
'order_date' => date('Y-m-d'),
/// 'pay_req_id' => $response->payment_request->id
];
$db = new Database();
$db->insert('payments',$params1);
$db->insert('order_products',$params2);
$db->getResult();
include 'header.php';
///header('Location: '.$response->payment_request->longurl);
?>
<div >
<h2><center>THANK YOU!</center></h2><br>
<h4><center>Your order has been placed</center></h4>
<p>
<center>
Your user id : <?php echo $_SESSION['user_id']?><br>
Your Product id: <?php echo $_POST['product_id']?><br>
Your Product quantity: <?php echo $_POST['product_qty']?><br>
Total: <?php echo $_POST['product_total']?><br>
Order Date: <?php echo date('Y-m-d')?><br>
</center>
</p>
<p>
<center>
<a class="btn btn-sm btn-primary remove-cart-item" href="index.php" data-id="<?php echo $row['product_id']; ?>"><i class="fa fa-add">Continue</i></a>
</center>
</p>
</div>
<?php include 'footer.php'; ?>