-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrazor.php
More file actions
59 lines (51 loc) · 1.8 KB
/
razor.php
File metadata and controls
59 lines (51 loc) · 1.8 KB
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
include('connect.php');
$amount = $_GET['amount'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<a class="buynow">Buy Now</a>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
<script src="https://checkout.razorpay.com/v1/checkout.js"></script>
<script>
$(document).ready(function() {
$(".buynow").click(function(e) {
e.preventDefault(); // Prevent default behavior of anchor tag click
var amount = <?php echo $amount; ?>;
var productname = "Xerox"; // Assuming this variable is defined elsewhere in your code
var options = {
"key": "rzp_live_2D4bAGktbYxm16",
"amount": amount * 100,
"name": "Campus Online",
"description": productname,
"image": "http://localhost/hackathon/img/Campus.png",
"handler": function(response) {
var paymentid = response.razorpay_payment_id;
$.ajax({
url: "payment-process.php",
type: "POST",
data: { product_id: 'your_product_id', payment_id: paymentid }, // Replace 'your_product_id' with the actual product ID
success: function(finalresponse) {
if (finalresponse == 'done') {
window.location.href = "http://localhost/hackathon/success.php";
} else {
alert('Please check console.log to find error');
console.log(finalresponse);
}
}
});
},
"theme": {
"color": "#3399cc"
}
};
var rzp1 = new Razorpay(options);
rzp1.open();
});
});
</script>
</body>
</html>