Upcoming W3C Payment API changes in Chrome 77

133 views
Skip to first unread message

Danyao Wang

unread,
Jul 31, 2019, 9:27:18 AM7/31/19
to payment...@chromium.org

The following changes are coming to Chrome 77.


Canary: today  | Beta: August 8, 2019  | Stable: September 10, 2019


Changes enabled by default:

  • Improved debuggability of Payment Request API

  • Deprecated card issuer networks as payment method identifiers

  • Deprecated legacy support for invalid basic-card data


Changes available for testing behind flags:

  • Payment handler event logging in Dev Tools

  • Expanded availability of just-in-time installation of payment handlers

Improved Debuggability of Payment Request API and Payment Handler API

Chrome 77 returns more detailed error messages on all rejected Promises and adds the ability to log payment handler events in Dev Tools.


The new error messages are designed to pinpoint the exact reason why PaymentRequest.show() fails to complete. For example:

  • Another PaymentRequest UI is already showing in a different tab or window.

  • Cannot show PaymentRequest UI in a background tab.

  • Not in a secure origin.

  • SSL certificate is not valid.

  • User closed the Payment Request UI.


To print the detailed error message, do this:

request.show().catch(e => {

  console.log(e.message);

});

Deprecated card issuer networks as payment method identifiers

Card issuer networks (e.g. “visa”, “mastercard”, “amex”) have not been recognized as valid payment method identifiers by W3C since 2017. Chrome 77 removed the legacy bridge code that automatically translated such requests into the equivalent basic-card request.


Web developers should use supportedNetworks from the Basic Card Payment Method:

// DON’T DO THIS:

const badMethodData = { supportedMethods: “visa” };

// DO THIS:

const goodMethodData = {

  supportedMethods: “basic-card”,

  data: { supportedNetworks: [“visa”] }

};


const request = new PaymentRequest([goodMethodData], paymentDetails);


For more information, see https://www.chromestatus.com/feature/5725727580225536.

Deprecated legacy support for invalid basic-card data

Chrome 77 tightens input validation and throws a TypeError if the PaymentMethodData.data provided on a basic-card request cannot be converted into a BasicCardRequest. Our telemetry shows that real-world triggers of this exception is very rare. Affected web developers should update their code to use well-formed requests.


For more information, see https://www.chromestatus.com/feature/4793925806063616.

Payment handler event logging in Dev Tools

Developer console can now display payment handler events for easier debugging. To try out this feature:

  1. Enable chrome://flags/#enable-devtools-experiments. Then restart the browser.

  2. In dev tools, press F1 to open dev tools settings.

  3. Under “Experiments”, enable “Background services section for Payment Handler”.

  4. Close and re-open dev tools.


To log events on a live page (e.g. https://rsolomakhin.github.io/pr/bob/):

  1. Open dev tools.

  2. In “Application” tab, select “Payment Handler” from the “Background Services” section.

  3. Select the checkbox for “Show events from other domains”.

  4. Click the record button.


Expanded availability of just-in-time installation of payment handlers

Just-in-time installation of payment handlers is a Chrome optimization launched in Chrome 70 to improve the discovery of new payment handlers. Until now, it is only available if the payment request specifies a single payment method and this payment method is a URL-based payment method. Chrome 77 expands just-in-time installation to all URL-based payment methods specified in a payment request.


To test this feature:


You should see BobPay as an available payment method in addition to basic-card.


For more information, see https://chromiumdash.appspot.com/commit/761739b7605ff503805d2c4e8f8c4bcdc58c332c.

Reply all
Reply to author
Forward
0 new messages