Reputation: 980
I am trying to integrate Stripe with my website with "Simple" checkout as described at https://stripe.com/docs/checkout . I have created a summary page on which I have added script tag. This shows the Pay With Card and it works fine.
However, I need a "Cancel" or "Back" button on this summary page so as to give user chance to go back to previous page or cancel online booking. But even when this other button is clicked, the Payment pop-up is opened and it is not raising the back button event.
What am I missing? Why even other buttons are hijacked by Stripe JS. Please help.
Upvotes: 0
Views: 2270
Reputation: 5470
Simple Checkout allows the user to enter their credit card, then creates a token, then immediately submits the <form></form>
which encloses it. If you need more customizability than that, you'll need to use the Custom Checkout integration.
With the Custom integration, the user is presented with Checkout, Stripe generates a token, then it is up to you to decide what to do next --- you could write JS in the token creation callback to append a hidden field with the token and then immediately submit the form, or you could land the user back on your summary page and wait for the user to give an additional confirmation before submitting your form, or 'go back.'
var handler = StripeCheckout.configure({
key: 'pk_test_xxxyyyyzz',
token: function(token) {
// You can access the token ID with `token.id`.
// Do something with that token (append a hidden input + submit the form?)
}
});
Upvotes: 0