Re: [w3c/webpayments-payment-apps-api] Should payment apps implement payment method-specific filters? (#63)

> Generate a boolean "I can handle this" as output.

If browser UI is going to be showing payment options from the payment app, then the lambda function should return the subset of its payment options. For example, let's say the payment app registers the following manifest file:

```json
{
  "label": "Bob Pay",
  "options": [{
    "id": "1",
    "label": "Bob Pay Visa",
    "supportedMethods": ["basic-card"]
  }, {
    "id": "2",
    "label": "Bob Pay MasterCard",
    "supportedMethods": ["basic-card"]
  }]
}
```

Then let's say a PaymentRequest like this is constructed:

```javascript
new PaymentRequest(
    [{supportedMethods: ["basic-card"], data: {supportedNetworks: ["visa"]}}],
    shoppingCart)
  .show()
  .then(handlePayment)
  .catch(handleError);
```

If the lambda function returns only "I can handle this" as output, then a browser implementation might show both "Bob Pay Visa" and "Bob Pay MasterCard", which would not be correct. However, if the lambda function returned `["1"]` to indicate that only the first option should be displayed, then the browser can make the correct decision to display only "Bob Pay Visa".

-- 
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/webpayments-payment-apps-api/issues/63#issuecomment-264277678

Received on Thursday, 1 December 2016 19:59:59 UTC