JSFiddle - React, Tailwind, and code Playground

by yassinezerguine

HTML

<script src="https://checkout.stripe.com/checkout.js"></script>
<button id="customButton">Purchase</button>

JavaScript

var handler = StripeCheckout.configure({
  key: 'pk_test_RZbZyo9yiaiRtSx7BwrXiZUn',
  image: 'https://stripe.com/img/documentation/checkout/marketplace.png',
  locale: 'auto',
  zipCode : 'true',
    bitcoin :'true',
    zipCode :'true',
  token: function(token) {
    // You can access the token ID with `token.id`.
    // Get the token ID to your server-side code for use.
  }
});

document.getElementById('customButton').addEventListener('click', function(e) {
  // Open Checkout with further options:
  handler.open({
    name: 'Demo Site',
    description: '2 widgets',
    amount: 2000
  });
  e.preventDefault();
});

// Close Checkout on page navigation:
window.addEventListener('popstate', function() {
  handler.close();
});