fix(android): fix Google Pay in WebView — enable Payment Request API by default and add manifest queries#458
fix(android): fix Google Pay in WebView — enable Payment Request API by default and add manifest queries#458
Conversation
Co-authored-by: riderx <4084527+riderx@users.noreply.github.com>
|
@copilot wtf the report of the user stay it stop worked in fucking v8, that was not the problem fix the fucking problem |
…or Google Pay Co-authored-by: riderx <4084527+riderx@users.noreply.github.com>
You're right that enabling
Both changes are now in this PR. The manifest fix is the critical one for Android 11+ (which covers all Capacitor v8 target devices). |
|



Google Pay was broken in Android WebView due to two separate issues that both needed to be fixed.
Root Causes
1. Missing
<queries>inAndroidManifest.xml(the critical fix for Android 11+)Android 11+ enforces Package Visibility — apps must explicitly declare which intents they need to interact with. Without the three
org.chromium.intent.action.PAY,IS_READY_TO_PAY, andUPDATE_PAYMENT_DETAILSintent queries, the WebView cannot discover or communicate with Google Pay at all, so the payment sheet never appears.2. Payment Request API not enabled by default (required for WebView 120+)
Starting with WebView 120 (ubiquitous on devices running Capacitor v8 apps), Android WebView disables the W3C Payment Request API by default for security. The plugin was only calling
WebSettingsCompat.setPaymentRequestEnabled(true)behindenableGooglePaySupport: true(which defaulted tofalse), so users not explicitly opting in had Google Pay silently fail.Changes
AndroidManifest.xml— Added the three required Payment Request intent queries so Android 11+ Package Visibility allows WebView to communicate with Google Pay:WebViewDialog.java— MovesetPaymentRequestEnabled(true)outside theenableGooglePaySupportguard; it now runs unconditionally on WebView 120+ (the minimum required byWebViewFeature.PAYMENT_REQUEST). Downgrade the fallback log toLog.wso developers on older WebViews get a visible warning. Removes dead code:setMixedContentMode(MIXED_CONTENT_ALWAYS_ALLOW)that was immediately overridden byMIXED_CONTENT_COMPATIBILITY_MODEin the same block.enableGooglePaySupportnow controls only popup-window support (setSupportMultipleWindows) for the OR_BIBED_15 flow — not the Payment Request API.src/definitions.ts— Updated JSDoc to reflect narrowed scope ofenableGooglePaySupportand document the WebView 120+ requirement.Original prompt
This section details on the original issue you should resolve
<issue_title>bug: Google pay not working on capacitor v8</issue_title>
<issue_description> ────────────────────────────────────────────────────────────────────────────────
Bug Report
Capacitor Version