Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Stripe Checkout with Cordova ios 4.0.0+

I have been trying to get Stripe checkout working with Cordova iOs 4.2.0 and am having no luck. The last Cordova iOs version this works with is 3.9.2. To test I made an empty hello world cordova app and added this code for stripe (tested on ios 9 and 10):

<script
    src="https://checkout.stripe.com/checkout.js" class="stripe-button"
    data-key="xxxxxxx"
    data-amount="999"
    data-name="Oki Technologies Inc"
    data-description="Widget"
    data-locale="auto"
    data-currency="cad">

Now it works perfectly on Cordova ios 3.9.2, but on 4.0.0+ it just has an empty iframe with a dark overlay. I think its trying to open the popup in a new tab like the mobile web, instead of as a popup like it is supposed to do on the app. I'm hoping there's a useragent or something I can spoof to get this to work as it works perfectly on android web/cordova as well as iphone on the web. Is there any way to get this working?

I made a test repo here that someone can clone to test https://github.com/HockeyCommunity/stripe

like image 903
Amrit Kahlon Avatar asked Oct 28 '16 00:10

Amrit Kahlon


People also ask

Is Stripe checkout deprecated?

react-stripe-checkout is a 3rd party React wrapper for the Stripe Legacy Checkout product. It's not recommended you use this as Legacy Checkout has been deprecated.

Can you customize Stripe checkout?

You can customize the look and feel of Checkout in the Stripe Dashboard. Go to Branding Settings where you can: Upload a logo or icon. Customize the Checkout page's background color, button color, font, and shapes.

Can I create a payment page in Stripe?

Use a low-code integration to build a customized payment page, hosted on Stripe. Checkout is a low-code payment integration that creates a customizable payment page so you can quickly collect payments on desktop and mobile devices.


1 Answers

I was banging my head against the wall for days looking for a solution to this. Solution was to add the following two lines to my config.xml file:

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

Hope this helps!

EDIT: Updated solution with suggestion from @TateThurston

like image 184
adlondon Avatar answered Sep 19 '22 11:09

adlondon