Skip to content

Request for use cases: "canmakepayment" event #401

Open
@rsolomakhin

Description

Hi,

As part of looking into improving the privacy properties of Payment Handlers, I'd like to collect the known use cases for the "canmakepayment" event. Here is what I have came up with so far:

  1. Kill switch: A payment app wants to globally disable the use of Web Payment API. A service worker may use the “canmakepayment” event for this purpose, in case if there is a bug that causes the Web Payment API flow to be broken.
  2. Single instance: A payment app wants to prevent showing two instances of the payment UI at the same time. Chrome rejects any PaymentRequest.show() calls that happen while another PaymentRequest.show() call is happening, but there is no way for web developers to know that the reject is going to happen ahead of time. A service worker may use the “canmakepayment” event to check an in-memory boolean variable that is set to “true” when this service worker is already handling an ongoing "paymentrequest" event. (This implementation would not catch another origin's Payment Handler UI being displayed, however.)
  3. Instrument on file: A payment app wants to check whether the user is logged in and has a payment instrument on file.

I'm assuming that the same use cases hold for Android payment apps.

What other use cases are out there? I'd love to hear feedback.

Thank you,
Rouslan

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions