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 <https://developer.android.com/jetpack/androidx/releases/webkit>. It
enables new features in WebView that are not yet available in the Android
OS.



On Wed, Mar 5, 2025 at 11:05 AM Mike Taylor <miketa...@chromium.org> wrote:

> LGTM3
> On 3/5/25 10:42 AM, Daniel Bratell wrote:
>
> LGTM2 to ship in WebView as well
> On 2025-03-05 04:53, Vladimir Levin wrote:
>
> 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).
>
>
>
> On Friday, February 28, 2025 at 3:06:33 PM UTC-5 Rouslan Solomakhin wrote:
>
>> Contact emails rous...@chromium.org
>>
>> Specification https://w3c.github.io/payment-request/
>>
>> Documentation https://web.dev/explore/payments
>> <https://developers.google.com/web/fundamentals/primers/payment-request/>
>> (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 <https://web.dev/articles/android-payment-apps-developers-guide>.
>> Web-based Payment Handlers are not supported due to lack of the required UI
>> in WebView.
>>
>> *Design*
>> Design: WebView PaymentRequest for native Android intent based payment
>> apps
>> <https://docs.google.com/document/d/1yS2_LykHMhSTHr_oX9gtHgE8WS0x5QYtdg_k_8XBUj8>
>> .
>>
>> Blink component Blink>Payments
>> <https://issues.chromium.org/issues?q=customfield1222907:%22Blink%3EPayments%22>
>>
>> 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?
>> <https://developer.android.com/develop/ui/views/layout/webapps/embed-web-content-in-app#how-is>
>>
>>
>> *Gecko*: PaymentRequest development stopped.
>> *WebKit*: Shipped PaymentRequest
>> <https://webkit.org/blog/8182/introducing-the-payment-request-api-for-apple-pay>
>> .
>> *Web developers*: Positive views of PaymentRequest in WebView, e.g.: "We
>> believe this to be huge unlock for us and our customers.
>> <https://crbug.com/381849264#comment7>"
>>
>> 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
>> <https://docs.google.com/document/d/17UojtddKjJ4WpVZO-DYi7heyDEiDBLgKg33lqAbRAew>
>> .
>>
>> Estimated milestones
>> Shipping on WebView 136
>> 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
>> <https://chromestatus.com/>.
>>
> --
> 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+unsubscr...@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
> <https://groups.google.com/a/chromium.org/d/msgid/blink-dev/34282fd9-8a1c-4a53-b0fd-525af0e86137n%40chromium.org?utm_medium=email&utm_source=footer>
> .
>
> --
> 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+unsubscr...@chromium.org.
> To view this discussion visit
> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/ec87bd50-ac96-4668-94d4-c03244217b3b%40gmail.com
> <https://groups.google.com/a/chromium.org/d/msgid/blink-dev/ec87bd50-ac96-4668-94d4-c03244217b3b%40gmail.com?utm_medium=email&utm_source=footer>
> .
>
>

-- 
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+unsubscr...@chromium.org.
To view this discussion visit 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAMMzaWEj4A9b_0d1DAaR4wJy74zEU3-4iz4e1d_HQ%3DUDFvGorQ%40mail.gmail.com.

Reply via email to