This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
400 Unable to verify your data submission on /freeform/payments/stripe/payment-intents request #1611
Labels
issue
Something isn't working correctly
What happened?
We have a form that captures donations using the Stripe integration. The form is shown on every page of the website and on occasion, in multiple places on the same page, each form with its own unique ID and also implementing a custom fieldIdPrefix.
The pages are cached using the Blitz plugin and we have a script that runs an ajax request to get new CSRF, hash and payload data per form on page load.
forms.js
ajax/freeform.twig
This all works fine so far. The issue we notice occasionally is that when the form tries to set up the Stripe payment intent via an ajax request to
/freeform/payments/stripe/payment-intents
it fails with the 400 Bad Request - Unable to verify your data submission error, and for each of the donate forms on the page.The user then sees a 'Could not load payment element' error in place of where the Stripe field should be.
Could there be some sort of race condition occurring where the payment-intents ajax request is being sent using the old/cached CSRF if it gets triggered before the CSRF token is updated by the forms.js script? That might explain why it sometimes works ok and sometimes fails.
Errors and Stack Trace (if available)
No response
How can we reproduce this?
Freeform Edition
Pro
Freeform Version
5.6.8
Craft Version
Pro 4.12.8
When did this issue start?
Unsure
Previous Freeform Version
No response
The text was updated successfully, but these errors were encountered: