Search…
HTML Checkout
Collect payments from your customers using Klasha inline in your HTML file.
Sample implementation:
1
<html>
2
<head>
3
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
4
<script type="text/javascript" src="https://klastatic.fra1.digitaloceanspaces.com/test/js/klasha-integration.js">
5
</script>
6
</head>
7
<body>
8
<form>
9
<input type="button" onclick="payWithKlasha()" value="Pay With Klasha" />
10
</form>
11
<script>
12
function payWithKlasha() {
13
var kit = {
14
currency: billingCurrency,
15
phone_number: '{{phoneNumber}}',
16
email:'{{email}}',
17
fullname: '{{firstname}}' + " " + '{{lastname}}',
18
tx_ref: '{{reference}}',
19
callBack: callWhenDone
20
}
21
var client = new KlashaClient('{{key}}', 1, {{amount}}, "ktest", "callback", '{{billingCurrency}}', '{{currency}}', kit);
22
client.init();
23
}
24
function callWhenDone(data) {
25
console.log(data);
26
}
27
</script>
28
</body>
29
</html>
Copied!
Copy link