<!doctype html>
<html>
<head>
<title>stripe USD featuring javascript</title>
<link rel="stylesheet" href="/global.css" type="text/css">
<meta http-equiv="cache-control" content="NO-CACHE" />
</head>
<body>
<h3>Donate to The NetBSD Foundation with Stripe</h3>
<!-- Load Stripe.js on your website. -->
<script src="https://js.stripe.com/v3"></script>
<script>
qselect=10;
</script>
<!-- Create a button that your customers click to complete their purchase. Customize the styling to suit your branding. -->
<button
style="background-color:#6772E5;color:#FFF;padding:8px 12px;border:0;border-radius:4px;font-size:1em"
id="checkout-button-price_1IaLlz2y9v89cZ3UIlaGXWy1"
role="link"
type="button"
>
Donate $10
</button>
<!--
<input type=number min="10" max="990" step=10 value=10 maxlength=4 id=qselect
style="background-color:#6772E5;color:#FFF;padding:8px 12px;border:0;border-radius:4px;font-size:1em;max-width:4em;" />
-->
<button id=plus style="background-color:clear;padding:5px 10px; font-size:1em;">+</button>
<script>
var plusbutton = document.getElementById('plus');
plusbutton.addEventListener('click', function() {
qselect = qselect+10;
var donatebutton = document.getElementById('checkout-button-price_1IaLlz2y9v89cZ3UIlaGXWy1');
donatebutton.innerText = "Donate $" + qselect;
});
</script>
<p>
<a href=/cgi-bin/donate.py>change currency or other amounts</a>
</p>
<p>
<a href=/>home</a>
</p>
<div id="error-message"></div>
<script>
(function() {
var stripe = Stripe('pk_live_tK1WV2cKgBtS259LsgA0NC41');
var checkoutButton = document.getElementById('checkout-button-price_1IaLlz2y9v89cZ3UIlaGXWy1');
checkoutButton.addEventListener('click', function () {
/*
* When the customer clicks on the button, redirect
* them to Checkout.
*/
var qsel_val = parseInt(qselect);
stripe.redirectToCheckout({
lineItems: [{price: 'price_1IaOWr2y9v89cZ3UCSgKtWve', quantity: qsel_val }],
mode: 'payment',
submitType: 'donate',
/*
* Do not rely on the redirect to the successUrl for fulfilling
* purchases, customers may not always reach the success_url after
* a successful payment.
* Instead use one of the strategies described in
* https://stripe.com/docs/payments/checkout/fulfill-orders
*/
successUrl: window.location.protocol + '//www.NetBSD.org/',
cancelUrl: window.location.protocol + '//www.NetBSD.org/',
})
.then(function (result) {
if (result.error) {
/*
* If `redirectToCheckout` fails due to a browser or network
* error, display the localized error message to your customer.
*/
var displayError = document.getElementById('error-message');
displayError.textContent = result.error.message;
}
});
});
})();
</script>
</body>
</html>
CVSweb <webmaster@jp.NetBSD.org>