-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
40 lines (37 loc) · 1.41 KB
/
script.js
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
const form = document.getElementById('donation-form');
const paymentGateway = document.getElementById('payment-gateway');
form.addEventListener('submit', (e) => {
e.preventDefault();
const name = document.getElementById('name').value;
const email = document.getElementById('email').value;
const phone = document.getElementById('phone').value;
const organization = document.getElementById('organization').value;
const donationAmount = document.getElementById('donation-amount').value;
// Razorpay payment gateway integration
const razorpayOptions = {
key: 'YOUR_RAZORPAY_KEY', // Replace with your Razorpay key
amount: donationAmount * 100, // Convert to paise
currency: 'INR',
name: 'Pad Donation Website',
description: 'Donation to Pad Donation Website',
image: 'https://example.com/image.jpg', // Replace with your logo image
handler: function(response) {
// Handle payment success
console.log(response);
alert('Payment successful!');
},
prefill: {
name: name,
email: email,
contact: phone,
},
notes: {
organization: organization,
},
theme: {
color: '#4CAF50',
},
};
const razorpayCheckout = new Razorpay(razorpayOptions);
razorpayCheckout.open();
});