forked from AkshaykumarLilani/OnlineBicycleShop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpayment.html
105 lines (88 loc) · 2.97 KB
/
payment.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SignUP</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" />
<link rel="stylesheet" href="./styles/navbar.css">
<link rel="stylesheet" href="./styles/footer.css">
<link rel="stylesheet" href="./styles/signup.css">
<link rel="stylesheet" href="./styles/login.css">
<link rel="stylesheet" href="./styles/checkout.css">
<link rel="stylesheet" href="./styles/payment.css">
</head>
<body>
<section id="header1">
</section>
<section id="top1">
</section>
<section class="payment">
<div style="display: flex; justify-content: space-between;">
<!-- Delivery Address Box -->
<div id="deliveryAddressBox">
<h2>Delivery Address</h2>
<div class="line"></div>
<!-- The details will be populated here -->
</div>
<!-- Razor pay section -->
<div style="flex: 1; padding: 20px;">
<div id="payDiv">
<button id="rzp-button1" class="btn btn-outline-dark btn-lg"><i class="fas fa-money-bill"></i> Payment</button>
</div>
</div>
</div>
</section>
<footer id="mainFooter">
</footer>
</body>
</html>
<script src="./script/checkout.js"></script>
<script src="./script/payment.js"></script>
<script src="https://checkout.razorpay.com/v1/checkout.js"></script>
<script src="/script/navbar.js" type="module"></script>
<script>
// let price = parseInt(localStorage.getItem("finalPrice")) * 100;
let price = 24523 * 100;
var options = {
"key": "rzp_test_rPXS0eKEZLLd9S", // Enter the Key ID generated from the Dashboard
"amount": price.toString(),
"currency": "INR",
"description": "Acme Corp",
"prefill": {
"email": "gaurav.kumar@example.com",
"contact": "+919900000000", // Note: Added "+" to make it a string
},
config: {
// ... (your config settings)
},
"handler": function (response) {
// Handle the response from Razorpay
// alert(response.razorpay_payment_id);
// Check if the payment is successful
if (response.razorpay_payment_id) {
// Redirect to the success page
window.location.href = "success.html";
} else {
// Handle payment failure or dismissal
console.log("Payment failed or dismissed");
}
},
"modal": {
"ondismiss": function () {
if (confirm("Are you sure, you want to close the form?")) {
txt = "You pressed OK!";
console.log("Checkout form closed by the user");
} else {
txt = "You pressed Cancel!";
console.log("Complete the Payment")
}
}
}
};
var rzp1 = new Razorpay(options);
document.getElementById('rzp-button1').onclick = function (e) {
rzp1.open();
e.preventDefault();
}
</script>