I'm using Stripe and Checkout to create a payment form and I want to be able to use Checkout's awesome javascript library, but I also want to change the form submission from just a normal POST to an AJAX POST.
So I tried adding a handler to the form element you're supposed to have, but my console line was never triggered, so it's not submitting using the given form.
Then I tried looking into the code that's brought up when the overlay is triggered. It's a bit confusing and I'm just wondering if anybody else was able to figure it out, or if it's made difficult because it's a security matter?
// Stripe plugin
<form id="payment_form" method='post' action="{{url_for('process_payment')}}">
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="test key">
</script>
</form>
// Form submit handler
$(document).ready(function(){
$("#payment_form").submit(function(e) {
console.log("Processing...");
ajax_payment();
return false;
});
});