Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/impacts.to.git
function stripeHandler() {
  var stripe = Stripe('pk_live_ACHHbTYNkuuJOvCiwyreiNhJ');

  var checkoutButton = document.getElementById('checkout-button-ebook');
  checkoutButton.addEventListener('click', function () {
    // When the customer clicks on the button, redirect to Checkout.
    stripe.redirectToCheckout({
      items: [{sku: 'sku_HF9Fhzo3pYXkJu', quantity: 1}],

      successUrl: window.location.protocol + '//impacts.to/payment-ebook.html',
      cancelUrl: window.location.protocol + '//impacts.to/payment-cancel.html',
    })
    .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;
      }
    });
  });
}