-
Notifications
You must be signed in to change notification settings - Fork 135
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
Detecting payment method support #247
Comments
+1. We should probably also make the 'validate()' function return a promise, so the browser can answer asynchronously. |
This sounds like a bug. The API should fail with no UI impact if the payment method is not supported. The reason we don't currently have something akin to Imagine you register a payment app from visit Now you visit Since we have agreed on using payment method manifests I'd suggest we have a set of allowed origins for validation as a way to resolve this but I'm sure there are some complex user consent issues we'll need to consider. |
The current API is designed to avoid sites probing for what a user supports. Following a pattern used elsewhere, you commit to calling the API but if it turns out the API couldn't satisfy your goals then you revert to your fallback flow. This avoids the need for a The flow should look something like this:
If a user doesn't currently have the ability to pay using a supported method then the user agent may choose to offer to help the user install or configure that method. For example, if the site accepts For this reason I don't support adding a |
The problem with the fallback flow is we need to wait for user to click on something before calling the That being said, I totally agree with you, it sucks if a website can probe the payments methods supported by a user-agent. |
I don't believe that is true. You don't currently ask if the user if they want to use the (only) legacy method before offering it to them. With PaymentRequest it should be as seamless. In step 3 above, you redirect without prompting the user anything. So they click the checkout button, and then see the legacy method. They may not know or care that in-between you checked with PaymentRequest. Alternatively, the user agent may have prompted them to install or populate a new payment method and when they declined they were redirected to the legacy flow. In either case it feels natural to the user. |
Ok, I got your point. That's true, I didn't think about that. |
In the current draft, the spec doesn't allow a merchant to detect a user-agent has a payment method capability. For example, using the following code:
On
PaymentRequest
instantiation no validation is required by the user-agent. It will only validate the PaymentMethodData is supported during the.show()
and then the promise will failed with an error like:The payment method is not supported
This makes impossible for a merchant to detect a payment method is supported (like android pay) and show a "android pay" button only if supported. Right now on chrome 53, if we run this snippet of code, it will start showing up a payment window and then it disappears almost immediately. This make deceptive UX.
Would it be possible to add an extra method like
validate()
to ensure one of thePaymentMethodData
is supported by user-agent? Or make thenew PaymentRequest
raise an error, but that would probably break the api.This is a nice to have for incremental release of payment api, especially when merchant has already payment partners not supporting paymentrequest api.
The text was updated successfully, but these errors were encountered: