-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpayment.php
178 lines (143 loc) · 4.74 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<?php
require ('inc/head.php');
require("admin/handlers/db.php");
require("admin/handlers/get_feedback.php");
$price = $_GET['price'];
$user_id = $_GET['user_id'];
$hall_id = $_GET['hall_id'];
$reservation_id=$_GET['reservation_id'];
$newPrice=floatval($price)*.2/3.3;
$newPrice = round($newPrice);
?>
<body>
<?php require ('inc/preloader_area.php');
require ('inc/top_Bar.php');
?>
<?php
if(isset($_SESSION['userId'])){
$userid=$_SESSION['userId'];
require ('inc/LoginHeader.php');
}
else{
require ('inc/Header.php');
}
?>
<!-- ========== Breadcumb start============= -->
<div class="breadcrumb-section">
<div class="container">
<div class="row d-flex justify-content-center align-items-center text-center">
<div class="col-lg-8">
<h2 class="breadcrumb-title wow fadeInLeft" data-wow-duration="1.5s" data-wow-delay=".2s"
style="visibility: visible; animation-duration: 1.5s; animation-delay: 0.2s;">Payment</h2>
<nav aria-label="breadcrumb">
<ol class="breadcrumb d-flex justify-content-center">
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
<li class="breadcrumb-item active" aria-current="page">Payment</li>
</ol>
</nav>
</div>
</div>
</div>
</div>
<!-- ========== Breadcumb end============= -->
<div class="contact-page mb-120 overflow-hidden">
<div class="container-fluid px-0">
</div>
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="section-title text-center">
<br>
<br>
<br>
<h2>Payment</h2>
</div>
<form enctype="multipart/form-data" method="POST">
<div class="row g-4">
<div class="col-md-12">
<div class="form-inner">
<input name="name" id="name" placeholder="Your name" cols="30" rows="10"></input>
<br> <br>
<input name="email" id="email" placeholder="Your email" cols="30" rows="10"></input>
<!-- Replace "test" with your own sandbox Business account app client ID -->
<script src="https://code.jquery.com/jquery-3.6.3.min.js" integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU=" crossorigin="anonymous"></script>
<!-- Set up a container element for the button -->
</div>
</div>
<div class="col-md-12 d-flex justify-content-center">
<div class="form-inner">
</div>
</div>
</div>
</form>
<script src="https://www.paypal.com/sdk/js?client-id=test¤cy=USD"></script>
<div id="paypal-button-container"></div>
<!-- Add the PayPal JavaScript SDK -->
<!-- Create a script to initialize the PayPal button -->
<script>
paypal.Buttons({
onClick: function(data, actions) {
let name = $("#name").val();
let email = $("#email").val();
if (name.length == 0) {
alert("Please enter your name");
return false;
}
if (email.length == 0) {
alert("Please enter your email");
return false;
} else if (!/^\S+@\S+\.\S+$/.test(email)) {
alert("Please enter a valid email address");
return false;
}
},
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: <?= $newPrice ?>
}
}]
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
alert('Transaction completed by ' + details.payer.name.given_name);
let name = $("#name").val();
let user_id = <?= $user_id ?>
let data={
'name':name,
'price':<?= $newPrice?>,
'user_id':<?= $user_id ?>,
'hall_id':<?= $hall_id ?>,
'reservation_id':<?= $reservation_id ?>,
'payment_type':"Paypal",
"payment_id": details.id
}
console.log(data);
$.ajax({
method: 'post',
url:'paymenttable.php',
data: data,
success:function(response){
window.location="/easybooking-main/Bookingthanks.php";
}
})
});
}
}).render('#paypal-button-container');
</script>
</div>
</div>
</div>
</div>
<!-- ========== Home1 Testimonial end============= -->
<?php require ('inc/footer.php');
require('inc/js_file_link.php'); ?>
</body>
</html>