Using Stripe.js on iOS fails silently

Hey,

I’m getting a weird bug. We use Stripe.js in our app and it works fine on Android and in the browser but on iOS nothing happens. It fails silently.

Any idea what would stop some JS from running?

We are using Google maps JS and it works without issue when loaded in the same way.

I’ve checked that the JS is added to the HEAD and that the object is available on the window.

1 Like

If your problem is that the form fields are not appearing on the screen, leaving you with just a white box, then the cause of this is that it is blocked by security (you can see an error in the logs in Xcode when you try to mount the element on the page). The Stripe elements renders inside an iframe. You need to add to your config.xml:

<allow-navigation href="https://js.stripe.com/*" />

Cheers,
Gary

7 Likes

That is correct. I updated another thread that this was how i resolved it.

It’s funny, I’m using Stripe.js without elements, I just use the js api (createToken()) and it did nothing on ios but worked on android, so I tried allow-navigation without much faith and it actually solved my problem.

Cheers !