-
Notifications
You must be signed in to change notification settings - Fork 42
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
Ability to set default instrument for given handler #173
Comments
Can you say more about what happens when you click on BobPay? If I understand correctly,
Ian |
Presumably whatever BobPay wants. But the idea is that if they chose not to call openClientWindow and just charge directly, it would be clear what instrument is being charged. |
@zkoch when the payment handler receives the request would it be able to determine if the display showed all instruments or just the default? |
Good question. I don't think so, but we could consider it. My original idea was just to pass in that instrumentKey with the event, just as if the user had selected it from a set of options. |
I think it's difficult for a payment handler to do the right thing if they don't know what options the user was presented. |
Isn't the "right thing" to follow the instrumentKey that gets optionally passed in as part of the request? |
It seems like this could be managed through the definition of the default instrument:
Note: There may be better ways to identify a default instrument (e.g., PaymentInstrumentDefault is a subclass of PaymentInstrument). I defer to the API specialists for good practice. |
This is not true. Example: I install BobPay and have 2 instruments loaded (Blue and Green). I set Scenario 1: I am presented with Scenario 2: I am presented with only BobPay want me to have a have a really efficient check-out for Scenario 1, so if I select But, BobPay also want me to be able to use BobPay (Green) and they can't be sure I am always given all the instruments as options. So what do they do? In Scenario 2, if I wanted to pay with When the BobPay handler gets the payment request event it just sees an instrumentKey for |
Hi Adrian, Using your example as a starting point, here is what I had in mind:
Thus:
I should have provided this example in my post; thanks for prompting it. Ian |
That works. So defining a default also means defining a second key for that instrument. In terms of the API would a design where I don't repeat the same instrument twice be better? Perhaps change first bullet to:
|
@adrianhopebailie wrote: "In terms of the API would a design where I don't repeat the same instrument twice be better? " I intentionally offered that design with the expectation that some information about the instrument might change if used in a default context. If that is never useful, we should consider other options. Your proposal (a defaultInstrumentKey) does not on its own give you the necessary second key to be able to distinguish "default" from "all." This could be done in various ways. For example, if displayed and selected in a default context, the browser could send the payment an additional piece of data like "defaultSelected" to complement the instrumentKey of the selected instrument. Summary:
It would be good to hear what people think is necessary for a good user experience. Does the payment handler need to specify a special label for the default case, or could the browser do that in a manner consistent across payment apps? Ian |
It does. The idea would be for the default to have two keys. instrumentKey ::= instrumentKeyWhenDisplayedInFullList (Required) |
Concretely, one sets the instrumentKey on an Instrument through the PaymentInstruments interface, so we will have to revisit that interface. Today it has these methods: For example:
Ian |
I am personally not that fond of the I think that if the payment handler is launched with the The browser could present the payment handlers/instruments in such a way as to make sure the user is not put in a situation like Adrian's Scenario 2 above, where the default instrument prevents the user from selecting a different payment instrument. Even though a default instrument is provided by the payment handler, the browser should also give the user a way to invoke the payment handler without this payment instrument. Exactly how this is done is a UX design question, but it would for instance be possible to add a button on the right hand side of the item that represents the payment handler with its default instrument. Something like: 💳 BobPay (Green) ✒️ ... where clicking on the pen would invoke the payment handler without |
I see support for your UX suggestion: when showing default, make it easy to also launch the payment handler in "no default" mode (but without selecting a particular payment instrument to get there). It is not clear to me how the first part of your comment addresses the original problem statement: It may be that the user experience changes between Case 1 and Case 2. How are you informing the payment handler which Case happened? Ian |
@ianbjacobs My comment does not address the difference between your Case 1 and Case 2 as I didn't see any good reason to do so. In what scenario would this be useful? Unless we have a really good reason to add this functionality, I suggest that we keep things simple for now. Some way to distinguish between Case 1 and 2 could always be added later. |
I agree with Tommy here. Unless there's a good reason, it seems like added complexity with little benefit. IMO if the browser wants to default to a selected instrument based on context it has of past usage then that's (probably/maybe?) great added functionality it could provide, the handler could then influence that default indirectly after the first use anyway, but no need to build it into the spec. |
Discussed on 20 June:: Thanks to @jnormore and @Alyver for volunteering to write up some notes on three use cases:
Thanks! Ian |
Given the decision to remove "wallets" the spec has become somewhat cleaner wrt this scenario. I wanted to try and summarize where we are (I think). The remaining challenge is a payment app (origin) that has multiple service workers where the instruments are registered to different SWs. If a user explicitly selects an instrument then it is clear which SW's request handler will be invoked however if the browser simply presents the origin of the payment app and the user selects this it is unclear what the behavior should be. Option 1: Invoke on all SW's and handle first response that is provided Option 2: Always invoke the default instrument (and pick a default if the handler hasn't set one) ProposalKeep the API simple and intuitive for developers:
This will provide extra value to the payment handler as it can know explicitly what options the user was given and what they selected. If the user was presented only with the origin of the payment app (no default presented to the user) this list must be empty. The browser must still select a default and invoke the appropriate SW's event handler and populate the If the user is presented with one option (a default defined by the handler OR selected by the browser) then only that key should be passed in the
|
Chrome plans to present the payment handler's name and icon from its web app manifest. Payment handler writers should put different names and icons in |
Hi all, I just chatted with @adrianhopebailie to walk through his proposal. I found it useful during the discussion to write down the scenarios we have in mind, and illustrate how the two pieces of information (selectedInstrument and displayedInstruments) combine to give payment app developers information they need for a variety of potential user experiences. Here are the scenarios when the user clicks the the payment app for bobpay.com.
NOTES:
|
Hhmmm... this can be simplified a lot... Maybe:
Also, please see how to wire this up to be an async generator with: for async (const instruments of navigator.paymentInstruments){
// THIS HAS TO WORK
} |
Also, you are missing For reference, please see: Properties
Methods
Or maybe we can make this a set: |
Also, there how does one get the default one? |
to integrate async iteration protocol, please see: |
This API risks just adding more stuff to the platform that we might not need, and folks at Mozilla will get upset because a bunch of odd API choices will get made before we have a proper chance to participate. Can we please stop spec work on this an finish the other API, please!!!! |
Hi @marcoscaceres, Thanks for the input on this issue. I agree with you that PR API is the top priority, but there are also people interested in ensuring that Web-based payment apps continue to advance, even if it's slow, and even if we have to make changes. Here are some ideas:
Ian |
It's too fast right now.
I'd still be more in favour of incubation, not standardization. I'd like to see where Chrome's experiment/prototype with PayPal and other partners ends up.
No. There is a team of us tracking this, but we are all actively working on PR API. We don't have the scope to contribute properly to the handlers work and ship PR in a reasonable time in an interoperable manner. Consider, we have literally no idea today if payment method modifiers even work interoperably. There are no tests and Chrome currently has them disabled. I've no idea if they are supported in Edge and if they will work interoperaby with Firefox. That should give everyone pause. Like serious pause: because modifiers change the total and can add displayItems.
Could definitely work: Need people to be proactively writing tests or reverse engineering implementation. |
Noting here that we discuss at the payment apps call today: There is agreement this proposal needs more work and encouragement to discuss here. Ian |
Closing this issue as there is currently no plan by any browser to implement a default instrument behavior. Instead we pursued user hint and merged this pull request: Ian |
I'm wondering if there's a compromise between "show all the instruments for a given handler" and "show none of the instruments for a given handler" (Chrome's current implementation).
What if we allow a Handler to set a "default" instrument. It would enable something like this:
[ ] BobPay (Visa **** 4111)
[ ] PalPay (bob@bob.com)
Where the parenthetical in the above is the label for the defaulted instrument (if one exists).
This would enable single-click buy flows where the user is still informed about what the default action is when they hit pay, with the option preserved by the Handler to "step up" the user if necessary to a more involved flow.
The text was updated successfully, but these errors were encountered: