Sasi
Sasi

Reputation: 425

Ionic app, fails to load Stripe javascript

I have an ionic app, which loads javascript from https://js.stripe.com/v2/. It runs well in the emulator, but when I install the app on device, this javascript file load call fails with 404 response. I found the response has only Client-Via header with value shouldInterceptRequest . What am I doing wrong?

Upvotes: 1

Views: 1105

Answers (1)

Venkat
Venkat

Reputation: 1259

I solved it as below (adding the answer to help others struck with this in future).

This problem is not specific to Stripe. Cordova doesn't allow to access the resources from external sites by default. You need to whitelist an url to allow it. first install the cordova-plugin-whitelist as below

ionic plugin add https://github.com/apache/cordova-plugin-whitelist.git

then in your apps config.xml file add

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

Upvotes: 2

Related Questions