Re: [w3c/payment-handler] Add CanMakePaymentEvent. (#170)

@jenan-stripe That was not my intention. Can you elaborate more on how you envision this happening?

I expect a payment handler to provide the list of all of its active cards to the browser like so:

```javascript
navigator.serviceWorker.register('/pw/app.js').then(function(registration) {
  registration.paymentManager.userHint = '(Visa ****1111)';
  registration.paymentManager.instruments.set(
   '0',
   {
     name: "Visa ****1111",
     icons: [{
       src: '/pay/visa.png',
       sizes: '32x32',
       type: 'image/png'
   }],
   enabledMethods: ['basic-card'],
   capabilities: {
    supportedNetworks: ['visa']
    supportedTypes: ['credit']
  }
});
```

Then `new PaymentRequest([{supportedMethods: 'basic-card'}], shoppingCart).canMakePayment()` should return true because there's an active card in the payment handler. Note that `new PaymentRequest([{supportedMethods: 'basic-card', data: {supportedTypes: ['debit']}}], shoppingCart).canMakePayment()` would return false because of mismatch in `supportedTypes` in this example.

By the way, the current implementation of `basic-card` in Chrome via autofill cards stored on disk is not affected by this payment handler specification.

-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/payment-handler/pull/170#issuecomment-335463722

Received on Tuesday, 10 October 2017 12:58:35 UTC