-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathindex.html
68 lines (58 loc) · 1.87 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
<!-- Paystack example using Vue composition api -->
<html>
<head>
<title>Vue PayStack Example</title>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css"
integrity="sha384-5sAR7xN1Nv6T6+dT2mhtzEpVJvfS3NScPQTrOxhwjIuvcA67KV2R5Jz6kr4abQsz" crossorigin="anonymous">
<script src="https://unpkg.com/vue@next"></script>
<script src="../dist/paystack.umd.min.js"></script>
<style>
body {
font-size: 1em;
font-family: 'Tahoma', sans-serif;
}
</style>
</head>
<body>
<div id="app">
<pay-stack :amount="amount" :email="email" :paystackkey="paystackkey" :reference="reference" :callback="callback"
:close="close" :embed="false" />
<i class="fas fa-money-bill-alt"></i>
Make Payment
</pay-stack>
</div>
<script>
const app = Vue.createApp({
components: { 'PayStack': Paystack.default, },
setup() {
const paystackkey = Vue.ref("pk_test_xxxxxxxxxxxxxxxxxxxxxx")
const email = Vue.ref("[email protected]")
const amount = Vue.ref(1000000)
let reference = Vue.computed(() => {
let text = "";
let possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (let i = 0; i < 10; i++)
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
})
let callback = (response) => {
console.log('this is a callback',{ response })
};
let close = () => {
console.log('payment closed')
};
return {
reference: reference,
callback: callback,
close: close,
paystackkey: paystackkey.value,
email: email.value,
amount: amount.value,
}
}
})
app.mount('#app')
</script>
</body>
</html>