Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Intent to Ship: PaymentRequest on WebView

273 views
Skip to first unread message

Rouslan Solomakhin

unread,
Feb 28, 2025, 3:06:33 PMFeb 28
to blink-dev
(WebView-specific documentation will follow.)

Summary

PaymentRequest is an API that allows browsers to act as an intermediary between the three key parties in a financial transaction: the merchant (e.g. an online web store), the buyer (e.g. the user buying from the online web store), and the Payment Method (e.g. credit card). Information necessary to process and confirm a transaction is passed between the Payment Method and the merchant via the browser with the buyer confirming and authorizing as necessary across the flow.


PaymentRequest has been shipped on Desktop and Android for a while now, but not on Android WebView. This Intent is for partially shipping the feature on Android WebView, restricted to Android intent-based payment apps. Web-based Payment Handlers are not supported due to lack of the required UI in WebView.


Design

Blink component

Blink>Payments


Risks

Interoperability and Compatibility

Android WebView works slightly differently than other platforms, so developers should be aware of caveats. See for example:

How is WebView different from a typical browser like Chrome?


Gecko: PaymentRequest development stopped.
WebKit: Shipped PaymentRequest.
Web developers: Positive views of PaymentRequest in WebView, e.g.: "We believe this to be huge unlock for us and our customers."

WebView application risks

Low: WebView host apps must opt-in to enable PaymentRequest (including a recompile and pushing an update to their users). There are two steps required:


1) Add the following to AndroidManifest.xml:


<queries>
  <intent>
    <action android:name="org.chromium.intent.action.PAY"/>
  </intent>
  <intent>
    <action android:name="org.chromium.intent.action.IS_READY_TO_PAY"/>
  </intent>
  <intent>
    <action android:name="org.chromium.intent.action.UPDATE_PAYMENT_DETAILS"/>
  </intent>
</queries>


2) Execute the following initialization code for each WebView where PaymentRequest should be enabled:


WebView myWebView = (WebView) findViewById(R.id.webview);
WebSettings webSettings = myWebView.getSettings();
webSettings.setPaymentRequestEnabled(true);


Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, ChromeOS, Android, and Android WebView)?

This Intent is specifically for Android WebView. The other platforms are already shipping PaymentRequest.

Flag name on WebView Dev Tools

WebPayments

Finch feature name

WebPayments


Requires code in //chrome?

No

Tracking bug

https://crbug.com/381849264

Sample links
Running a demo is a bit more involved in Android WebView, so here are instructions for device setup and running a demo.

Estimated milestones

Shipping on WebView136

Anticipated spec changes

None


Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5639348045217792?gate=5794834437111808

Launch tracking
launch/4328654 (Google internal only)

This intent message was generated by Chrome Platform Status.

Vladimir Levin

unread,
Mar 4, 2025, 10:53:54 PMMar 4
to blink-dev, Rouslan Solomakhin
I believe this was the intent for non-WebView PaymentRequest: https://groups.google.com/a/chromium.org/g/blink-dev/c/p1DYoxHlkKg/m/rBqBMGbFCgAJ

LGTM1 to ship to WebView as well with the restriction you outlined. Please also start the rest of the reviews (WP Security, Enterprise, Testing). 

Daniel Bratell

unread,
Mar 5, 2025, 10:42:22 AMMar 5
to Vladimir Levin, blink-dev, Rouslan Solomakhin

LGTM2 to ship in WebView as well

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/34282fd9-8a1c-4a53-b0fd-525af0e86137n%40chromium.org.

Rouslan Solomakhin

unread,
Mar 5, 2025, 10:59:43 AMMar 5
to Vladimir Levin, blink-dev
>  Please also start the rest of the reviews (WP Security, Enterprise, Testing).

I'm on it -- currently filling out the relevant survey documents.

Thank you!

Mike Taylor

unread,
Mar 5, 2025, 11:05:37 AMMar 5
to Daniel Bratell, Vladimir Levin, blink-dev, Rouslan Solomakhin

Rouslan Solomakhin

unread,
Mar 24, 2025, 1:43:54 PMMar 24
to Mike Taylor, Daniel Bratell, Vladimir Levin, blink-dev
For posterity, the exact API to enable PaymentRequest in WebView is slightly different from the first email:

WebView myWebView = findViewById(R.id.webview);
WebSettings webSettings = myWebView.getSettings();
if (WebViewFeature.isFeatureSupported(WebViewFeature.PAYMENT_REQUEST)) {
    WebSettingsCompat.setPaymentRequestEnabled(webSettings, true);
}

WebSettingsCompat is the forward compatibility API for WebSettings in AndroidX WebKit. It enables new features in WebView that are not yet available in the Android OS.


Reply all
Reply to author
Forward
0 new messages