Home » Android » Stripe checkout not working in android webview

Stripe checkout not working in android webview

Posted by: admin June 15, 2020 Leave a comment

Questions:

I am working on android application. The server on which I am working gives the subscription feature to the users, so users need to do payment to become a member on the website.

Now I am working on the same in android app and using webview to perform the payment gateways. I am loading the url of stripe checkout payment in the webview.

But I am getting the below error for Stripe checkout in webview.

Sorry, there was a problem loading Checkout. If this persists, please try a different browser.

How can I resolve this issue in the webview, so that it can work in my application?

How to&Answers:

Stripe checkout indeed does not work on Android WebViews, but it does work on iOS UIWebView…
So… UserAgent comes to rescue!

webView.getSettings().setUserAgentString("Mozilla/5.0 (iPhone; CPU iPhone OS 9_3 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13E233 Safari/601.1");

Answer:

I have added this to the userAgent of the webview and it worked.
"Mozilla/5.0 (Linux; Android 4.4.4; One Build/KTU84L.H4) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/28.0.0.20.16;]"

Answer:

Unfortunately, Stripe Checkout doesn’t support displaying Checkout in webviews. The best solution is to build your own payment form using Stripe.js.

Answer:

you problem is not with android device or android application, you have problem in your payment integration system.

if you are using Pay Now “Default popup for payment from stripe” it will surely occur an error. You need to integrate its payment system with your’s own code by using AJAX token system.

Answer:

We also got the "Sorry, there was a problem loading the Checkout. If this persists, please try a different browser." error in WebView on Android (in React Native App)

After debugging the Stripe javascript, we found some code just for Android in WebView (see image below). By adding the tag <meta name="mobile-web-app-capable" content="yes"> the problem was solved for us. Now Stripe loads as on IOS.

Stipe code