-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom.html
128 lines (124 loc) · 3.61 KB
/
custom.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chapa Inline Payment Demo</title>
<script src="https://js.chapa.co/v1/inline.js"></script>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
padding: 20px;
}
.payment-container {
max-width: 400px;
margin: 0 auto;
padding: 20px;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 5px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
}
#chapa-phone-input-container {
margin-bottom: 15px;
}
#chapa-payment-methods {
margin-bottom: 15px;
text-align: center;
}
button#chapa-pay-button {
display: block;
width: 100%;
padding: 10px;
font-size: 16px;
border: none;
cursor: pointer;
background-color: #892289;
color: #FFFFFF;
border-radius: 10px;
}
button#chapa-pay-button:hover {
background-color: #6BB300;
}
.chapa-payment-method {
display: inline-block;
cursor: pointer;
text-align: center;
transition: transform 0.2s, box-shadow 0.2s;
border-radius: 10px;
padding: 8px;
width: 60px;
height: 60px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}
.chapa-payment-method img {
width: 32px;
height: 32px;
margin-bottom: 5px;
}
.chapa-payment-method span {
display: block;
font-size: 10px;
}
.chapa-payment-method.selected {
transform: scale(1.1);
box-shadow: 0 0 10px rgba(0, 123, 255, 0.5); /* Blue glow */
border: 2px solid #007BFF; /* Blue border */
background-color: #f0f8ff; /* Light blue background */
}
#chapa-error-container {
color: #FF0000;
margin-top: 5px;
font-size: 14px;
font-weight: bold;
display: none;
}
#chapa-loading-container {
display: none;
text-align: center;
margin-top: 20px;
}
.chapa-spinner {
border: 4px solid rgba(0, 0, 0, 0.1);
border-top: 4px solid #007BFF;
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
margin: 0 auto;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<div class="payment-container" id="chapa-inline-form"></div>
<script>
const chapa = new ChapaCheckout({
publicKey: 'CHAPUBK-jAUMgGr2eCLXX2isTp3nu5qhfuKBROQb',
amount: '100',
currency: 'ETB',
mobile: '0911223344',
showFlag: true,
showPaymentMethodsNames: true,
onSuccessfulPayment: (result, refId) => {
console.log("Payment successful:", result, refId);
},
onPaymentFailure: (errorMessage) => {
console.error("Payment failed:", errorMessage);
},
onClose: () => {
console.log("Payment popup closed.");
}
});
chapa.initialize();
</script>
</body>
</html>