-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpayment-system.html
145 lines (127 loc) · 4.28 KB
/
payment-system.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Payment System</title>
<link rel="icon" href="favicon.ico" type="image/x-icon">
<style>
body {
font-family: Arial, sans-serif;
background-color: #f9f9f9;
color: #333;
margin: 0;
padding: 0;
}
#paymentForm {
width: 650px;
margin: 50px auto;
padding: 20px;
background-color: #fff;
box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.1);
border-radius: 8px;
}
h2 {
text-align: center;
margin-bottom: 20px;
color: #444;
}
.form-group {
margin-bottom: 20px;
}
label {
display: block;
font-weight: bold;
margin-bottom: 5px;
color: #555;
}
input[type="email"],
input[type="tel"],
input[type="text"] {
width: 100%;
padding: 12px;
border: 1px solid black;
border-radius: 5px;
font-size: 16px;
box-sizing: border-box;
background-color: #f7f7f7;
transition: all 0.3s ease-in-out;
}
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="text"]:focus {
border-color: black;
background-color: #fff;
outline: none;
}
button[type="submit"] {
width: 20%;
background-color: rgb(34, 32, 32); /* Match the Account button color */
color: white;
padding: 12px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 18px;
transition: background-color 0.3s ease-in-out;
}
button[type="submit"]:hover {
background-color: black;
}
.form-submit {
margin-top: 20px;
}
</style>
</head>
<body>
<!-- Back to Home Link -->
<div class="text-center mt-3" style="text-align: center; margin-bottom: -20px; margin-top: 10px; font-size: 27px;">
<a href="index.html" class="btn btn-outline-primary">Go Back Home</a>
</div>
<form id="paymentForm">
<h2>Make a Payment</h2>
<div class="form-group">
<label for="email">Email Address</label>
<input type="email" id="email-address" required />
</div>
<div class="form-group">
<label for="amount">Amount</label>
<input type="tel" id="amount" required />
</div>
<div class="form-group">
<label for="first-name">First Name</label>
<input type="text" id="first-name" />
</div>
<div class="form-group">
<label for="last-name">Last Name</label>
<input type="text" id="last-name" />
</div>
<div class="form-submit">
<button type="submit" onclick="payWithPaystack()"> Pay </button>
</div>
</form>
<script src="https://js.paystack.co/v1/inline.js"></script>
<script>
const paymentForm = document.getElementById('paymentForm');
paymentForm.addEventListener("submit", payWithPaystack, false);
function payWithPaystack(e) {
e.preventDefault();
let handler = PaystackPop.setup({
key: 'pk_live_0d8963a3327169024089c20dcabfddd124da6436', // Replace with your public key
email: document.getElementById("email-address").value,
amount: document.getElementById("amount").value * 100,
currency: 'GHS',
onClose: function () {
alert('Window closed.');
},
callback: function (response) {
let message = 'Payment complete! Reference: ' + response.reference;
alert(message);
}
});
handler.openIframe();
}
</script>
</body>
</html>