Google Pay with iOS WKWebview

AmolS

New member
Jul 31, 2021
1
0
0
Visit site
Hi,

We developed Native iOS and Android application. Now trying to integrate Google pay in both apps.
Our apps exists in 11 countries.

For iOS,
We are trying to follow Tutorial for integrating Google Pay API on website. So trying to load the Html code given at tutorial inside iOS WKWebView (
Tutorial link : https://developers.google.com/pay/api/web/guides/tutorial )

The html code given at above link works inside mac desktop Safari browser on my Mac laptop. It shows 'Buy with G Pay' button in browser . But when same Html is loaded inside WKWebView, it initially failed to show GPay button.

It initially failed at Step-6 of above tutorial ( Determine readiness to pay with the Google Pay API )

I debugged and found that paymentsClient.isReadyToPay returns false. Documentation says that above function i.e., isReadyToPay() determines if the Google Pay API is supported by the current device and browser ( in our case WKWebView) for specified payment methods.

To overcome this,
We used user agent string of Safari browser listed at https://myip.ms/view/comp_browsers/13092/Safari_14.html

We used applicationNameForUserAgent property of WKWebViewConfiguration. Referring the table at above link, we used user agent string in this configuration for WKWebView.

The button started appearing but its text is still not turning to 'Buy With G Pay '. It is just showing 'GPay .....'
In Safari browser, the button text immediately changes.

Query :

What JS code must be failing in iOS WKWebview while changing button text?
 

B. Diddy

Senior Ambassador
Moderator
Mar 9, 2012
165,606
4,756
113
Visit site
Welcome to Android Central! I moved this to the Software Development forum for more specific traffic.