cordovagoogle-pay

How to display Google Pay in an iframe instead of in a popup window


Visit https://developers.google.com/pay/api/web/guides/resources/demos in Chrome on Android (iOS untested) and click on the first example. You will get Google Pay in an iframe, as shown here:

Google Pay in an iframe

Try the same example in any other browser (device or desktop PC) and Google Pay opens in a popup window.

I'm implementing Google Pay into a Cordova app and would need it to open in an iframe instead of a popup.

Is this a feature specific to the Chrome app or can it be implemented into other apps? (a permission that needs to be added maybe?) Or maybe it's as simple as some Google Pay Javascript code that allows it?

Thanks for any help!


Solution

  • This has nothing todo with iframes. Your image shows the native Android Google Pay sheet. Automatic bridging to the native Android Google Pay sheet is only available for Chrome on Android. For your Cordova app you need to manually bridge to the Android Google Pay APIs. Something similar to this:

    https://github.com/ZelCore-io/cordova-plugin-apple-pay-google-pay/blob/master/src/android/ApplePayGooglePay.java