I've integrated Stripe Checkout into my site and everything works great except for one aspect. I use the 'Simple' checkout mode where Stripe renders my checkout button for me. But I see no way in the docs to detect if the user clicks the close button (effectively cancelling the transaction - see image).
Is there a way to detect this in 'Simple' mode (as opposed to Custom)?
Well you cannot have a callback, but what about if you create your own callback when stripe remove the iframe from your DOM.
$(document).on("DOMNodeRemoved",".stripe_checkout_app", close);
function close(){
alert("close stripe");
}
so while its true that the 'closed'callback its not available this little hack can help you.
//this example its with JQuery.
--- EDIT ---
As @artfulhacker commented another way to do it would be to use the a setInterval timer and check if the class .stripe_checkout_app
is visible
or not, could be something like:
setInterval(function(){
if(!$('.stripe_checkout_app').is(":visible")){
alert("Stripe modal is hidden");
}
},1000)