@adrianhopebailie,
> can you explain where this code would run and what it does?
Not to speak for @marcoscaceres, but I would expect this code to run on a page on the site that wants to handle payments. It's not something that runs in a service worker from that site, if that's what you're getting at. As for `PaymentManager` being on `window`, that looks quite similar (but not exactly) to the approach the Notifications API takes to permissions, which is to expose a `Notifications` interface on `window` with a `requestPermission` method. But I do understand that it would be odd to expose the entire `PaymentManager` API there, given how it is meant to be bound to a service worker registration.
The purpose of this code is so that when a user visits a website that can potentially handle payments, the website may call `Something.requestPermission()` to ask the user to grant that origin the ability to handle payments. By granting this permission, the website may now register payment handlers in service workers to receive payment requests.
--
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/94#issuecomment-284785420