- From: Rouslan Solomakhin <notifications@github.com>
- Date: Tue, 09 Apr 2019 06:06:47 -0700
- To: w3c/payment-handler <payment-handler@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/payment-handler/issues/337/481243392@github.com>
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