I’m setting up a Payment Field and would like to use the Stripe Button to avoid having to deal with PCI.
The fields for the form look like:
Email
Shipping:
Billing:
Special Notes:
Submit Button
Billing has an option to either use an already saved credit card or to input a new card through the stripe button. Ideally the button would just set the stripeToken hidden field and be done, but because the stripe button is within a form it also causes the entire form to post, even though I’d prefer it not to.
Is there any way to prevent this from posting? I’m assuming I’m going to have to do some hack-y javascript to intercept the submit from getting to the actual form.
Code for stripe button: https://stripe.com/docs/button
Figured it out:
Looking into the Stripe javascript at https://button.stripe.com/v1/button.js
I see a call to
this.options.form.submit();
I added a hidden field with ID submit, which causes Stripe to call the wrong submit. Not exactly the pretty fix I was looking for since it throws a javascript error in the console.