Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script src="https://js.stripe.com/v3/">
- var stripe = Stripe('pk_test_TYooMQauvdEDq54NiTphI7jx');
- </script>
- <button id="pay-with-stripe">
- Pay With Stripe
- </button>
- <script>
- document.getElementById("pay-with-stripe").addEventListener("click", function(){
- stripe.redirectToCheckout({
- // Make the id field from the Checkout Session creation API response
- // available to this file, so you can provide it as parameter here
- // instead of the {{CHECKOUT_SESSION_ID}} placeholder.
- sessionId: '{{$session}}'
- }).then(function (result) {
- // If `redirectToCheckout` fails due to a browser or network
- // error, display the localized error message to your customer
- // using `result.error.message`.
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement