Business-Stripe-WebCheckout

 view release on metacpan or  search on metacpan

lib/Business/Stripe/WebCheckout.pm  view on Meta::CPAN

    </head>
    <body>
      <button id="checkout-button">Checkout</button>

      <script type="text/javascript">
        // Create an instance of the Stripe object with your publishable API key
        var stripe = Stripe('pk_test_00000000000000000000000000');
        var checkoutButton = document.getElementById('checkout-button');

        checkoutButton.addEventListener('click', function() {
          // Create a new Checkout Session using the server-side endpoint you
          // created in step 3.
          fetch('https://example.com/cgi-bin/trolley.pl', {
            method: 'POST',
          })
          .then(function(response) {
            return response.json();
          })
          .then(function(session) {
            return stripe.redirectToCheckout({ sessionId: session.id });
          })



( run in 0.305 second using v1.01-cache-2.11-cpan-27979f6cc8f )