-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpayment.html
More file actions
153 lines (138 loc) · 4.87 KB
/
Copy pathpayment.html
File metadata and controls
153 lines (138 loc) · 4.87 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Payment</title>
<style>
/* Basic styling for demonstration purposes */
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
color: #333;
padding: 20px;
}
h1 {
color: #333;
text-align: center;
margin-bottom: 20px;
}
.payment-methods, .payment-form {
max-width: 400px;
margin: 0 auto;
background-color: #fff;
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.payment-methods button {
display: flex;
align-items: center;
width: 100%;
padding: 10px;
margin-bottom: 10px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
text-align: left;
}
.payment-methods button:hover {
background-color: #45a049;
}
.payment-methods img {
height: 20px;
margin-right: 10px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
input[type="text"],
input[type="number"] {
width: 100%;
padding: 10px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 5px;
}
.payment-form button {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
}
.payment-form button:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<h1>Payment Methods</h1>
<div class="payment-methods" id="paymentMethods">
<button onclick="selectPaymentMethod('Credit Card')">
<img src="https://via.placeholder.com/20x20.png?text=C" alt="Credit Card">
Credit Card
</button>
<button onclick="selectPaymentMethod('PayPal')">
<img src="https://via.placeholder.com/20x20.png?text=P" alt="PayPal">
PayPal
</button>
<button onclick="selectPaymentMethod('Bank Transfer')">
<img src="https://via.placeholder.com/20x20.png?text=B" alt="Bank Transfer">
Bank Transfer
</button>
</div>
<div class="payment-form" id="paymentForm" style="display: none;">
<form id="detailsForm">
<div id="formContent"></div>
<button type="submit">Pay</button>
</form>
</div>
<script>
function selectPaymentMethod(method) {
document.getElementById("paymentMethods").style.display = "none";
document.getElementById("paymentForm").style.display = "block";
const formContent = document.getElementById("formContent");
switch (method) {
case 'Credit Card':
formContent.innerHTML = `
<label for="cardNumber">Card Number:</label>
<input type="text" id="cardNumber" name="cardNumber" required><br>
<label for="expiryDate">Expiry Date:</label>
<input type="text" id="expiryDate" name="expiryDate" placeholder="MM/YY" required><br>
<label for="cvv">CVV:</label>
<input type="text" id="cvv" name="cvv" required><br>
`;
break;
case 'PayPal':
formContent.innerHTML = `
<label for="paypalEmail">PayPal Email:</label>
<input type="text" id="paypalEmail" name="paypalEmail" required><br>
`;
break;
case 'Bank Transfer':
formContent.innerHTML = `
<label for="accountNumber">Account Number:</label>
<input type="text" id="accountNumber" name="accountNumber" required><br>
<label for="bankName">Bank Name:</label>
<input type="text" id="bankName" name="bankName" required><br>
`;
break;
}
}
document.getElementById("detailsForm").addEventListener("submit", function(event) {
event.preventDefault();
setTimeout(function() {
alert("Payment successful!");
localStorage.setItem('paymentSuccessful', 'true');
window.close();
}, 2000);
});
</script>
</body>
</html>