-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathpayment.php
86 lines (53 loc) · 2.2 KB
/
payment.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
<div>
<?php
include("includes/db.php");
$total = 0;
global $con;
$ip = getIp();
$sel_price = "select * from cart where ip_add='$ip'";
$run_price = mysqli_query($con, $sel_price);
while($p_price=mysqli_fetch_array($run_price)){
$pro_id = $p_price['p_id'];
$pro_price = "select * from products where product_id='$pro_id'";
$run_pro_price = mysqli_query($con,$pro_price);
while ($pp_price = mysqli_fetch_array($run_pro_price)){
$product_price = array($pp_price['product_price']);
$product_name = $pp_price['product_title'];
$values = array_sum($product_price);
$total +=$values;
}
}
// getting Quantity of the product
$get_qty = "select * from cart where p_id='$pro_id'";
$run_qty = mysqli_query($con, $get_qty);
$row_qty = mysqli_fetch_array($run_qty);
$qty = $row_qty['qty'];
if($qty==0){
$qty=1;
}
else {
$qty=$qty;
}
?>
<h2 align="center" style="padding:2px;">Pay now with Paypal:</h2>
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" >
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="[email protected]">
<!-- Specify a Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="<?php echo $product_name; ?>">
<input type="hidden" name="item_number" value="<?php echo $pro_id; ?>">
<input type="hidden" name="amount" value="<?php echo $total; ?>">
<input type="hidden" name="quantity" value="<?php echo $qty; ?>">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="return" value="http://www.onlinetuting.com/myshop/paypal_success.php"/>
<input type="hidden" name="cancel_return" value="http://www.onlinetuting.com/myshop/paypal_cancel.php"/>
<!-- Display the payment button. -->
<input type="image" name="submit" border="0"
src="paypal_button.png"
alt="PayPal - The safer, easier way to pay online">
<img alt="" border="0" width="1" height="1"
src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" >
</form>
</div>