I've built a form that on submit, has custom code that goes to a secondary page with a button to open the custom Stripe checkout. This works fine, but once the payment is comleted and the Checkout modal is closed, I would like redirect to a thank you page.
Is this possible?
Thanks
Custom code used:
Is this possible?
Thanks
Custom code used:
<script src="https://checkout.stripe.com/checkout.js"></script>
<button id="customButton">Soumettre et payer: <?php echo $_POST['total']; ?>.00$</button>
<script>
var handler = StripeCheckout.configure({
key: 'pk_test_24L7VIQjrLL9lym26wnp0nOk',
image: 'https://stripe.com/img/documentation/checkout/marketplace.png',
token: function(token) {
jQuery("#stripeToken").val(token.id);
jQuery("#stripeEmail").val(token.email);
jQuery("#display-section1").submit();
}
});
jQuery('#customButton').on('click', function(e) {
var nameValue = "<?php echo $_POST['total']; ?>";
nameValue = nameValue*100;
// Open Checkout with further options
handler.open({
name: 'AJEFNB',
description:'Règles de procédure du N.-B. annotées',
amount: nameValue,
locale:'fr',
currency:'cad'
});
e.preventDefault();
});
// Close Checkout on page navigation
jQuery(window).on('popstate', function() {
handler.close();
});
</script>