Re: [w3c/payment-handler] Support delegating collection of shipping address and other user data to Payment Handler (#337)

A payment handler should specify their own capabilities.
```javascript
registration.paymentManager.capabilities.set(
    ['requestShipping', 'requestPayerEmail'])
  .then(handleDoneSettingCapabilities)
  .catch(handleError);
```
This will allow user agents to re-use the keys of the [PaymentOptions](https://w3c.github.io/payment-request/#paymentoptions-dictionary) dictionary.

The `PaymentRequestEvent` should include readonly booleans for these options.
```javascript
self.addEventListener('paymentrequest', evt => {
  if (evt.requestShipping) {
    doSomethingForShippingAddresses();
  }
});
```

A payment handler should also be able to fire the relevant events for the merchants.
```javascript
registration.paymentManager.fireEvent(
    paymentRequestIdentifier, 'shippingaddresschange', {country: 'CA'})
  .then(handleUpdateWith)
  .catch(handleError);
```
User agents can reuse [event names from Payment Request](https://w3c.github.io/payment-request/#summary), such as `shippingaddresschange`.

The event firing method should be on the `paymentManager` object and keyed by the payment request identifier for ease of access by the payment handler window, where the user would be interacting with their shipping addresses and contact information. This is the pattern that we plan to use for responding to `paymentrequest` events in the future as well, so that the service worker process does not have to stay alive while the payment handler window is interactive.

-- 
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/payment-handler/issues/337#issuecomment-481243392

Received on Tuesday, 9 April 2019 13:07:11 UTC