[w3c/payment-handler] Request for use cases: "canmakepayment" event (Issue #401)

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.
1. **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.)
1. **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](https://web.dev/android-payment-apps-developers-guide/#androidmanifest.xml).

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

Thank you,
Rouslan

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/payment-handler/issues/401

You are receiving this because you are subscribed to this thread.

Message ID: <w3c/payment-handler/issues/401@github.com>

Received on Friday, 22 July 2022 16:28:40 UTC