Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. <script src="https://js.stripe.com/v3/">
  2. var stripe = Stripe('pk_test_TYooMQauvdEDq54NiTphI7jx');
  3. </script>
  4.  
  5. <button id="pay-with-stripe">
  6. Pay With Stripe
  7. </button>
  8.  
  9. <script>
  10. document.getElementById("pay-with-stripe").addEventListener("click", function(){
  11. stripe.redirectToCheckout({
  12. // Make the id field from the Checkout Session creation API response
  13. // available to this file, so you can provide it as parameter here
  14. // instead of the {{CHECKOUT_SESSION_ID}} placeholder.
  15. sessionId: '{{$session}}'
  16. }).then(function (result) {
  17. // If `redirectToCheckout` fails due to a browser or network
  18. // error, display the localized error message to your customer
  19. // using `result.error.message`.
  20. });
  21. });
  22. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement