Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove "instrument" concept from PaymentManager #371

Closed
danyao opened this issue May 8, 2020 · 9 comments · Fixed by #409
Closed

Remove "instrument" concept from PaymentManager #371

danyao opened this issue May 8, 2020 · 9 comments · Fixed by #409

Comments

@danyao
Copy link
Contributor

danyao commented May 8, 2020

The PaymentInstruments [1] concept was originally designed to support multiple credit cards. It adds confusion to payment handlers that are not fundamentally about credit cards. Since Payment Request API is moving towards payment apps being the atomic building blocks instead of instruments, I think it will be more clear to change payment handler registration interface to something like this:

registration.paymentManager.setPaymentMethods([
    'https://bobpay.xyz/pay',
    'https://alicepay.com'
]);

Today many parts of PaymentInstruments are not used:

  • Web-based payment handlers usually sets a single instrument with their supported payment methods
  • Chrome always fetches the icon from the payment handler's web app manifest instead of using the ones provided in PaymentInstruments.set()
  • capabilities only has well-defined meaning for basic-card payment method

With the proposed change to remove the PaymentInstrument concept, the web app manifest can become the authoritative source of information about the payment handler, such as name, icons, capabilities. This will also better unify just-in-time installation and explicit installation of payment handlers.

[1] https://w3c.github.io/payment-handler/#paymentinstruments-interface

@tblachowicz
Copy link

If we look from the perspective of the wallet, in the generic meaning, it actually makes a lot of sense to have PaymentInstrument concept. I think most of the Payment Apps allow selection of some soft of the instrument, and the payment is facilitated using the specific payment instrument. To me, the concept is much more generic than only credit cards. For wallets such as xPays the payment instrument is the payment card (credit, debit or other), for Open Banking aggregators it would be specific bank account to pay with and so on.

@rsolomakhin
Copy link
Collaborator

Is it possible for the user to consider the user agent as the wallet and all of the individual payment apps as "instruments"?

@danyao
Copy link
Contributor Author

danyao commented May 25, 2020

I think most of the Payment Apps allow selection of some soft of the instrument, and the payment is facilitated using the specific payment instrument. To me, the concept is much more generic than only credit cards. For wallets such as xPays the payment instrument is the payment card (credit, debit or other), for Open Banking aggregators it would be specific bank account to pay with and so on.

Yes "payment instrument" is a real-world concept and won't go away. This bug is about the technical question of whether "payment instrument" should be exposed to the browser in the web payments architecture. Framed from the user's perspective, the question is: should the browser offer users choices of payment apps or choices of payment instruments from within the apps?

So far, there is no payment handler that actually leverages the capability of exposing instruments to the browser. So I'm taking this as a signal that this capability is not useful. Removing it would simplify browser's implementation. But if a developer demonstrates a real use case for this capability, we would definitely consider keeping it.

@tblachowicz
Copy link

Yes "payment instrument" is a real-world concept and won't go away. This bug is about the technical question of whether "payment instrument" should be exposed to the browser in the web payments architecture. Framed from the user's perspective, the question is: should the browser offer users choices of payment apps or choices of payment instruments from within the apps?

It's one of the fundamental questions for Web Payments. As a user, I personally would prefer a selection of the payment apps, but I guess there might be good arguments for the alternative approach.

So far, there is no payment handler that actually leverages the capability of exposing instruments to the browser. So I'm taking this as a signal that this capability is not useful. Removing it would simplify browser's implementation. But if a developer demonstrates a real use case for this capability, we would definitely consider keeping it.

At the moment there are very little payment handlers in general, so I doubt the conclusion that the capability of exposing instruments is not useful. We've tried in one of the early prototypes to expose multiple instruments from single payment handler and it didn't work as expected in Chrome, because the instruments weren't displayed on the list.

@tblachowicz
Copy link

As per my understanding currently, the payment instrument is the only way to specify which payment method given payment handler supports. Payment manager sets the payment instrument with the method specifying the payment method identifier.

In case of payment instrument is removed from the specification there must be the other way to specify the supported methods, preferably in the manifest as the delegation can be specified.

@danyao
Copy link
Contributor Author

danyao commented May 28, 2020

As per my understanding currently, the payment instrument is the only way to specify which payment method given payment handler supports. Payment manager sets the payment instrument with the method specifying the payment method identifier.

The PaymentInstruments is only used when a payment handler is installed explicitly. Today it is involved in the setting of a payment handler's supported payment methods, but it doesn't need to be. The original post at the top has a proposal for how this functionality can still be supported in a world without PaymentInstruments.

So far, there is no payment handler that actually leverages the capability of exposing instruments to the browser. So I'm taking this as a signal that this capability is not useful. Removing it would simplify browser's implementation. But if a developer demonstrates a real use case for this capability, we would definitely consider keeping it.

At the moment there are very little payment handlers in general, so I doubt the conclusion that the capability of exposing instruments is not useful.

Fair enough.

We've tried in one of the early prototypes to expose multiple instruments from single payment handler and it didn't work as expected in Chrome, because the instruments weren't displayed on the list.

Can you elaborate a bit more how it didn't work as expected? What's the ideal user flow you'd like to achieve?

@jcayzac
Copy link
Member

jcayzac commented May 12, 2021

Hello,

Also, that the spec is called Payment Handler API but the main concept it introduces is called Payment Instrument adds unnecessary complexity. It could be just handler or just instrument.

@jcayzac
Copy link
Member

jcayzac commented May 12, 2021

In case of payment instrument is removed from the specification there must be the other way to specify the supported methods, preferably in the manifest as the delegation can be specified.

Personally I find a web manifest approach inconsistent with the design of Web APIs in general and would very much prefer keeping the current API-based approach.

@ianbjacobs
Copy link
Contributor

See updates to Chromium to remove instruments:
https://groups.google.com/u/1/a/chromium.org/g/blink-dev/c/VenSGqBIoKI?pli=1

rsolomakhin added a commit that referenced this issue Jan 25, 2023
* Remove PaymentInstruments API

PaymentInstruments is the Web API that backs non-JIT install of payment
apps. It was designed with the assumption that the browser would store
the actual payment instrument details, which has not turned out to be
true, and has some privacy leaks. This patch removes the ability to
register a payment handler via paymentManager.instruments API. Only
just-in-time installation is supported from now on.

Chrome tracking bug: https://crbug.com/1327265
Chrome status: https://chromestatus.com/feature/5099285054488576

Overview of changes in the patch:
 * Remove PaymentInstruments interface.
 * Remove no longer used PaymentInstrument and ImageOjbect dictionaries.
 * Mark PaymentManager exposed only on Window (not Worker) to match the
   Chrome implementation.
 * Add a definition for "payer" for symmetry with "payee" definition.
 * Soften the language around the purpose for the "canmakepayment"
   event to match Chrome implementation, where it is being used for
   hasEnrolledInstrument() instead of canMakePayment() and show().
 * Add a promise to the "canmakepayment" example to reduce confusion
   stemmed from many examples that always unconditionally return "true".
 * Remove the unused PaymentRequestEvent.fetchedImage internal slot.
 * Raise 2nd level sections to 1st level for clarity.

Closes: #371
Closes: #381

Co-authored-by: ianbjacobs <[email protected]>
Co-authored-by: stephenmcgruer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants