Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stripe checkout not working in android webview

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?

like image 432
Prithniraj Nicyone Avatar asked May 18 '16 11:05

Prithniraj Nicyone


2 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");
like image 152
anemo Avatar answered Nov 10 '22 17:11

anemo


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;]"

like image 5
MorcosS Avatar answered Nov 10 '22 18:11

MorcosS