-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
43 lines (40 loc) · 1.46 KB
/
test.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
<!DOCTYPE html>
<html>
<head>
<title>Razorpay Payment Gateway</title>
<!-- Include Razorpay Scripts -->
<script src="https://checkout.razorpay.com/v1/checkout.js"></script>
</head>
<body>
<!-- Your website content here -->
<button id="payButton">Pay Now</button>
<script>
// Your Razorpay key id
const razorpayKey = "rzp_test_4aDlqND5TSaOCe";
// Define a function to initiate the payment
function initiatePayment() {
var options = {
key: razorpayKey,
amount: 10000, // Amount in paise (e.g., 10000 paise = 100 INR)
currency: "INR",
name: "Your Company Name",
description: "Test Transaction",
image: "https://your-company-logo-url.png",
handler: function(response) {
// Handle the response after successful payment
alert("Payment successful! Payment ID: " + response.razorpay_payment_id);
},
prefill: {
name: "John Doe",
email: "john@example.com",
contact: "1234567890"
}
};
var rzp = new Razorpay(options);
rzp.open();
}
// Attach the payment initiation function to the button click event
document.getElementById("payButton").addEventListener("click", initiatePayment);
</script>
</body>
</html>