Re: [w3ctag/design-reviews] [Payments] shipping and contact info delegation (#425)

> > Payment handlers can support any subset of it via calling [`enableDelegations`](https://w3c.github.io/payment-handler/#enabledelegations-method) during their installation (please check the [payment handler registration](https://w3c.github.io/payment-handler/#example-3-payment-handler-registration) example for more details).
> 
> What happens if the payment handler after an update would like to enable further delegations?

If the payment handler is already registered, getRegistration('app.js') would work:
```javascript
function updateSupportedDelegations() {
  navigator.serviceWorker.getRegistration('payment_handler.js').then(registration => {
    if (!registration.paymentManager) {
      console.log(
          'No payment handler capability in this browser. Is chrome://flags/#service-worker-payment-apps enabled?');
      return;
    }
    registration.paymentManager
        .enableDelegations(['shippingAddress', 'PayerName'])
        .then(() => {
          console.log('Enabled delegations');
        })
  })
}
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/425#issuecomment-560536958

Received on Monday, 2 December 2019 19:09:14 UTC