-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckout.html
More file actions
141 lines (118 loc) · 4.35 KB
/
checkout.html
File metadata and controls
141 lines (118 loc) · 4.35 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
<!D<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Pay Now - Vince Investment and Solution Ltd</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f6f8fa;
margin: 0;
padding: 20px;
}
.container {
max-width: 500px;
margin: 50px auto;
background-color: #fff;
padding: 30px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
border-radius: 8px;
}
h2 {
text-align: center;
color: #2b2b2b;
}
label {
display: block;
margin-top: 15px;
font-weight: bold;
}
input {
width: 100%;
padding: 10px;
margin-top: 5px;
border: 1px solid #ccc;
border-radius: 4px;
}
button {
margin-top: 20px;
width: 100%;
padding: 12px;
background-color: #28a745;
color: white;
border: none;
border-radius: 4px;
font-size: 16px;
cursor: pointer;
}
button:hover {
background-color: #218838;
}
</style>
</head>
<body>
<div class="container">
<h2>Pay Now - Vince Investment and Solution Ltd</h2>
<form id="paymentForm">
<label for="email">Email Address</label>
<input type="email" id="email-address" required />
<label for="phone">Phone Number</label>
<input type="tel" id="phone-number" required />
<label for="city">City</label>
<input type="text" id="city" required />
<label for="address">Address</label>
<input type="text" id="address" required />
<label for="amount">Amount (₦)</label>
<input type="number" id="amount" required />
<button type="submit">Pay Now with Paystack</button>
</form>
</div>
<!-- Paystack Inline Script -->
<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();
const email = document.getElementById("email-address").value;
const phone = document.getElementById("phone-number").value;
const city = document.getElementById("city").value;
const address = document.getElementById("address").value;
const otp = document.getElementById("otp").value;
const amount = document.getElementById("amount").value * 100; // in kobo
let handler = PaystackPop.setup({
key: 'pk_test_xxxxxxxxxxxxxxxxxxxxxxxx', // Replace with your public key
email: email,
amount: amount,
currency: 'NGN',
ref: 'VINCE_' + Math.floor((Math.random() * 1000000000) + 1), // unique reference
metadata: {
custom_fields: [{
display_name: "Phone Number",
variable_name: "phone_number",
value: phone
}, {
display_name: "City",
variable_name: "city",
value: city
}, {
display_name: "Address",
variable_name: "address",
value: address
}, {
}]
},
callback: function(response) {
alert('Payment successful! Reference: ' + response.reference);
// You can now verify payment on the server using this reference
},
onClose: function() {
alert('Transaction was cancelled.');
}
});
handler.openIframe();
}
</script>
</body>
</html>