by inertial · 9y ago · 0 comments
Just thinking out load about possible issues that could cause this failure:
1) Extension blocking Stripe (as @Artemis2 mentioned below)
2) An older browser that's unable to execute Stripe JS (but uses a fake user agent that confuses us into thinking that a modern browser might be failing).
3) Unreliable internet client connection that is unable to load Stripe script intermittently.
Stripe elements is beautiful & flexible and the team is super helpful. We'd love to use it, but with the above problem, it's a bit scary to lose customers silently. For now, we are sticking with the Checkout flow.
We'd appreciate any tips on how to catch/fix an error like this ?
Stripe could/should offer a self-hosted version of the .js file for just this case, as a fallback to the official .js file; enabling basic payments, but with a notice that an addon is blocking the official stripe.js file and fraud protection is not enabled. Maybe even charge a slightly higher fee to the end-user? Probably not the right thing to do. Offer a fallback that survives external JS blockers.
<script src="https://js.stripe.com/v3/"></script>
<script>window.Stripe || document.write('<script src="https://js.stripe.com/v3/"><\/script>')</script>
<script>window.Stripe || document.write('<script src="https://js.stripe.com/v3/"><\/script>')</script>Stripe's server log might record/report failures in loading scripts. Perhaps someone from Stripe can chime in on the issue.
As an aside we also saw similar errors loading jQuery from a CDN and so used similar code to load it from our own server if it wasn't loaded from the CDN first. You cant do that with Stripe though.