<script src="jquery.min.js"></script>
<script src="https://checkout.stripe.com/checkout.js"></script>

<button id="customButton">Purchase</button>

<script>
  var handler = StripeCheckout.configure({
    key: 'pk_test_VJL8QTdHlFtJKgArwU1sR8oY',
    image: 'logo.png',
    locale: 'auto',
    token: function(token) {
     // Use the token to create the charge with a server-side script.
      // You can access the token ID with `token.id`
		var $form = $('#payment-form');
	   // response contains id and card, which contains additional card details
		var token = token.id;
		// Insert the token into the form so it gets submitted to the server
		$form.append($('<input type="hidden" name="stripeToken" />').val(token));
		// and submit
		$form.get(0).submit();
    }
  });

  $('#customButton').on('click', function(e) {
    // Open Checkout with further options
    handler.open({
      name: 'Account 1',
      description: '2 widgets',
      amount: 2000
    });
    e.preventDefault();
  });

  // Close Checkout on page navigation
  $(window).on('popstate', function() {
    handler.close();
  });
</script>


<form action="stripesend.php" method="POST" id="payment-form">
  
</form>