-
Notifications
You must be signed in to change notification settings - Fork 23
/
popup-donation.html
61 lines (55 loc) · 1.57 KB
/
popup-donation.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
/>
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="stylesheet" href="./styles.css" />
<title>Paylike.io SDK examples</title>
</head>
<body>
<p>This is an example of a simple donation style popup.</p>
<button>Try it (donate)</button>
<ul>
<li><a href="popup-minimal.html">Minimal popup example</a></li>
<li><a href="popup-custom.html">Elaborate popup example</a></li>
</ul>
<a href="https://github.com/paylike/sdk">SDK documentation on GitHub</a>
<script src="https://sdk.paylike.io/10.js"></script>
<script>
const key = console.error('Insert your Paylike public key')
const paylike = Paylike({key})
document.querySelector('button').addEventListener('click', donate)
function donate() {
paylike.pay(
{
title: "Save John's coffee shop",
description:
'Thank you for your kindness. By donating you help us keep the shop open to everyone.',
amount: {currency: 'USD', exponent: 0, value: 10},
fields: [
{
name: 'name',
placeholder: 'John Doe',
},
{
type: 'amount',
value: '10.00',
required: true,
},
],
},
(err, r) => {
if (err) return console.log(err)
console.log(r)
// location.href = '/thank-you'
}
)
}
</script>
</body>
</html>