1

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?

Sasi
  • 415
  • 3
  • 13
  • Are you app installed in ios9 devices? If so, maybe you could check [ATS rules](http://stackoverflow.com/questions/31254725/transport-security-has-blocked-a-cleartext-http). – liuwenzhuang Mar 14 '16 at 15:58
  • Initially I'm building for android. – Sasi Mar 16 '16 at 17:40
  • @Sasi I am trying to install the ionic app on Android, its failing to load the stripe.js from stripe site, did you have any luck with yours after this post ? – Venkat Jun 25 '16 at 03:58

1 Answers1

2

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"/>
Venkat
  • 1,229
  • 1
  • 15
  • 23