Re: [w3c/browser-payment-api] Detecting Payment Method Availability (#316)

I suggest user agents reject the promise only when the query quota has been exceeded. For example, if the merchant website is querying payment methods one-by-one ("visa", "mastercard", "amex"...) for fingerprinting the user.

Think about this function if it was synchronous. It would either return true/false in normal operation or throw an exception if something was amiss. It's the same deal here.

* Can make payment ⇒ resolve with "true".
* Cannot make payment ⇒ resolve with "false".
* Query quota exceeded ⇒ reject promise.

By the way, Chromium has an [implementation](https://codereview.chromium.org/2467393002/) in review. I also have a [test website](https://rsolomakhin.github.io/pr/) that shows how to use this function:

```javascript
    request = new PaymentRequest(supportedInstruments, details);
    if (request.canMakeActivePayment) {
      request.canMakeActivePayment().then(function(result) {
        info(result ? "Can make active payment" : "Cannot make active payment");
      }).catch(function(err) {
        error(err);
      });
    }
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/browser-payment-api/pull/316#issuecomment-261156270

Received on Thursday, 17 November 2016 05:03:55 UTC