-
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
Add userHint to PaymentManager #206
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect!
I actually don't quite understand this addition. I already consider the |
Chrome does not plan to display individual payment instruments. We plan to display only the payment app name, e.g.:
It would be useful for the user to see some kind of hint about the state of the payment app, which cannot be expressed in the payment app title, which is statically pulled from the web app manifest. For example, a browser may display this hint like so:
This hint does not have to be one of the instruments. It can be the logged in username, for example:
|
Can you provide some of the rationale for not displaying individual payment instruments? They provide the actual mechanism for checking whether or not a payment handler matches anyway. Furthermore, passing along the payment instrument key selected (again, I think we should probably be calling these "user hints", not "payment instruments" but that's perhaps off topic) allows the payment handler to use that more granular choice to potentially save the user extra clicks. I've already implemented this in a polyfill and it works well. I think deviating from it is an indication that perhaps we've got some redesign to do with what "payment instruments" actually mean in the API. We may need to revisit that anyway. |
We are focusing on mobile UI with limited screen real estate. This is our current plan and we may in the future display the individual instruments. I believe @adamroach has indicated that Mozilla will show the provided instruments, so there's no need to redesign the payment instrument concept, IMHO. |
Managing "PaymentInstruments" is going to a somewhat complex matter for Payment Handler implementers if they really want a great experience for their users that have multiple devices. For example, whenever the user registers a new "payment instrument" on a payment handler's website, the website is going to do something like send a push notification to wake up service workers on other devices to do the same registration. There's going to be significant thought and effort put into setting up icons, names, and doing maintenance on these things -- so if they aren't going to be used, we should really reconsider the approach entirely -- or at least understand a little bit more about what it takes to actually implement this stuff. I'm just saying I'm concerned with the direction. Just imagine now that I'm setting a "userHint" of "***1234" that Chrome is showing ... and then Mozilla is showing the same user hint PLUS all of the instruments, some of which aren't "***1234". That will be quite confusing. How will Mozilla know whether or not they should show "userHint"? What if some people just want to do "user@example.com" for the |
@dlongley asked: "Can you provide some of the rationale for not displaying individual payment instruments?" You might mean different things in that question: a) Why wouldn't a browser display all the payment instruments managed by a payment handler? Google colleagues have said they do not plan do to that, and the reasons include (on mobile) screen real estate. Other browser might display all instruments, or might do so on desktop by not mobile. b) Why not modify the "name" of one of the payment instruments as a user hint? That could work, but the question is "which one would be the best?" and this proposal suggests that the payment app may have information on what would be useful. Having recently spoken with Mozilla and Google, here are the user experiences I expect when I click on a payment handler, either:
Both of those behaviors (and possibly others) are supported by the current specification. Ian |
I'm sure they can create nifty heuristic, e.g., "if the hint looks like e-mail, show it." Regardless, the spec should not concern itself with UI details, correct? |
When you refer to payment instrument names/icons and say "so if they aren't going to be used" When the user agent provides access to a payment instrument, it will display that instrument using the name/icons provided by the payment handler. The question is: when the instruments are NOT shown, and only the "top level" name and icon for the payment handler is shown, will that suffice to encourage the user to select that payment handler? @rsolomakhin's suggest is that a hint could raise the confidence of the user to choose that payment app. |
It shouldn't -- but I don't consider this a detail. I think it's a confusing semantic. We don't have to get into how it will be shown, but developers should know the semantics behind the thing. And right now, I think those are too ill-defined. You've already got essentially a bunch of hints (+constraints) -- which we've called "Payment Instruments" ... and now we're adding another top-level "hint". If we're not clear to developers what should be put there and when it will be shown -- it's kind of a big deal. If payment handler developers put the same information into two different places and then we don't tell user agent devs what should trigger when it will be used, there's confusion -- and that will translate into user confusion and people thinking it's the payment handler's fault. One way to remedy this is to say that the user agent should either use payment instruments as hints OR use |
Then include, in the semantics of |
I'm ok to add "user agent should use either PaymentInstruments or userHint" to the spec, as long as it's a "should", not a "must." Does that help? |
Yes, that helps. I don't know if an explanation for the |
Please consider this situation:
So there's no easy way for "Ultimate Wallet" to participate in the ecosystem (and have decent hints) without splitting their wallet up. |
If your payment app can handle bitcoin, arguably your hint should not exclude that possibility. I do not claim to know all the answers. A/B testing would be useful here. Here's a few ideas to test out:
|
@rsolomakhin, seems like you could just generate that information without "userHint" from the payment instruments if you want to save space on mobile. |
The second you start defining an algorithm or "best practice" that developers should be using for "userHint" (based on payment instrument information) is the same second the user agent should just be doing it for them so they don't mess it up. |
A user agent that does not show instruments would not know which payment instrument to use for generating a hint, because it knows neither which instrument was selected last time nor the ordering of the instruments in the payment handler. Would you be open to providing this information to the user agent? |
It would know how to do "4 instruments" based on the fact that only 4 of the 16 that Ultimate Wallet provides match the payment method.
I'm fine with providing some kind of order of preference in the PaymentInstrument data. The whole point of that data, in my view, is to expose valid choices to the user in the order they would prefer. |
Something like this? dictionary KeyPaymentInstrument : PaymentInstrument {
required DOMString key;
};
interface PaymentInstruments {
Promise<boolean> delete(DOMString instrumentKey);
Promise<PaymentInstrument> get(DOMString instrumentKey);
Promise<sequence<DOMString>> keys();
Promise<boolean> has(DOMString instrumentKey);
Promise<void> update(DOMString instrumentKey,
PaymentInstrument details);
Promise<void> set(sequence<KeyPaymentInstrument> details);
Promise<void> clear();
}; |
That's one way to do it, though
What order is An interface PaymentInstruments {
...
Promise<void> insert(KeyPaymentInstrument details,
DOMString? instrumentKeyBefore);
}; |
That seems even more confusing. How about using the insertion order? |
Why?
That's what the above |
I'm not sure how familiar the folks are with the "insert before" paradigm. If do go with it, I'd prefer to augment the current interface PaymentInstruments {
...
Promise<void> set(DOMString instrumentKey,
PaymentInstrument details,
DOMString? instrumentKeyBefore);
}; If the |
I think the approach of adding an If I strip all of that away and think of it as a single Map sitting in one browser context ...that results in a totally different perspective. I can see now how you can think of this as a single Map instance that is built up all at once or cleared and rebuilt entirely at once. I wasn't thinking of it happening like that at all -- but much more piecemeal. The flows for making changes to this container are potentially very different in my mind. |
We discussed this at the 29 August Payment Apps task force call [1], and there was support for userHint as specified (rather than an ordering solution). Some considerations:
Rouslan is going to experiment with userHint so we will not merge before then. Ian |
index.html
Outdated
@@ -529,6 +529,7 @@ | |||
interface PaymentManager { | |||
[SameObject] readonly attribute PaymentInstruments instruments; | |||
[Exposed=Window] static Promise<PermissionState> requestPermission(); | |||
DOMString userHint; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be attribute because this is not dictionary type.
attribute DOMString userHint
Also, if you don't mind, isn't it better to move this attribute to PaymentInstruments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @romandev,
Thank you for help with the WebIDL. The reason I did not move it to payment instruments is that it did not seem to be part of the "standard" map-like interface (get, set, keys, etc.).
I will at least fix the "attribute" part and we can continue to discuss whether it belongs on a different interface.
Based on a discussion with @adamroach and @rsolomakhin, I have written this pull request
to address issue #173 .
The idea is that the payment handler provides a user hint (e.g., "**** 1234") that can complement
name and icon information associated with the payment handler. Although the user agent
could compute hint information like this (e.g., based on N payment instruments managed by the payment handler), this attribute gives more control to the payment handler.
I did not attempt to specify exactly how the string should be used, or combined with the name/logo of the payment handler.
This user hint string does not affect user interface behavior. Specifically, it does not mean that a particular payment instrument will be invoked automatically when the user selects the payment handler.
Ian