-
Notifications
You must be signed in to change notification settings - Fork 0
/
pay.html
51 lines (51 loc) · 1.71 KB
/
pay.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
<!DOCTYPE html>
<html>
<head>
<title>Oswald Labs</title>
<link rel="stylesheet" href="styles.scss" />
<link
href="https://fonts.googleapis.com/css?family=Public+Sans:400,700&display=swap"
rel="stylesheet"
/>
<script src="https://js.stripe.com/v3"></script>
</head>
<body>
<main>
<button
style="background-color:#6772E5;color:#FFF;padding:8px 12px;border:0;border-radius:4px;font-size:1em;display:block;margin:10%;zoom:2"
id="checkout-button"
role="link"
>
Checkout
</button>
<div id="error-message"></div>
<script>
(function() {
var stripe = Stripe("pk_live_2khUYvJReOob9xJ2QG4l1UoQ");
var checkoutButton = document.getElementById("checkout-button");
var urlParams = new URLSearchParams(window.location.search);
checkoutButton.addEventListener("click", function() {
stripe
.redirectToCheckout({
items: [{ plan: urlParams.get("plan"), quantity: 1 }],
successUrl: "https://landing.oswaldlabs.com/thanks",
cancelUrl: "https://landing.oswaldlabs.com/error",
customerEmail: urlParams.get("customerEmail") || undefined,
})
.then(function(result) {
if (result.error) {
var displayError = document.getElementById("error-message");
displayError.textContent = result.error.message;
}
});
});
checkoutButton.click();
})();
</script>
</main>
<script
src="https://platform-beta.oswaldlabs.com/v1/agastya/load/landing.js"
async
></script>
</body>
</html>