Skip to content

Commit 5337037

Browse files
passing data on complete() (#982)
1 parent b6b0630 commit 5337037

File tree

1 file changed

+71
-3
lines changed

1 file changed

+71
-3
lines changed

index.html

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,6 +1761,35 @@ <h2>
17611761
</dd>
17621762
</dl>
17631763
</section>
1764+
<section data-dfn-for="PaymentCompleteDetails">
1765+
<h2>
1766+
<dfn>PaymentCompleteDetails</dfn> dictionary
1767+
</h2>
1768+
<pre class="idl">
1769+
dictionary PaymentCompleteDetails {
1770+
object? data = null;
1771+
};
1772+
</pre>
1773+
<p>
1774+
The {{PaymentCompleteDetails}} dictionary provides additional
1775+
information from the merchant website to the payment handler when the
1776+
payment request completes.
1777+
</p>
1778+
<p>
1779+
The {{PaymentCompleteDetails}} dictionary contains the following
1780+
members:
1781+
</p>
1782+
<dl>
1783+
<dt>
1784+
<dfn>data</dfn> member
1785+
</dt>
1786+
<dd>
1787+
An object that provides optional information that might be needed by
1788+
the {{PaymentResponse}} associated [=payment method=]. If supplied,
1789+
it will be <a>JSON-serialized</a>.
1790+
</dd>
1791+
</dl>
1792+
</section>
17641793
<section data-dfn-for="PaymentComplete">
17651794
<h2>
17661795
<dfn>PaymentComplete</dfn> enum
@@ -1810,7 +1839,10 @@ <h2>
18101839
readonly attribute object details;
18111840

18121841
[NewObject]
1813-
Promise&lt;undefined&gt; complete(optional PaymentComplete result = "unknown");
1842+
Promise&lt;undefined&gt; complete(
1843+
optional PaymentComplete result = "unknown",
1844+
optional PaymentCompleteDetails details = {}
1845+
);
18141846
[NewObject]
18151847
Promise&lt;undefined&gt; retry(optional PaymentValidationErrors errorFields = {});
18161848
};
@@ -2088,6 +2120,42 @@ <h2>
20882120
</li>
20892121
<li>Let |promise:Promise| be <a>a new promise</a>.
20902122
</li>
2123+
<li>Let |serializedData| be the result of <a>JSON-serializing</a>
2124+
|details|.{{PaymentCompleteDetails/data}} into a string.
2125+
</li>
2126+
<li>If serializing [=exception/throws=] an exception, return <a>a
2127+
promise rejected with</a> that exception.
2128+
</li>
2129+
<li>If required by the specification that defines the
2130+
|response|.{{PaymentResponse/methodName}}:
2131+
<ol data-cite="ECMASCRIPT">
2132+
<li>Let |json| be the result of calling `JSON`'s {{JSON/parse()}}
2133+
with |serializedData|.
2134+
</li>
2135+
<li>Let |idl| be the result of [=converted to an IDL
2136+
value|converting=] |json| to an IDL value of the type specified
2137+
by the specification that defines the
2138+
|response|.{{PaymentResponse/methodName}}.
2139+
</li>
2140+
<li>If the conversion to an IDL value [=exception/throws=] an
2141+
[=exception=], return <a>a promise rejected with</a> that
2142+
exception.
2143+
</li>
2144+
<li>If required by the specification that defines the
2145+
|response|.{{PaymentResponse/methodName}}, validate the members
2146+
of |idl|. If a member's value is invalid, return <a>a promise
2147+
rejected with</a> a {{TypeError}}.
2148+
<aside class="note" title="Opportunity to recover">
2149+
<p>
2150+
The steps above assures that errors that could result from
2151+
IDL type conversion and/or validation are caught as early
2152+
as possible, giving the developer an opportunity to
2153+
recover.
2154+
</p>
2155+
</aside>
2156+
</li>
2157+
</ol>
2158+
</li>
20912159
<li>Set |response|.{{PaymentResponse/[[complete]]}} to true.
20922160
</li>
20932161
<li>Return |promise| and perform the remaining steps <a>in
@@ -2107,8 +2175,8 @@ <h2>
21072175
<li>Otherwise:
21082176
<ol>
21092177
<li>Close down any remaining user interface. The <a>user
2110-
agent</a> MAY use the value |result| to influence the user
2111-
experience.
2178+
agent</a> MAY use the value |result| and |serializedData| to
2179+
influence the user experience.
21122180
</li>
21132181
<li>Set |request|'s <a>payment-relevant browsing context</a>'s
21142182
<a>payment request is showing</a> boolean to false.

0 commit comments

Comments
 (0)