Intent to ship: changePaymentMethod() and payment method change event

63 views
Skip to first unread message

Rouslan Solomakhin

unread,
May 15, 2019, 5:56:46 PM5/15/19
to blink-dev, Jinho Bang, Danyao Wang

Contact emails

jinho...@samsung.com, rou...@chromium.org


Spec

https://w3c.github.io/payment-handler/#changepaymentmethod-method

https://w3c.github.io/payment-request/#paymentmethodchangeevent-interface


Summary

A payment handler can call changePaymentMethod() to indicate when the user selected a different payment method in the course of a payment flow.


Then the merchant’s payment method change event handler triggers, so the merchant can, for example, update the total based on the billing address of the payment method selected within the payment handler.


The Payment Handler API and Payment Request API changes are being shipped at the same time to allow both for the payment handler to call changePaymentMethod() and for the merchant to respond to the resulting payment method change event.


This intent is only for payment handlers to fire the payment method change event. Selecting the built-in autofill cards in the browser payment sheet will not fire this event.


Link to “Intent to Implement” blink-dev discussion

changePaymentMethod():

https://groups.google.com/a/chromium.org/d/msg/blink-dev/-ObfNnnJjLo/pPsUD8CUCAAJ


Payment method change event:

https://groups.google.com/a/chromium.org/d/msg/blink-dev/e8Zrmy52r9w/jj4mwEz3BwAJ


Is this feature supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

No. Payment Request API and Payment Handler API are not available on Android WebView.


Demo link

https://rsolomakhin.github.io/pr/apps/pmc/


Risks

Interoperability and Compatibility

Edge: No signals

Firefox: PaymentMethodChange implemented

Safari: PaymentMethodChange shipped

Web / Framework developers: Positive


Is this feature fully tested by web-platform-tests? Link to test suite results from wpt.fyi.

changePaymentMethod():

https://w3c-test.org/payment-handler/change-payment-method.https.html

https://wpt.fyi/results/payment-handler/change-payment-method.https.html


Payment method change event:

https://w3c-test.org/payment-request/PaymentMethodChangeEvent/

https://w3c-test.org/payment-request/onpaymentmenthodchange-attribute.https.html

https://wpt.fyi/results/payment-request/PaymentMethodChangeEvent

https://wpt.fyi/results/payment-request/onpaymentmenthodchange-attribute.https.html


Entry on the feature dashboard

changePaymentMethod():

https://chromestatus.com/feature/5698314223747072


Payment method change event:

https://chromestatus.com/feature/4924351321210880


TAMURA, Kent

unread,
May 17, 2019, 1:01:44 AM5/17/19
to Rouslan Solomakhin, blink-dev, Jinho Bang, Danyao Wang
Shipping PaymentMethodChangeEvent looks pretty safe.
What about browser vendor signals for changePaymentMethod()?


--
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 on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAMMzaWGkZK-5%2B%3DPc1_5BYjqhLuE0hO1Hih7bN9jvB01HQniFVw%40mail.gmail.com.


--
TAMURA Kent
Software Engineer, Google


Rick Byers

unread,
May 17, 2019, 12:12:29 PM5/17/19
to Rouslan Solomakhin, blink-dev, Jinho Bang, Danyao Wang
From: Rouslan Solomakhin <rou...@chromium.org>
Date: Wed, May 15, 2019 at 5:56 PM
To: blink-dev
Cc: Jinho Bang, Danyao Wang

It looks like these are all currently failing. Is it enabled by --enable-experimental-web-platform-features?

Rouslan Solomakhin

unread,
May 17, 2019, 12:48:22 PM5/17/19
to Rick Byers, blink-dev, Jinho Bang, Danyao Wang
Yes, chrome://flags/#enable-experimental-web-platform-features needs to be enabled for these tests to pass, because the two features are marked "experimental". The tests are passing for me in Chrome Canary 76.0.3797.0 on Mac and in Chrome Dev 76.0.3795.3 on Linux.

The tests are also automated in desktop browser tests and Android integration tests, which derive their shared JS code from the WPT version of the tests.

Rick Byers

unread,
May 17, 2019, 2:23:18 PM5/17/19
to Rouslan Solomakhin, blink-dev, Jinho Bang, Danyao Wang, Luke Bjerring

From: Rouslan Solomakhin <rou...@chromium.org>
Date: Fri, May 17, 2019 at 12:48 PM
To: Rick Byers
Cc: blink-dev, Jinho Bang, Danyao Wang

Strange, there must be some issue with the WPT setup. That wpt.fyi link is also for Chrome Dev 76.0.3795.3 Linux with --enable-experimental-web-platform-features. The error for some of the tests is "PROMISE_REJECT(object "NotSupportedError: The payment method "https://web-platform.test:8443/payment-handler/payment-app/" is not supported")". Can you and/or Danyao follow up with the WPT.fyi team (+lukebjerring) to figure out why the dashboard is failing for tests that pass locally?

Rouslan Solomakhin

unread,
May 17, 2019, 4:10:18 PM5/17/19
to Rick Byers, blink-dev, Jinho Bang, Danyao Wang, Luke Bjerring
Turns out Payment Request was ignoring --ignore-certificate-errors flag, which caused WPT tests to fail. The fix is in CQ: https://crrev.com/c/1618121

aes...@gmail.com

unread,
May 20, 2019, 4:49:17 PM5/20/19
to blink-dev, rou...@chromium.org, jinho...@samsung.com, dan...@google.com


On Thursday, May 16, 2019 at 10:01:44 PM UTC-7, Kent Tamura wrote:
Shipping PaymentMethodChangeEvent looks pretty safe.
What about browser vendor signals for changePaymentMethod()?

WebKit doesn't currently implement Payment Handler, but we do implement Payment Request and the paymentmethodchange event, and I support adding a way for payment handlers to dispatch this event.

Andy

TAMURA, Kent

unread,
May 20, 2019, 6:31:25 PM5/20/19
to blink-dev, Rouslan Solomakhin, Jinho Bang, Danyao Wang, aes...@gmail.com
LGTM1.


--
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.

Rick Byers

unread,
May 21, 2019, 10:41:01 AM5/21/19
to Rouslan Solomakhin, blink-dev, Jinho Bang, Danyao Wang, Luke Bjerring
On Fri, May 17, 2019 at 4:10 PM Rouslan Solomakhin <rou...@chromium.org> wrote:
Turns out Payment Request was ignoring --ignore-certificate-errors flag, which caused WPT tests to fail. The fix is in CQ: https://crrev.com/c/1618121

Perfect, thanks for fixing this! It's great to be able to increasingly rely on wpt.fyi as the source of truth around interop ;-)

LGTM2

Chris Harrelson

unread,
May 21, 2019, 11:26:42 AM5/21/19
to Rick Byers, Rouslan Solomakhin, blink-dev, Jinho Bang, Danyao Wang, Luke Bjerring
Reply all
Reply to author
Forward
0 new messages