-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathindex.html
91 lines (69 loc) · 1.98 KB
/
index.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
<!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>Lazerpay</title>
<script src="https://cdn.jsdelivr.net/gh/LazerPay-Finance/checkout-build@main/[email protected]/dist/index.js"
type="text/javascript">
</script>
</head>
<body onload="setupLazerCheckout()" style="
border-radius: 20px;
background-color: #fff;
height: 100vh;
overflow: hidden;
">
<script type="text/javascript">
// Send callback to dart JSMessageClient
function sendMessage(message) {
console.log(JSON.stringify(message));
}
// Send raw callback to dart JSMessageClient
function sendMessageRaw(message) {
console.log(message);
}
(function (ns, fetch) {
if (typeof fetch !== 'function') return;
ns.fetch = function () {
var out = fetch.apply(this, arguments);
// side-effect
out.then(async (ok) => {
var data = await ok.clone().json();
sendMessage(data)
});
return out;
}
}(window, window.fetch))
window.onload = setupLazerCheckout;
function setupLazerCheckout() {
LazerCheckout({
name: "Chizi",
email: "[email protected]",
amount: "1000",
key: "pk_live_speggQJcM2FEZAdjkeuWvpqBfXUpUkjy50099CvrNRyow8hKv9",
currency: "NGN",
onClose: (data) =>
sendMessage({
type: "$ON_CLOSE",
}),
callback: (data) =>
sendMessage({
type: "$ON_SUCCESS",
data: { ...data },
}),
onError: (data) =>
sendMessage({
type: "$ON_ERROR",
data: { ...data },
}),
});
// Add EventListener for onMessage Event
window.addEventListener("message", (event) => {
sendMessage(event.data);
});
}
</script>
</body>
</html>