Re: [w3c/payment-handler] [WIP] showPaymentUI() method (#325)

dlongley commented on this pull request.



> @@ -1643,6 +1654,44 @@ <h2>
         <a>PaymentRequest</a>. A single <a>payment handler</a> SHOULD NOT be
         allowed to open more than one client window using this method.
       </p>
+      <section data-dfn-for="PaymentHandlerContainer" data-link-for=
+      "PaymentHandlerContainer">
+        <h2>
+          <dfn>PaymentHandlerContainer</dfn> interface
+        </h2>
+        <pre class="idl">
+        [SecureContxt, Exposed=Window]
+        interface PaymentHandlerContainer {
+          readonly attribute object? data;
+          void respondWith(PaymentHandlerResponse response);
+        };
+
+        partial interface Navigator {
+          [SecureContext, SameObject] readonly attribute PaymentHandlerContainer paymentHandler;

`paymentHandler.data` should be a Promise, IMO. This seemed to work well with the Web Payment CG's original API design where the "payment request" could be retrieved via `getPendingRequest`:

```js
const paymentRequest = await navigator.payment.getPendingRequest();
// ... handle payment request, generate acknowledgement

// acknowledge payment request handled
navigator.payment.acknowledge(acknowledgement);
```
https://github.com/Spec-Ops/payment-polyfill#getting-a-pending-payment-request

Here it would be:

```js
const data = await navigator.paymentHandler.data;
// ... handle payment request, generate response

// respond to payment request
navigator.paymentHandler.respondWith(response);
```

-- 
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/pull/325#discussion_r219910819

Received on Monday, 24 September 2018 16:55:21 UTC