Fixing Stripe a ‘IntegrationError’
Bristol WordPress expert and studio owner
On a recent project, I kept getting an IntegrationError when trying to integrate Stripe. Specifically when running stripe.createToken(card).
"IntegrationError: We could not retrieve data from the specified Element. Please make sure the Element you are attempting to use is still mounted.
To fix this there are two things you need to check:
- Make sure your card component (the literally HTML) is present in the DOM when you running createToken. This might require you to rethink any sort of form animation until everything is clear.
- Check your JS isn’t being loaded multiple times. This was my issue, due to simple typo, the JS running the stripe integration was being loaded once in the header and again in the footer.
Hope that helps!