allows multiple browser tabs to show a payment UI at the same time
(for those payment handlers able to support it).
-
Integrated with [[[feature-policy]]].
+
Integrated with [[[permissions-policy]]].
Defined handling of multiple applicable modifiers.
@@ -683,8 +683,8 @@
If the current settings object's [=environment settings
object / responsible document=] is not allowed to use the
- "[=payment-feature|payment=]" feature, then [=exception/throw=] a
- {{"SecurityError"}} {{DOMException}}.
+ "[=payment-permission|payment=]" permission, then [=exception/throw=]
+ a {{"SecurityError"}} {{DOMException}}.
Establish the request's id:
@@ -3563,26 +3563,26 @@
To indicate that a cross-origin iframe is allowed to invoke the
payment request API, the {{ HTMLIFrameElement.allowPaymentRequest }}
- attribute can be specified on the iframe element. See for details of how {{
- HTMLIFrameElement.allowPaymentRequest }} and [[[feature-policy]]]
+ attribute can be specified on the iframe element. See
+ [[[#permissions-policy]]] for details of how {{
+ HTMLIFrameElement.allowPaymentRequest }} and [[[permissions-policy]]]
interact.
- This specification defines a policy-controlled feature identified by
- the string "payment". Its default allowlist is
'self'.
- A document’s [=Document/feature policy=] determines whether
- any content in that document is allowed to construct
+ A document’s [=Document/permissions policy=] determines
+ whether any content in that document is allowed to construct
{{PaymentRequest}} instances. If disabled in any document, no content
in the document will be allowed to use the {{PaymentRequest}}
constructor (trying to create an instance will throw).
@@ -3594,8 +3594,8 @@
[^iframe/allow^] attribute, setting [^iframe/allowpaymentrequest^] on
an iframe is equivalent to `<iframe allow="fullscreen *">`, as
described in Feature Policy
- §allowpaymentrequest.
+ "permissions-policy#iframe-allowpaymentrequest-attribute">Permissions
+ Policy §allowpaymentrequest.
enhance privacy, only some billing address data is returned to the
merchant as long as the user has not confirmed payment.
-
Added support for {{retry()}} and
- fine-grain error reporting to the user.
+
Added support for {{PaymentResponse/retry()}} and fine-grain
+ error reporting to the user.
Added support for merchant validation by the payment handler.
-
Clearer definition of
- canMakePayment() and worked to align implementations.
- canMakePayment() does not reveal whether payment handler is
- primed to pay.
+
Clearer definition of {{PaymentRequest/canMakePayment()}} and
+ worked to align implementations. {{PaymentRequest/canMakePayment()}}
+ does not reveal whether payment handler is primed to pay.
Removed `languageCode` and `regionCode` from {{PaymentAddress}}.
@@ -294,11 +293,11 @@
suffice).
-
+
Once a {{PaymentRequest}} is constructed, it's presented to the end
- user via the show() method. The show() returns a promise
- that, once the user confirms request for payment, results in a
- PaymentResponse.
+ user via the {{PaymentRequest/show()}} method. The
+ {{PaymentRequest/show()}} returns a promise that, once the user
+ confirms request for payment, results in a {{PaymentResponse}}.
@@ -538,15 +537,14 @@
Fine-grained error reporting
- A developer can use the shippingAddressErrors member of the
- PaymentDetailsUpdate dictionary to indicate that there are
+ A developer can use the
+ {{PaymentDetailsUpdate/shippingAddressErrors}} member of the
+ {{PaymentDetailsUpdate}} dictionary to indicate that there are
validation errors with specific attributes of a {{PaymentAddress}}.
- The shippingAddressErrors
- member is a AddressErrors dictionary, whose members
- specifically demarcate the fields of a physical address that
- are erroneous while also providing helpful error messages to be
- displayed to the end user.
+ The {{PaymentDetailsUpdate/shippingAddressErrors}} member is a
+ {{AddressErrors}} dictionary, whose members specifically demarcate
+ the fields of a physical address that are erroneous while also
+ providing helpful error messages to be displayed to the end user.
request.onshippingaddresschange = ev => {
@@ -565,14 +563,14 @@
}
-
+
POSTing payment response back to a server
- It's expected that data in a PaymentResponse will be POSTed
- back to a server for processing. To make this as easy as possible,
- PaymentResponse can use the [=default toJSON steps=] (i.e.,
+ It's expected that data in a {{PaymentResponse}} will be POSTed back
+ to a server for processing. To make this as easy as possible,
+ {{PaymentResponse}} can use the [=default toJSON steps=] (i.e.,
`.toJSON()`) to serializes the object directly into JSON. This makes
it trivial to POST the resulting JSON back to a server using the
[[[fetch]]]:
@@ -599,7 +597,7 @@
-
+
PaymentRequest interface
@@ -642,15 +640,16 @@
while the user is providing input (up to the point of user approval
or denial of the payment request).
+ The {{PaymentRequest/shippingAddress}},
+ {{PaymentRequest/shippingOption}}, and
+ {{PaymentRequest/shippingType}} attributes are populated during
+ processing if the {{PaymentOptions/requestShipping}} member is set.
A |request|'s payment-relevant browsing context is that
- {{PaymentRequest}}'s relevant global object's browsing context's
+ {{PaymentRequest}}'s [=relevant global object=]'s browsing context's
top-level browsing context. Every payment-relevant browsing
context has a payment request is showing boolean, which
prevents showing more than one payment UI at a time.
@@ -797,29 +796,32 @@
present and set to true, process shipping options:
If |seenIDs| contains |option|.id, then throw
- a {{TypeError}}. Optionally, inform the developer that
+
If |seenIDs| contains
+ |option|.{{PaymentShippingOption/id}}, then throw a
+ {{TypeError}}. Optionally, inform the developer that
shipping option IDs must be unique.
Otherwise, append
+ |option|.{{PaymentShippingOption/id}} to |seenIDs|.
-
If |option|.selected is true, then set
- |selectedShippingOption| to |option|.id.
+
If |option|.{{PaymentShippingOption/selected}} is
+ true, then set |selectedShippingOption| to
+ |option|.{{PaymentShippingOption/id}}.
@@ -893,21 +895,21 @@
Let |request:PaymentRequest| be a new {{PaymentRequest}}.
-
Set |request|.[=PaymentRequest/[[handler]]=] to `null`.
+
Set |request|.{{PaymentRequest/[[handler]]}} to `null`.
-
Set |request|.[=PaymentRequest/[[options]]=] to |options|.
+
Set |request|.{{PaymentRequest/[[options]]}} to |options|.
Set |request|.{{PaymentRequest/[[state]]}} to
"[=state/created=]".
Set |request|.{{PaymentRequest/[[updating]]}} to false.
-
Set |request|.[=PaymentRequest/[[details]]=] to |details|.
+
Set |request|.{{PaymentRequest/[[details]]}} to |details|.
-
Set |request|.[=PaymentRequest/[[serializedModifierData]]=] to
+
Set |request|.{{PaymentRequest/[[serializedModifierData]]}} to
|serializedModifierData|.
-
Set |request|.[=PaymentRequest/[[serializedMethodData]]=] to
+
Set |request|.{{PaymentRequest/[[serializedMethodData]]}} to
|serializedMethodData|.
Set |request|.{{PaymentRequest/[[response]]}} to null.
@@ -927,14 +929,14 @@
-
+
id attribute
- When getting, the id attribute returns this
+ When getting, the {{PaymentRequest/id}} attribute returns this
{{PaymentRequest}}'s
- [=PaymentRequest/[[details]]=].{{PaymentDetailsInit/id}}.
+ {{PaymentRequest/[[details]]}}.{{PaymentDetailsInit/id}}.
@@ -944,26 +946,27 @@
-
+
show() method
- The show() method is called when a developer wants to begin
- user interaction for the payment request. The show() method
- returns a {{Promise}} that will be resolved when the user
- accepts the payment request. Some kind of user interface will
- be presented to the user to facilitate the payment request after
- the show() method returns.
+ The {{PaymentRequest/show()}} method is called when a developer
+ wants to begin user interaction for the payment request. The
+ {{PaymentRequest/show()}} method returns a {{Promise}} that will be
+ resolved when the user accepts the payment request. Some
+ kind of user interface will be presented to the user to facilitate
+ the payment request after the {{PaymentRequest/show()}} method
+ returns.
Each payment handler controls what happens when multiple browsing
- context simultaneously call the show() method. For instance,
- some payment handlers will allow multiple payment UIs to be shown
- in different browser tabs/windows. Other payment handlers might
- only allow a single payment UI to be shown for the entire user
- agent.
+ context simultaneously call the {{PaymentRequest/show()}} method.
+ For instance, some payment handlers will allow multiple payment UIs
+ to be shown in different browser tabs/windows. Other payment
+ handlers might only allow a single payment UI to be shown for the
+ entire user agent.
@@ -977,10 +980,10 @@
[=transient activation=], return [=a promise rejected with=] with a
{{"SecurityError"}} {{DOMException}}.
-
Optionally, if the user agent wishes to disallow the call
- to show() to protect the user, then return a promise
- rejected with a {{"SecurityError"}} {{DOMException}}. For
+ to {{PaymentRequest/show()}} to protect the user, then return a
+ promise rejected with a {{"SecurityError"}} {{DOMException}}. For
example, the user agent may limit the rate at which a page
- can call show(), as described in section .
+ can call {{PaymentRequest/show()}}, as described in section
+ .
If |request|.{{PaymentRequest/[[state]]}} is not
@@ -1049,7 +1052,7 @@
For each |tuple| in
- [=PaymentRequest/[[serializedModifierData]]=]:
+ {{PaymentRequest/[[serializedModifierData]]}}:
If the first element of |tuple| (a PMI) matches the
payment method identifier of
- |request|.[=PaymentRequest/[[handler]]=], then append the second
+ |request|.{{PaymentRequest/[[handler]]}}, then append the second
element of |tuple| (the serialized method data) to |modifiers|.
@@ -1174,11 +1177,11 @@
Handling of multiple applicable modifiers in the
- [=PaymentRequest/[[serializedModifierData]]=] internal slot is
+ {{PaymentRequest/[[serializedModifierData]]}} internal slot is
payment handler specific and beyond the scope of this
specification. Nevertheless, it is RECOMMENDED that payment
handlers use a "last one wins" approach with items in the
- [=PaymentRequest/[[serializedModifierData]]=] list: that is to
+ {{PaymentRequest/[[serializedModifierData]]}} list: that is to
say, an item at the end of the list always takes precedence over
any item at the beginning of the list (see example below).
@@ -1187,7 +1190,7 @@
This example uses the "basic-card" payment method to from
[[[?payment-method-basic-card]]] demonstrate precedence order
- of [=PaymentRequest/[[serializedModifierData]]=]. The first
+ of {{PaymentRequest/[[serializedModifierData]]}}. The first
modifier applies equally to all cards, irrespective of network.
The second modifier applies specifically to cards on the "visa"
network.
@@ -1269,27 +1272,29 @@
-
+
abort() method
- The abort() method is called if a developer wishes to tell
- the user agent to abort the payment |request| and to tear
- down any user interface that might be shown. The abort() can
- only be called after the show() method has been called (see
- states) and before this instance's [[\acceptPromise]]
- has been resolved. For example, developers might choose to do this
- if the goods they are selling are only available for a limited
- amount of time. If the user does not accept the payment request
- within the allowed time period, then the request will be aborted.
+ The {{PaymentRequest/abort()}} method is called if a developer
+ wishes to tell the user agent to abort the payment |request|
+ and to tear down any user interface that might be shown. The
+ {{PaymentRequest/abort()}} can only be called after the
+ {{PaymentRequest/show()}} method has been called (see
+ states) and before this instance's
+ {{PaymentRequest/[[acceptPromise]]}} has been resolved. For
+ example, developers might choose to do this if the goods they are
+ selling are only available for a limited amount of time. If the
+ user does not accept the payment request within the allowed time
+ period, then the request will be aborted.
A user agent might not always be able to abort a request.
For example, if the user agent has delegated responsibility
- for the request to another app. In this situation, abort()
- will reject the returned {{Promise}}.
+ for the request to another app. In this situation,
+ {{PaymentRequest/abort()}} will reject the returned {{Promise}}.
If |request|.{{PaymentRequest/[[response]]}} is not null, and
- |request|.{{PaymentRequest/[[response]]}}.[[\retryPromise]] is
- not null, return a promise rejected with an
+ |request|.{{PaymentRequest/[[response]]}}.{{PaymentResponse/[[retryPromise]]}}
+ is not null, return a promise rejected with an
{{"InvalidStateError"}} {{DOMException}}.
If the value of |request|.{{PaymentRequest/[[state]]}} is not
@@ -1340,120 +1345,122 @@
-
+
canMakePayment() method
- The canMakePayment() method can be used by the developer to
- determine if the user agent has support for one of the
- desired payment methods. See
+ The {{PaymentRequest/canMakePayment()}} method can be used by the
+ developer to determine if the user agent has support for one
+ of the desired payment methods. See
[[[#canmakepayment-protections]]].
- A true result from canMakePayment() does not imply that the
- user has a provisioned instrument ready for payment. For that, use
- hasEnrolledInstrument() instead.
+ A true result from {{PaymentRequest/canMakePayment()}} does not
+ imply that the user has a provisioned instrument ready for payment.
+ For that, use {{PaymentRequest/hasEnrolledInstrument()}} instead.
- The hasEnrolledInstrument() method can be used by the
- developer to determine if the user agent has support for one
- of the desired payment methods and if a payment handler
- has an instrument ready for payment. See
+ The {{PaymentRequest/hasEnrolledInstrument()}} method can be used by
+ the developer to determine if the user agent has support for
+ one of the desired payment methods and if a payment
+ handler has an instrument ready for payment. See
[[[#canmakepayment-protections]]].
- A {{PaymentRequest}}'s shippingAddress attribute is populated
- when the user provides a shipping address. It is null by default.
- When a user provides a shipping address, the shipping address
- changed algorithm runs.
+ A {{PaymentRequest}}'s {{PaymentRequest/shippingAddress}} attribute
+ is populated when the user provides a shipping address. It is null by
+ default. When a user provides a shipping address, the shipping
+ address changed algorithm runs.
-
+
shippingType attribute
- A {{PaymentRequest}}'s shippingType attribute is the type of
- shipping used to fulfill the transaction. Its value is either a
- PaymentShippingType enum value, or null if none is provided by
- the developer during [=PaymentRequest.PaymentRequest()|construction=]
- (see {{PaymentOptions}}'s {{PaymentOptions/shippingType}} member).
+ A {{PaymentRequest}}'s {{PaymentRequest/shippingType}} attribute is
+ the type of shipping used to fulfill the transaction. Its value is
+ either a PaymentShippingType enum value, or null if none is
+ provided by the developer during
+ [=PaymentRequest.PaymentRequest()|construction=] (see
+ {{PaymentOptions}}'s {{PaymentOptions/shippingType}} member).
-
+
onmerchantvalidation attribute
- A {{PaymentRequest}}'s onmerchantvalidation attribute is an
- {{EventHandler}} for a {{MerchantValidationEvent}} named
- "merchantvalidation".
+ A {{PaymentRequest}}'s {{PaymentRequest/onmerchantvalidation}}
+ attribute is an {{EventHandler}} for a {{MerchantValidationEvent}}
+ named "merchantvalidation".
-
+
onshippingaddresschange attribute
- A {{PaymentRequest}}'s onshippingaddresschange attribute is an
- {{EventHandler}} for a {{PaymentRequestUpdateEvent}} named
- shippingaddresschange.
+ A {{PaymentRequest}}'s {{PaymentRequest/onshippingaddresschange}}
+ attribute is an {{EventHandler}} for a {{PaymentRequestUpdateEvent}}
+ named shippingaddresschange.
-
+
shippingOption attribute
- A {{PaymentRequest}}'s shippingOption attribute is populated
- when the user chooses a shipping option. It is null by default. When
- a user chooses a shipping option, the shipping option changed
- algorithm runs.
+ A {{PaymentRequest}}'s {{PaymentRequest/shippingOption}} attribute is
+ populated when the user chooses a shipping option. It is null by
+ default. When a user chooses a shipping option, the shipping
+ option changed algorithm runs.
-
+
onshippingoptionchange attribute
- A {{PaymentRequest}}'s onshippingoptionchange attribute is an
- {{EventHandler}} for a {{PaymentRequestUpdateEvent}} named
- shippingoptionchange.
+ A {{PaymentRequest}}'s {{PaymentRequest/onshippingoptionchange}}
+ attribute is an {{EventHandler}} for a {{PaymentRequestUpdateEvent}}
+ named shippingoptionchange.
-
+
onpaymentmethodchange attribute
- A {{PaymentRequest}}'s onpaymentmethodchange attribute is an
- {{EventHandler}} for a {{PaymentMethodChangeEvent}} named
- "paymentmethodchange".
+ A {{PaymentRequest}}'s {{PaymentRequest/onpaymentmethodchange}}
+ attribute is an {{EventHandler}} for a {{PaymentMethodChangeEvent}}
+ named "paymentmethodchange".
@@ -1493,7 +1500,7 @@
A list containing the serialized string form of each
{{PaymentDetailsModifier/data}} member for each corresponding
item in the sequence
- [=PaymentRequest/[[details]]=].{{PaymentDetailsBase/modifier}},
+ {{PaymentRequest/[[details]]}}.{{PaymentDetailsBase/modifier}},
or null if no such member was present.
@@ -1503,14 +1510,14 @@
"PaymentRequest">[[\details]]
- The current PaymentDetailsBase for the payment request
+ The current {{PaymentDetailsBase}} for the payment request
initially supplied to the constructor and then updated with calls
to {{PaymentRequestUpdateEvent/updateWith()}}. Note that all
{{PaymentDetailsModifier/data}} members of
{{PaymentDetailsModifier}} instances contained in the
{{PaymentDetailsBase/modifiers}} member will be removed, as they
are instead stored in serialized form in the
- [=PaymentRequest/[[serializedModifierData]]=] internal slot.
+ {{PaymentRequest/[[serializedModifierData]]}} internal slot.
- Null, or the PaymentResponse instantiated by this
+ Null, or the {{PaymentResponse}} instantiated by this
{{PaymentRequest}}.
@@ -1612,8 +1620,7 @@
-
+
PaymentMethodData dictionary
@@ -1651,8 +1658,7 @@
with existing content on the Web.
-
+
PaymentCurrencyAmount dictionary
@@ -1663,7 +1669,7 @@
};
- A PaymentCurrencyAmount dictionary is used to supply monetary
+ A {{PaymentCurrencyAmount}} dictionary is used to supply monetary
amounts.
@@ -1679,8 +1685,9 @@
currency code for which localized currency symbols are available is
implementation dependent. Where a localized currency symbol is not
available, a user agent SHOULD use U+00A4 (¤) for formatting. User
- agents MAY format the display of the currency member to
- adhere to OS conventions (e.g., for localization purposes).
+ agents MAY format the display of the
+ {{PaymentCurrencyAmount/currency}} member to adhere to OS
+ conventions (e.g., for localization purposes).
@@ -1757,42 +1764,44 @@
To check and canonicalize amount given a
- PaymentCurrencyAmount |amount|, run the following steps:
+ {{PaymentCurrencyAmount}} |amount|, run the following steps:
-
+
If the result of IsWellFormedCurrencyCode(|amount|.currency)
+ "ecma-402#sec-iswellformedcurrencycode">IsWellFormedCurrencyCode(|amount|.{{PaymentCurrencyAmount/currency}})
is false, then throw a {{RangeError}} exception, optionally informing
the developer that the currency is invalid.
-
If |amount|.value is not a valid decimal monetary
- value, throw a {{TypeError}}, optionally informing the developer
- that the currency is invalid.
+
If |amount|.{{PaymentCurrencyAmount/value}} is not a valid
+ decimal monetary value, throw a {{TypeError}}, optionally
+ informing the developer that the currency is invalid.
Set |amount|.{{PaymentCurrencyAmount/currency}} to the result of
+ ASCII uppercase |amount|.{{PaymentCurrencyAmount/currency}}.
To check and canonicalize total amount given a
- PaymentCurrencyAmount |amount|, run the following steps:
+ {{PaymentCurrencyAmount}} |amount:PaymentCurrencyAmount|, run the
+ following steps:
If the first code point of |amount|.value is U+002D
- (-), then throw a {{TypeError}} optionally informing the developer
- that a total's value can't be a negative number.
+
If the first code point of
+ |amount|.{{PaymentCurrencyAmount/value}} is U+002D (-), then throw a
+ {{TypeError}} optionally informing the developer that a total's value
+ can't be a negative number.
@@ -1801,8 +1810,7 @@
Payment details dictionaries
-
+
PaymentDetailsBase dictionary
@@ -1818,8 +1826,8 @@
displayItems member
- A sequence of PaymentItem dictionaries contains line items
- for the payment request that the user agent MAY display.
+ A sequence of {{PaymentItem}} dictionaries contains line items for
+ the payment request that the user agent MAY display.
-
+
PaymentDetailsInit dictionary
@@ -1888,9 +1895,9 @@
of the payment request.
- In addition to the members inherited from the
- PaymentDetailsBase dictionary, the following members are part
- of the PaymentDetailsInit dictionary:
+ In addition to the members inherited from the {{PaymentDetailsBase}}
+ dictionary, the following members are part of the
+ PaymentDetailsInit dictionary:
@@ -1899,8 +1906,9 @@
A free-form identifier for this payment request.
@@ -1908,7 +1916,7 @@
total member
- A PaymentItem containing a non-negative total amount for the
+ A {{PaymentItem}} containing a non-negative total amount for the
payment request.
-
+
PaymentDetailsUpdate dictionary
@@ -1934,13 +1941,13 @@
};
- The PaymentDetailsUpdate dictionary is used to update the
- payment request using {{PaymentRequestUpdateEvent/updateWith()}}.
+ The {{PaymentDetailsUpdate}} dictionary is used to update the payment
+ request using {{PaymentRequestUpdateEvent/updateWith()}}.
- In addition to the members inherited from the
- PaymentDetailsBase dictionary, the following members are part
- of the PaymentDetailsUpdate dictionary:
+ In addition to the members inherited from the {{PaymentDetailsBase}}
+ dictionary, the following members are part of the
+ {{PaymentDetailsUpdate}} dictionary:
@@ -1953,7 +1960,7 @@
{{PaymentRequestUpdateEvent/updateWith()}}, the
{{PaymentDetailsUpdate}} can contain a message in the
{{PaymentDetailsUpdate/error}} member that will be displayed to the
- user if the PaymentDetailsUpdate indicates that there are no
+ user if the {{PaymentDetailsUpdate}} indicates that there are no
valid {{PaymentDetailsBase/shippingOptions}} (and the
{{PaymentRequest}} was constructed with the
{{PaymentOptions/requestShipping}} option set to true).
@@ -1962,12 +1969,11 @@
total member
- A PaymentItem containing a non-negative
- {{PaymentItem/amount}}.
+ A {{PaymentItem}} containing a non-negative {{PaymentItem/amount}}.
Algorithms in this specification that accept a
- PaymentDetailsUpdate dictionary will throw if the
- total.{{PaymentItem/amount}}.{{PaymentCurrencyAmount/value}}
+ {{PaymentDetailsUpdate}} dictionary will throw if the
+ {{PaymentDetailsUpdate/total}}.{{PaymentItem/amount}}.{{PaymentCurrencyAmount/value}}
is a negative number.
- A sequence of one or more PaymentItem dictionaries is included
- in the PaymentDetailsBase dictionary to indicate what the
- payment request is for and the value asked for.
+ A sequence of one or more {{PaymentItem}} dictionaries is included in
+ the {{PaymentDetailsBase}} dictionary to indicate what the payment
+ request is for and the value asked for.
@@ -2214,7 +2220,7 @@
amount member
- A PaymentCurrencyAmount containing the monetary amount for the
+ A {{PaymentCurrencyAmount}} containing the monetary amount for the
item.
@@ -2347,37 +2353,37 @@
The steps to internally construct a
- `PaymentAddress` with an optional AddressInit
- |details| are given by the following algorithm:
+ `PaymentAddress` with an optional {{AddressInit}}
+ |details:AddressInit| are given by the following algorithm:
Let |address:PaymentAddress| be a new instance of
{{PaymentAddress}}.
-
Set |address|.[[\addressLine]] to the empty frozen
- array, and all other [=PaymentAddress slots|internal slots=] to the
- empty string.
+
Set |address|.{{PaymentAddress/[[addressLine]]}} to the empty
+ frozen array, and all other [=PaymentAddress slots|internal slots=]
+ to the empty string.
If |details| was not passed, return |address|.
-
If |details|["country"] is present and not the empty
- string:
+
If |details|.{{AddressInit/country}} is present and not the
+ empty string:
If |details|.{{AddressInit/region}} is present, strip
+ leading and trailing ASCII whitespace from
+ |details|.{{AddressInit/region}} and set
+ |address|.{{PaymentAddress/[[region]]}} to the result.
+
+
If |details|.{{AddressInit/city}} is present, strip leading
+ and trailing ASCII whitespace from
+ |details|.{{AddressInit/city}} and set
+ |address|.{{PaymentAddress/[[city]]}} to the result.
If |details|.{{AddressInit/dependentLocality}} is present,
+ strip leading and trailing ASCII whitespace from
+ |details|.{{AddressInit/dependentLocality}} and set
+ |address|.{{PaymentAddress/[[dependentLocality]]}} to the result.
If |details|.{{AddressInit/sortingCode}} is present, strip
+ leading and trailing ASCII whitespace from
+ |details|.{{AddressInit/sortingCode}} and set
+ |address|.{{PaymentAddress/[[sortingCode]]}} to the result.
If |details|.{{AddressInit/organization}} is present, strip
+ leading and trailing ASCII whitespace from
+ |details|.{{AddressInit/organization}} and set
+ |address|.{{PaymentAddress/[[organization]]}} to the result.
Represents the country of the address. When getting, returns
- the value of the {{PaymentAddress}}'s [[\country]] internal
- slot.
+ the value of the {{PaymentAddress}}'s
+ {{PaymentAddress/[[country]]}} internal slot.
Represents the region of the address. When getting, returns
- the value of the {{PaymentAddress}}'s [[\region]] internal
- slot.
+ the value of the {{PaymentAddress}}'s {{PaymentAddress/[[region]]}}
+ internal slot.
city attribute
-
+
Represents the city of the address. When getting, returns
- the value of the {{PaymentAddress}}'s [[\city]] internal
- slot.
+ the value of the {{PaymentAddress}}'s {{PaymentAddress/[[city]]}}
+ internal slot.
@@ -2476,7 +2485,7 @@
Represents the dependent locality of the address. When
getting, returns the value of the {{PaymentAddress}}'s
- [[\dependentLocality]] internal slot.
+ {{PaymentAddress/[[dependentLocality]]}} internal slot.
@@ -2486,7 +2495,7 @@
Represents the postal code of the address. When getting,
returns the value of the {{PaymentAddress}}'s
- [[\postalCode]] internal slot.
+ {{PaymentAddress/[[postalCode]]}} internal slot.
@@ -2496,27 +2505,27 @@
Represents the sorting code of the address. When getting,
returns the value of the {{PaymentAddress}}'s
- [[\sortingCode]] internal slot.
+ {{PaymentAddress/[[sortingCode]]}} internal slot.
organization attribute
-
+
Represents the organization of the address. When getting,
returns the value of the {{PaymentAddress}}'s
- [[\organization]] internal slot.
+ {{PaymentAddress/[[organization]]}} internal slot.
recipient attribute
-
+
Represents the recipient of the address. When getting,
- returns the value of the {{PaymentAddress}}'s [[\recipient]]
- internal slot.
+ returns the value of the {{PaymentAddress}}'s
+ {{PaymentAddress/[[recipient]]}} internal slot.
@@ -2525,11 +2534,11 @@
Represents the phone number of the address. When getting,
- returns the value of the {{PaymentAddress}}'s [[\phone]]
- internal slot.
+ returns the value of the {{PaymentAddress}}'s
+ {{PaymentAddress/[[phone]]}} internal slot.
-
+
Internal
slots
@@ -2650,11 +2659,11 @@
};
- An AddressInit is passed when
+ An {{AddressInit}} is passed when
[=PaymentAddress.PaymentAddress()|constructing=] a
{{PaymentAddress}}. Its members are as follows.
-
+
country member
@@ -2739,13 +2748,13 @@
};
- The members of the AddressErrors dictionary represent
- validation errors with specific parts of a physical address.
- Each dictionary member has a dual function: firstly, its presence
- denotes that a particular part of an address is suffering from a
- validation error. Secondly, the string value allows the developer to
- describe the validation error (and possibly how the end user can fix
- the error).
+ The members of the {{AddressErrors}} dictionary represent validation
+ errors with specific parts of a physical address. Each
+ dictionary member has a dual function: firstly, its presence denotes
+ that a particular part of an address is suffering from a validation
+ error. Secondly, the string value allows the developer to describe
+ the validation error (and possibly how the end user can fix the
+ error).
Developers need to be aware that users might not have the ability to
@@ -2759,8 +2768,8 @@
Denotes that the address line has a validation error. In the
user agent's UI, this member corresponds to the input field that
- provided the {{PaymentAddress}}'s addressLine attribute's value.
+ provided the {{PaymentAddress}}'s {{PaymentAddress/addressLine}}
+ attribute's value.
city member
@@ -2768,8 +2777,8 @@
Denotes that the city has a validation error. In the user
agent's UI, this member corresponds to the input field that
- provided the {{PaymentAddress}}'s city attribute's value.
+ provided the {{PaymentAddress}}'s {{PaymentAddress/city}}
+ attribute's value.
country member
@@ -2777,8 +2786,8 @@
Denotes that the country has a validation error. In the user
agent's UI, this member corresponds to the input field that
- provided the {{PaymentAddress}}'s country attribute's value.
+ provided the {{PaymentAddress}}'s {{PaymentAddress/country}}
+ attribute's value.
dependentLocality member
@@ -2786,8 +2795,8 @@
Denotes that the dependent locality has a validation error.
In the user agent's UI, this member corresponds to the input field
- that provided the {{PaymentAddress}}'s dependentLocality attribute's value.
+ that provided the {{PaymentAddress}}'s
+ {{PaymentAddress/dependentLocality}} attribute's value.
organization member
@@ -2795,8 +2804,8 @@
Denotes that the organization has a validation error. In the
user agent's UI, this member corresponds to the input field that
- provided the {{PaymentAddress}}'s organization attribute's value.
+ provided the {{PaymentAddress}}'s {{PaymentAddress/organization}}
+ attribute's value.
phone member
@@ -2804,8 +2813,8 @@
Denotes that the phone number has a validation error. In the
user agent's UI, this member corresponds to the input field that
- provided the {{PaymentAddress}}'s phone attribute's value.
+ provided the {{PaymentAddress}}'s {{PaymentAddress/phone}}
+ attribute's value.
postalCode member
@@ -2813,8 +2822,8 @@
Denotes that the postal code has a validation error. In the
user agent's UI, this member corresponds to the input field that
- provided the {{PaymentAddress}}'s postalCode attribute's value.
+ provided the {{PaymentAddress}}'s {{PaymentAddress/postalCode}}
+ attribute's value.
recipient member
@@ -2822,8 +2831,8 @@
Denotes that the recipient has a validation error. In the
user agent's UI, this member corresponds to the input field that
- provided the {{PaymentAddress}}'s addressLine attribute's value.
+ provided the {{PaymentAddress}}'s {{PaymentAddress/addressLine}}
+ attribute's value.
region member
@@ -2831,8 +2840,8 @@
Denotes that the region has a validation error. In the user
agent's UI, this member corresponds to the input field that
- provided the {{PaymentAddress}}'s region attribute's value.
+ provided the {{PaymentAddress}}'s {{PaymentAddress/region}}
+ attribute's value.
sortingCode member
@@ -2840,8 +2849,8 @@
The sorting code has a validation error. In the user agent's
UI, this member corresponds to the input field that provided the
- {{PaymentAddress}}'s sortingCode attribute's value.
+ {{PaymentAddress}}'s {{PaymentAddress/sortingCode}} attribute's
+ value.
@@ -2873,11 +2882,12 @@
are so fine-grained that they can uniquely identify a recipient.
-
-
Let |details| be a newly created AddressInit dictionary.
+
+
Let |details:AddressInit| be a newly created {{AddressInit}}
+ dictionary.
If "addressLine" is not in |redactList|, set
- |details|["addressLine"] to the result of splitting the
+ |details|.{{AddressInit/addressLine}} to the result of splitting the
user-provided address line into a list.
If "country" is not in |redactList|, set
- |details|["country"] to the user-provided country as an upper
- case [[ISO3166-1]] alpha-2 code.
+ |details|.{{AddressInit/country}} to the user-provided country as an
+ upper case [[ISO3166-1]] alpha-2 code.
-
If "phone" is not in |redactList|, set |details|["phone"]
- to the user-provided phone number.
+
If "phone" is not in |redactList|, set
+ |details|.{{AddressInit/phone}} to the user-provided phone number.
-
If "city" is not in |redactList|, set |details|["city"] to
- the user-provided city, or to the empty string if none was provided.
+
If "city" is not in |redactList|, set
+ |details|.{{AddressInit/city}} to the user-provided city, or to the
+ empty string if none was provided.
If "dependentLocality" is not in |redactList|, set |
- details|["dependentLocality"] to the user-provided dependent
- locality.
+ details|.{{AddressInit/dependentLocality}} to the user-provided
+ dependent locality.
If "organization" is not in |redactList|, set
- |details|["organization"] to the user-provided recipient
+ |details|.{{AddressInit/organization}} to the user-provided recipient
organization.
If "postalCode" is not in |redactList|, set
- |details|["postalCode"] to the user-provided postal code.
- Optionally, redact part of |details|["postalCode"].
+ |details|.{{AddressInit/postalCode}} to the user-provided postal
+ code. Optionally, redact part of
+ |details|.{{AddressInit/postalCode}}.
Postal codes in certain countries can be so specific as
@@ -2928,8 +2940,8 @@
If "recipient" is not in |redactList|, set
- |details|["recipient"] to the user-provided recipient of the
- transaction.
+ |details|.{{AddressInit/recipient}} to the user-provided recipient of
+ the transaction.
@@ -2944,17 +2956,19 @@
address for a particular country, it might not provide a field
for the user to input a region. In such cases, the user
agent returns an empty string for both {{PaymentAddress}}'s
- region attribute - but the
- address can still serve its intended purpose (e.g., be valid for
- shipping or billing purposes).
+ {{PaymentAddress/region}} attribute - but the address can still
+ serve its intended purpose (e.g., be valid for shipping or
+ billing purposes).
-
Set |details|["region"] to the user-provided region.
+
Set |details|.{{AddressInit/region}} to the user-provided
+ region.
If "sortingCode" is not in |redactList|, set
- |details|["sortingCode"] to the user-provided sorting code.
+ |details|.{{AddressInit/sortingCode}} to the user-provided sorting
+ code.
[=PaymentAddress.PaymentAddress()|Internally construct a new
`PaymentAddress`=] with |details| and return the result.
@@ -2975,7 +2989,7 @@
};
- The PaymentShippingOption dictionary has members describing a
+ The {{PaymentShippingOption}} dictionary has members describing a
shipping option. Developers can provide the user with one or more
shipping options by calling the
{{PaymentRequestUpdateEvent/updateWith()}} method in response to a
@@ -2986,9 +3000,8 @@
id member
- A string identifier used to reference this
- PaymentShippingOption. It MUST be unique for a given
- {{PaymentRequest}}.
+ A string identifier used to reference this {{PaymentShippingOption}}.
+ It MUST be unique for a given {{PaymentRequest}}.
label member
@@ -3002,7 +3015,7 @@
amount member
- A PaymentCurrencyAmount containing the monetary amount for the
+ A {{PaymentCurrencyAmount}} containing the monetary amount for the
item.
@@ -3010,12 +3023,12 @@
A boolean. When true, it indicates that this is the default selected
- PaymentShippingOption in a sequence. User agents SHOULD
+ {{PaymentShippingOption}} in a sequence. User agents SHOULD
display this option by default in the user interface.
-
+
PaymentComplete enum
@@ -3050,7 +3063,7 @@
-
+
PaymentResponse interface
@@ -3077,7 +3090,7 @@
};
- A PaymentResponse is returned when a user has selected a payment
+ A {{PaymentResponse}} is returned when a user has selected a payment
method and approved a payment request.
@@ -3088,9 +3101,10 @@
The retry(|errorFields|) method MUST act as follows:
-
Set |response|.{{PaymentResponse/[[retryPromise]]}} to
+ |retryPromise|.
-
If |errorFields| was passed:
+
If |errorFields:PaymentValidationErrors| was passed:
Optionally, show a warning in the developer console if any of
the following are true:
- |request|.[=PaymentRequest/[[options]]=]["requestPayerName"] is false, and
- |errorFields|["payer"]["name"] is present.
+ |request|.{{PaymentRequest/[[options]]}}.{{PaymentOptions/requestPayerName}}
+ is false, and
+ |errorFields|.{{PaymentValidationErrors/payer}}.{{PayerErrors/name}}
+ is present.
- |request|.[=PaymentRequest/[[options]]=]["requestPayerEmail"] is false, and
- |errorFields|["payer"]["email"] is present.
+ |request|.{{PaymentRequest/[[options]]}}.{{PaymentOptions/requestPayerEmail}}
+ is false, and
+ |errorFields|.{{PaymentValidationErrors/payer}}.{{PayerErrors/email}}
+ is present.
- |request|.[=PaymentRequest/[[options]]=]["requestPayerPhone"] is false, and
- |errorFields|["payer"]["phone"] is present.
+ |request|.{{PaymentRequest/[[options]]}}.{{PaymentOptions/requestPayerPhone}}
+ is false, and
+ |errorFields|.{{PaymentValidationErrors/payer}}.{{PayerErrors/phone}}
+ is present.
- |request|.[=PaymentRequest/[[options]]=]["requestShipping"] is false, and
- |errorFields|["shippingAddress"] is present.
+ |request|.{{PaymentRequest/[[options]]}}.{{PaymentOptions/requestShipping}}
+ is false, and
+ |errorFields|.{{PaymentValidationErrors/shippingAddress}} is
+ present.
-
- If |errorFields|["paymentMethod"] member was passed, and
- if required by the specification that defines |response|'s
- payment method, then [=converted to an IDL value|convert=]
- |errorFields|'s paymentMethod member to an IDL value of
- the type specified there. Otherwise, [=converted to an IDL
+ If
+ |errorFields:PaymentValidationErrors|.{{PaymentValidationErrors/paymentMethod}}
+ member was passed, and if required by the specification that
+ defines |response|.{{PaymentResponse/payment}}/a>, then
+ [=converted to an IDL value|convert=] |errorFields|'s
+ {{PaymentValidationErrors/paymentMethod}} member to an IDL value
+ of the type specified there. Otherwise, [=converted to an IDL
value|convert=] to {{object}}.
By matching the
- members of |errorFields| to input fields in the user agent's UI,
- indicate to the end user that something is wrong with the data of
- the payment response. For example, a user agent might draw the
- user's attention to the erroneous |errorFields| in the browser's
- UI and display the value of each field in a manner that helps the
- user fix each error. Similarly, if the error member is
- passed, present the error in the user agent's UI. In the case
- where the value of a member is the empty string, the user agent
- MAY substitute a value with a suitable error message.
+
By matching the members of |errorFields| to input fields in
+ the user agent's UI, indicate to the end user that something is
+ wrong with the data of the payment response. For example, a user
+ agent might draw the user's attention to the erroneous
+ |errorFields| in the browser's UI and display the value of each
+ field in a manner that helps the user fix each error. Similarly,
+ if the {{PaymentValidationErrors/error}} member is passed,
+ present the error in the user agent's UI. In the case where the
+ value of a member is the empty string, the user agent MAY
+ substitute a value with a suitable error message.
@@ -3204,7 +3219,7 @@
Finally, when |retryPromise| settles, set
- |response|.[[\retryPromise]] to null.
+ |response|.{{PaymentResponse/[[retryPromise]]}} to null.
+ Represents validation errors with the {{PaymentResponse}}'s
+ {{PaymentResponse/shippingAddress}}.
error member
@@ -3249,9 +3263,10 @@
A general description of an error with the payment from which the
user can attempt to recover. For example, the user may recover by
retrying the payment. A developer can optionally pass the
- error member on its own to give a general overview of
- validation issues, or it can be passed in combination with other
- members of the PaymentValidationErrors dictionary.
+ {{PaymentValidationErrors/error}} member on its own to give a
+ general overview of validation issues, or it can be passed in
+ combination with other members of the {{PaymentValidationErrors}}
+ dictionary.
paymentMethod member
@@ -3262,7 +3277,7 @@
-
+
PayerErrors dictionary
@@ -3274,8 +3289,8 @@
};
- The PayerErrors is used to represent validation errors with
- one or more payer details.
+ The {{PayerErrors}} is used to represent validation errors with one
+ or more payer details.
Payer details are any of the payer's name, payer's phone
@@ -3288,8 +3303,8 @@
Denotes that the payer's email suffers from a validation error.
In the user agent's UI, this member corresponds to the input
- field that provided the PaymentResponse's
- payerEmail attribute's value.
+ field that provided the {{PaymentResponse}}'s payerEmail
+ attribute's value.
name member
@@ -3297,7 +3312,7 @@
Denotes that the payer's name suffers from a validation error. In
the user agent's UI, this member corresponds to the input field
- that provided the PaymentResponse's payerName
+ that provided the {{PaymentResponse}}'s payerName
attribute's value.
@@ -3306,7 +3321,7 @@
Denotes that the payer's phone number suffers from a validation
error. In the user agent's UI, this member corresponds to the
- input field that provided the PaymentResponse's
+ input field that provided the {{PaymentResponse}}'s
payerPhone attribute's value.
@@ -3426,49 +3441,52 @@
this payment response.
-
+
- complete() method
+ complete() method
- The complete() method is called after the user has accepted
- the payment request and the [[\acceptPromise]] has been
- resolved. Calling the complete() method tells the user
- agent that the payment interaction is over (and SHOULD cause any
- remaining user interface to be closed).
+ The {{PaymentResponse/complete()}} method is called after the user
+ has accepted the payment request and the
+ {{PaymentResponse/[[acceptPromise]]}} has been resolved. Calling the
+ {{PaymentResponse/complete()}} method tells the user agent
+ that the payment interaction is over (and SHOULD cause any remaining
+ user interface to be closed).
After the payment request has been accepted and the
- PaymentResponse returned to the caller, but before the caller
- calls complete(), the payment request user interface remains
- in a pending state. At this point the user interface SHOULD NOT offer
- a cancel command because acceptance of the payment request has been
- returned. However, if something goes wrong and the developer never
- calls complete() then the user interface is blocked.
+ {{PaymentResponse}} returned to the caller, but before the caller
+ calls {{PaymentResponse/complete()}}, the payment request user
+ interface remains in a pending state. At this point the user
+ interface SHOULD NOT offer a cancel command because acceptance of the
+ payment request has been returned. However, if something goes wrong
+ and the developer never calls {{PaymentResponse/complete()}} then the
+ user interface is blocked.
For this reason, implementations MAY impose a timeout for developers
- to call complete(). If the timeout expires then the
- implementation will behave as if complete() was called with no
- arguments.
+ to call {{PaymentResponse/complete()}}. If the timeout expires then
+ the implementation will behave as if {{PaymentResponse/complete()}}
+ was called with no arguments.
- The complete(|result|) method MUST act as
- follows:
+ The {{PaymentResponse/complete()}} method MUST act as follows:
If |response|.{{PaymentResponse/[[complete]]}} is true, return
+ a promise rejected with an {{"InvalidStateError"}}
+ {{DOMException}}.
If
- |response|.[[\retryPromise]] is not null, return a promise
- rejected with an {{"InvalidStateError"}} {{DOMException}}.
+ |response|.{{PaymentResponse/[[retryPromise]]}} is not null, return
+ a promise rejected with an {{"InvalidStateError"}}
+ {{DOMException}}.
Set |response|.{{PaymentResponse/[[complete]]}} to true.
Return |promise| and perform the remaining steps in
parallel.
@@ -3499,7 +3517,7 @@
-
+
onpayerdetailchange attribute
@@ -3512,8 +3530,8 @@
Internal Slots
- Instances of PaymentResponse are created with the internal
- slots in the following table:
+ Instances of {{PaymentResponse}} are created with the internal slots
+ in the following table:
@@ -3528,10 +3546,11 @@
[[\complete]]
-
+
Is true if the request for payment has completed (i.e.,
- complete() was called, or there was a fatal error that
- made the response not longer usable), or false otherwise.
+ {{PaymentResponse/complete()}} was called, or there was a fatal
+ error that made the response not longer usable), or false
+ otherwise.
@@ -3540,7 +3559,7 @@
The {{PaymentRequest}} instance that instantiated this
- PaymentResponse.
+ {{PaymentResponse}}.
@@ -3561,12 +3580,11 @@
PaymentRequest and iframe elements
- To indicate that a cross-origin iframe is allowed to invoke the
- payment request API, the {{ HTMLIFrameElement.allowPaymentRequest }}
- attribute can be specified on the iframe element. See
- [[[#permissions-policy]]] for details of how {{
- HTMLIFrameElement.allowPaymentRequest }} and [[[permissions-policy]]]
- interact.
+ To indicate that a cross-origin [^iframe^] is allowed to invoke the
+ payment request API, the [^iframe/allowpaymentrequest^] attribute can
+ be specified on the [^iframe^] element. See [[[#permissions-policy]]]
+ for details of how [^iframe/allowoaymentrequest=] and
+ [[[permissions-policy]]] interact.
@@ -3588,7 +3606,7 @@
constructor (trying to create an instance will throw).
- The {{ HTMLIFrameElement.allowPaymentRequest }} attribute of the HTML
+ The [^iframe/allowpaymentrequest^] attribute of the HTML
iframe element affects the container policy for any
document nested in that iframe. Unless overridden by the
[^iframe/allow^] attribute, setting [^iframe/allowpaymentrequest^] on
@@ -3677,7 +3695,7 @@
When getting, returns the value it was initialized with. See
- methodName member of MerchantValidationEventInit for
- more information.
+ {{MerchantValidationEvent/methodName}} member of
+ {{MerchantValidationEventInit}} for more information.
@@ -3730,31 +3747,36 @@
The event constructing steps, which take a
- {{MerchantValidationEvent}} |event|, are as follows:
+ {{MerchantValidationEvent}} |event:MerchantValidationEvent|, are as
+ follows:
Let |base:URL| be the [=context object|event=]’s relevant
settings object’s [=environment settings object/api base URL=].
-
Let
- |validationURL:URL| be the result of [=URL parser|URL parsing=]
- |eventInitDict|["validationURL"] and |base|.
+
Let |validationURL:URL| be the result of [=URL parser|URL
+ parsing=]
+ |eventInitDict:MerchantValidationEventInit|.{{MerchantValidationEventInit/validationURL}}
+ and |base|.
If |validationURL| is failure, throw a {{TypeError}}.
-
Initialize |event|.validationURL attribute to
- |validationURL|.
+
Initialize |event|.{{MerchantValidationEvent/validationURL}}
+ attribute to |validationURL|.
If |eventInitDict|.{{MerchantValidationEventInit/methodName}}
+ is not the empty string, run the steps to validate a payment
+ method identifier with
+ |eventInitDict|.{{MerchantValidationEventInit/methodName}}. If it
returns false, then throw a {{RangeError}} exception. Optionally,
inform the developer that the payment method identifier is invalid.
Initialize |event|.{{MerchantValidationEvent/methodName}}
+ attribute to
+ |eventInitDict|.{{MerchantValidationEventInit/methodName}}.
-
Initialize |event|.{{[[waitForUpdate]]}} to false.
+
Initialize
+ |event|.{{MerchantValidationEvent/[[waitForUpdate]]}} to false.
@@ -3765,9 +3787,9 @@
A URL from which a developer can fetch payment
handler-specific verification data. By then passing that data
- (or a promise that resolves with that data) to complete(),
- the user agent can verify that the payment request is from an
- authorized merchant.
+ (or a promise that resolves with that data) to
+ {{PaymentResponse/complete()}}, the user agent can verify that the
+ payment request is from an authorized merchant.
When getting, returns the value it was initialized with.
@@ -3783,14 +3805,14 @@
- A boolean indicating whether a complete()-initiated
- update is currently in progress.
+ A boolean indicating whether a
+ {{PaymentResponse/complete()}}-initiated update is currently in
+ progress.
-
+
MerchantValidationEventInit dictionary
@@ -3869,8 +3892,7 @@
-
+
PaymentMethodChangeEvent interface
@@ -3886,24 +3908,23 @@
methodDetails attribute
-
+
When getting, returns the value it was initialized with. See
- methodDetails member of PaymentMethodChangeEventInit
- for more information.
+ {{PaymentMethodChangeEventInit/methodDetails}} member of
+ {{PaymentMethodChangeEventInit}} for more information.
methodName attribute
-
+
When getting, returns the value it was initialized with. See
- methodName member of PaymentMethodChangeEventInit for
- more information.
+ {{PaymentMethodChangeEventInit/methodName}} member of
+ {{PaymentMethodChangeEventInit}} for more information.
-
+
PaymentMethodChangeEventInit dictionary
@@ -3930,8 +3951,7 @@
-
+
PaymentRequestUpdateEvent interface
@@ -3962,7 +3982,8 @@
the [=Event/constructor=] of {{PaymentRequestUpdateEvent}} with
|type| and |eventInitDict|.
-
Set |event|.{{[[waitForUpdate]]}} to false.
+
Set |event|.{{PaymentRequestUpdateEvent/[[waitForUpdate]]}} to
+ false.
Return |event|.
@@ -3970,20 +3991,20 @@
- updateWith() method
+ updateWith() method
- The updateWith(|detailsPromise|) method MUST
- act as follows:
+ The {{PaymentRequestUpdateEvent/updateWith()}} with
+ |detailsPromise:Promise| method MUST act as follows:
-
Let |event:PaymentRequestUpdateEvent| be this
- {{PaymentRequestUpdateEvent}} instance.
+
Let |event:PaymentRequestUpdateEvent| be [=this=].
-
If |event|'s {{ Event.isTrusted }} attribute is false, then
+
If |event|'s {{Event/isTrusted}} attribute is false, then
[=exception/throw=] an {{"InvalidStateError"}} {{DOMException}}.
-
If |event|.[[\waitForUpdate]] is true, then
- [=exception/throw=] an {{"InvalidStateError"}} {{DOMException}}.
+
If |event|.{{PaymentRequestUpdateEvent/[[waitForUpdate]]}} is
+ true, then [=exception/throw=] an {{"InvalidStateError"}}
+ {{DOMException}}.
If |event|'s [=Event/target=] is an instance of
- PaymentResponse, let |request:PaymentRequest| be |event|'s
- [=Event/target=].[[\request]].
+ {{PaymentResponse}}, let |request:PaymentRequest| be |event|'s
+ [=Event/target=]'s {{PaymentResponse/[[request]]}}.
Otherwise, let |request:PaymentRequest| be the value of
|event|'s [=Event/target=].
@@ -4061,13 +4082,13 @@
Set |event|'s [=Event/stop propagation flag=] and [=Event/stop
immediate propagation flag=].
- A boolean indicating whether an updateWith()-initiated
- update is currently in progress.
+ A boolean indicating whether an
+ {{PaymentRequestUpdateEvent/updateWith()}}-initiated update is
+ currently in progress.
Set
+ |eventInitDict|.{{MerchantValidationEventInit/validationURL}}] to
|validationURL|.
-
Set |eventInitDict|["methodName"] to |methodName|.
+
Set
+ |eventInitDict|.{{MerchantValidationEventInit/methodName}} to
+ |methodName|.
Let |event:MerchantValidationEvent| be the result of calling
the [=Event/constructor=] of {{MerchantValidationEvent}} with
"merchantvalidation" and |eventInitDict|.
-
Initialize |event|’s {{ Event.isTrusted }} attribute to true.
+
Initialize |event|’s {{Event/isTrusted}} attribute to true.
Dispatch |event| to |request|.
@@ -4211,7 +4237,7 @@
This allows user agents to apply heuristics to detect and prevent
abuse of the calling method for fingerprinting purposes, such as
creating {{PaymentRequest}} objects with a variety of supported
@@ -4228,7 +4254,7 @@
parallel
.
For each |paymentMethod| tuple in |request|.
- [=PaymentRequest/[[serializedMethodData]]=]:
+ {{PaymentRequest/[[serializedMethodData]]}}:
Let |identifier| be the first element in the |paymentMethod|
tuple.
@@ -4317,8 +4343,8 @@
Set the {{PaymentRequest/shippingOption}} attribute on
|request| to the id string of the
- PaymentShippingOption provided by the user.
+ {{PaymentShippingOption}} provided by the user.
A payment handler MAY run the payment method changed algorithm
when the user changes payment method with |methodDetails|,
@@ -4391,12 +4417,13 @@
Assert: |request|.{{PaymentRequest/[[state]]}} is
"[=state/interactive=]".
-
+
Fire an event named "paymentmethodchange" at
|request| using {{PaymentMethodChangeEvent}}, with its
- methodName attribute initialized to |methodName|, and
- its methodDetails attribute initialized to
- |methodDetails|.
+ {{PaymentMethodChangeEvent/methodName}} attribute initialized
+ to |methodName|, and its
+ {{PaymentMethodChangeEvent/methodDetails}} attribute
+ initialized to |methodDetails|.
If
- |event|.[[\waitForUpdate]] is true, disable any part of the
- user interface that could cause another update event to be fired.
+
If |event|.{{PaymentRequestUpdateEvent/[[waitForUpdate]]}} is
+ true, disable any part of the user interface that could cause another
+ update event to be fired.
If
- |event|.[[\waitForUpdate]] is true, disable any part of
- the user interface that could cause another change to the payer
- details to be fired.
+
If |event|.{{PaymentRequestUpdateEvent/[[waitForUpdate]]}} is
+ true, disable any part of the user interface that could cause
+ another change to the payer details to be fired.
Otherwise, set
+ |event|.{{PaymentRequestUpdateEvent/[[waitForUpdate]]}} to true.
@@ -4535,7 +4563,7 @@
that this never occurs.
If the {{PaymentOptions/requestShipping}} value of
- |request|.[=PaymentRequest/[[options]]=] is true, then if the
+ |request|.{{PaymentRequest/[[options]]}} is true, then if the
{{PaymentRequest/shippingAddress}} attribute of |request| is null or
if the {{PaymentRequest/shippingOption}} attribute of |request| is
null, then terminate this algorithm and take no further action. The
@@ -4547,26 +4575,26 @@
Let |response:PaymentResponse| be
|request|.{{PaymentRequest/[[response]]}} if |isRetry| is true, or a
- new PaymentResponse otherwise.
+ new {{PaymentResponse}} otherwise.
If |isRetry| if false, initialize the newly created |response|:
-
Set |response|.{{PaymentResponse/[[complete]]}} to false.
Set the {{PaymentResponse/requestId}} attribute value of
|response| to the value of
- |request|.[=PaymentRequest/[[details]]=].{{PaymentDetailsInit/id}}.
+ |request|.{{PaymentRequest/[[details]]}}.{{PaymentDetailsInit/id}}.
Set |request|.{{PaymentRequest/[[response]]}} to |response|.
Let |handler:payment handler| be
- |request|.[=PaymentRequest/[[handler]]=].
+ |request|.{{PaymentRequest/[[handler]]}}.
Set the {{PaymentResponse/methodName}} attribute value of
|response| to the payment method identifier of |handler|.
@@ -4576,44 +4604,44 @@
respond to a payment request.
If the {{PaymentOptions/requestShipping}} value of
- |request|.[=PaymentRequest/[[options]]=] is false, then set the
+ |request|.{{PaymentRequest/[[options]]}} is false, then set the
{{PaymentResponse/shippingAddress}} attribute value of |response| to
null. Otherwise:
-
+
Set the {{shippingAddress}} attribute value of |response| to
- |shippingAddress|.
+
Set the {{PaymentResponse/shippingAddress}} attribute value
+ of |response| to |shippingAddress|.
-
Set the {{shippingAddress}} attribute value of |request| to
- |shippingAddress|.
+
Set the {{PaymentResponse/shippingAddress}} attribute value
+ of |request| to |shippingAddress|.
If the {{PaymentOptions/requestShipping}} value of
- |request|.[=PaymentRequest/[[options]]=] is true, then set the
+ |request|.{{PaymentRequest/[[options]]}} is true, then set the
{{PaymentResponse/shippingOption}} attribute of |response| to the
value of the {{PaymentResponse/shippingOption}} attribute of
|request|. Otherwise, set it to null.
If the {{PaymentOptions/requestPayerName}} value of
- |request|.[=PaymentRequest/[[options]]=] is true, then set the
+ |request|.{{PaymentRequest/[[options]]}} is true, then set the
{{PaymentResponse/payerName}} attribute of |response| to the payer's
name provided by the user, or to null if none was provided.
Otherwise, set it to null.
If the {{PaymentOptions/requestPayerEmail}} value of
- |request|.[=PaymentRequest/[[options]]=] is true, then set the
+ |request|.{{PaymentRequest/[[options]]}} is true, then set the
{{PaymentResponse/payerEmail}} attribute of |response| to the payer's
email address provided by the user, or to null if none was provided.
Otherwise, set it to null.
If the {{PaymentOptions/requestPayerPhone}} value of
- |request|.[=PaymentRequest/[[options]]=] is true, then set the
+ |request|.{{PaymentRequest/[[options]]}} is true, then set the
{{PaymentResponse/payerPhone}} attribute of |response| to the payer's
phone number provided by the user, or to null if none was provided.
When setting the {{PaymentResponse/payerPhone}} value, the user agent
@@ -4621,9 +4649,10 @@
Set |request|.{{PaymentRequest/[[state]]}} to "[=state/closed=]".
-
If |isRetry| is true, resolve |response|.[[\retryPromise]]
- with undefined. Otherwise, resolve
- |request|.{{PaymentRequest/[[acceptPromise]]}} with |response|.
+
If |isRetry| is true, resolve
+ |response|.{{PaymentResponse/[[retryPromise]]}} with undefined.
+ Otherwise, resolve |request|.{{PaymentRequest/[[acceptPromise]]}}
+ with |response|.
Reject |response|.{{PaymentResponse/[[retryPromise]]}} with
+ |error|.
@@ -4681,14 +4712,14 @@
The update a PaymentRequest's details
- algorithm takes a PaymentDetailsUpdate |detailsPromise|,
- a {{PaymentRequest}} |request|, and |pmi| that is either a DOMString
- or null (a payment method identifier). The steps are
- conditional on the |detailsPromise| settling. If |detailsPromise|
- never settles then the payment request is blocked. The user agent
- SHOULD provide the user with a means to abort a payment request.
- Implementations MAY choose to implement a timeout for pending updates
- if |detailsPromise| doesn't settle in a reasonable amount of time.
+ algorithm takes a {{PaymentDetailsUpdate}} |detailsPromise|, a
+ {{PaymentRequest}} |request|, and |pmi| that is either a DOMString or
+ null (a payment method identifier). The steps are conditional
+ on the |detailsPromise| settling. If |detailsPromise| never settles
+ then the payment request is blocked. The user agent SHOULD provide
+ the user with a means to abort a payment request. Implementations MAY
+ choose to implement a timeout for pending updates if |detailsPromise|
+ doesn't settle in a reasonable amount of time.
In the case where a timeout occurs, or the user manually aborts, or
@@ -4717,28 +4748,29 @@
Let |details| be the result of [=converted to an IDL
- value|converting=] |value| to a PaymentDetailsUpdate
- dictionary. If this [=exception/throw=] an exception, abort
- the update with |request| and with the thrown exception.
+
Let |details:PaymentDetailsUpdate| be the result of
+ [=converted to an IDL value|converting=] |value| to a
+ {{PaymentDetailsUpdate}} dictionary. If this [=exception/throw=]
+ an exception, abort the update with |request| and with the
+ thrown exception.
If the total
- member of |details| is present, then:
+
If the {{PaymentDetailsUpdate/total}} member of |details|
+ is present, then:
Check and canonicalize total amount
- |details|.total.{{PaymentItem/amount}}. If an
- exception is thrown, then abort the update with
- |request| and that exception.
+ |details|.{{PaymentDetailsUpdate/total}}.{{PaymentItem/amount}}.
+ If an exception is thrown, then abort the update
+ with |request| and that exception.
@@ -4756,7 +4788,7 @@
If the shippingOptions member of |details| is
present, and
- |request|.[=PaymentRequest/[[options]]=].{{PaymentOptions/requestShipping}}
+ |request|.{{PaymentRequest/[[options]]}}.{{PaymentOptions/requestShipping}}
is true, then:
Let |seenIDs| be an empty set.
@@ -4799,7 +4831,7 @@
If the total member of |modifier| is
- present, then:
+
If the {{PaymentDetailsModifier/total}} member of
+ |modifier| is present, then:
Check and canonicalize total amount
- |modifier|.total.{{PaymentItem/amount}}.
+ |modifier|.{{PaymentDetailsModifier/total}}.{{PaymentItem/amount}}.
If an exception is thrown, then abort the
update with |request| and that exception.
If the
+ {{PaymentDetailsModifier/additionalDisplayItems}}
+ member of |modifier| is present, then for each
+ {{PaymentItem}} |item| in
+ |modifier|.{{PaymentDetailsModifier/additionalDisplayItems}}:
If the shippingOptions member of |details| is
present, and
- |request|.[=PaymentRequest/[[options]]=].{{PaymentOptions/requestShipping}}
+ |request|.{{PaymentRequest/[[options]]}}.{{PaymentOptions/requestShipping}}
is true, then:
Set
- |request|.[=PaymentRequest/[[details]]=].shippingOptions
+ |request|.{{PaymentRequest/[[details]]}}.shippingOptions
to |shippingOptions|.
Set the value of |request|'s
@@ -4909,11 +4942,11 @@
then:
Set
- |request|.[=PaymentRequest/[[details]]=].modifiers
+ |request|.{{PaymentRequest/[[details]]}}.modifiers
to |details|.modifiers.
Set
- |request|.[=PaymentRequest/[[serializedModifierData]]=]
+ |request|.{{PaymentRequest/[[serializedModifierData]]}}
to |serializedModifierData|.
@@ -4921,9 +4954,9 @@
If
- |request|.[=PaymentRequest/[[options]]=].{{PaymentOptions/requestShipping}}
+ |request|.{{PaymentRequest/[[options]]}}.{{PaymentOptions/requestShipping}}
is true, and
- |request|.[=PaymentRequest/[[details]]=].shippingOptions
+ |request|.{{PaymentRequest/[[details]]}}.shippingOptions
is empty, then the developer has signified that there are
no valid shipping options for the currently-chosen
shipping address (given by |request|'s
@@ -4944,19 +4977,20 @@
member is present, the user agent SHOULD display an error
specifically for each erroneous field of the shipping
address. This is done by matching each present member of
- the AddressErrors to a corresponding input field
- in the shown user interface.
+ the {{AddressErrors}} to a corresponding input field in
+ the shown user interface.
-
- Similarly, if |details|["payerErrors"] member is
- present and |request|.[=PaymentRequest/[[options]]=]'s
+
+ Similarly, if |details|["{{payerErrors}}"] member is
+ present and |request|.{{PaymentRequest/[[options]]}}'s
{{PaymentOptions/requestPayerName}},
{{PaymentOptions/requestPayerEmail}}, or
{{PaymentOptions/requestPayerPhone}} is true, then
display an error specifically for each erroneous field.
+ Likewise, if
+ |details|.{{PaymentDetailsUpdate/paymentMethodErrors}} is
present, then display errors specifically for each
erroneous input field for the particular payment method.
Reject |response|.{{PaymentResponse/[[retryPromise]]}}
+ with |exception|.
@@ -5041,9 +5076,9 @@
Similarly, abort the update occurring during retry()
- causes the [[\retryPromise]] to reject, and the
- corresponding {{PaymentRequest}}'s [[\complete]] internal
- slot will be set to true (i.e., it can no longer be used).
+ causes the {{PaymentResponse/[[retryPromise]]}} to reject, and the
+ corresponding {{PaymentRequest}}'s {{PaymentRequest/[[complete]]}}
+ internal slot will be set to true (i.e., it can no longer be used).
@@ -5115,26 +5150,25 @@
To help ensure that users do not inadvertently share sensitive
credentials with an origin, this API requires that PaymentRequest's
- show() method be invoked while the relevant {{Window}} has
- [=transient activation=] (e.g., via a click or press).
+ {{PaymentRequest/show()}} method be invoked while the relevant
+ {{Window}} has [=transient activation=] (e.g., via a click or press).
To avoid a confusing user experience, this specification limits the
- user agent to displaying one at a time via the show() method.
- In addition, the user agent can limit the rate at which a page can
- call show().
+ user agent to displaying one at a time via the
+ {{PaymentRequest/show()}} method. In addition, the user agent can
+ limit the rate at which a page can call {{PaymentRequest/show()}}.
-
+
Secure contexts
- The API defined in this specification is only exposed in
- secure contexts. In practice, this
- means that this API is only available over HTTPS. This is to limit
- the possibility of payment method data (e.g., credit card numbers)
- being sent in the clear.
+ The API defined in this specification is only exposed in secure
+ contexts. In practice, this means that this API is only available
+ over HTTPS. This is to limit the possibility of payment method data
+ (e.g., credit card numbers) being sent in the clear.
@@ -5145,8 +5179,7 @@
It is common for merchants and other payees to delegate checkout and
other e-commerce activities to payment service providers through an
iframe. This API supports payee-authorized cross-origin
- iframes through [[HTML]]'s {{ HTMLIFrameElement.allowPaymentRequest
- }} attribute.
+ iframes through [[HTML]]'s [^iframe/allowpaymentrequest^] attribute.
Payment handlers have access to both the origin that hosts the
@@ -5170,19 +5203,20 @@
How user agents match payment handlers
- As part of show(), the user agent typically displays a list of
- matching payment handlers that satisfy the payment
- methods accepted by the merchant and other conditions. Matching
- can take into account payment method information provided as
- input to the API, information provided by the payment method
- owner, the payment handlers registered by the user, user
- preferences, and other considerations.
+ As part of {{PaymentRequest/show()}}, the user agent typically
+ displays a list of matching payment handlers that satisfy the
+ payment methods accepted by the merchant and other conditions.
+ Matching can take into account payment method information
+ provided as input to the API, information provided by the payment
+ method owner, the payment handlers registered by the user,
+ user preferences, and other considerations.
information as possible prior to completion of the payment.
Therefore, when a payment method defines the steps for when
a user changes payment method, it is important to minimize the
- data shared via the {{PaymentMethodChangeEvent}}'s methodDetails attribute. Requirements
+ data shared via the {{PaymentMethodChangeEvent}}'s
+ {{PaymentMethodChangeEvent/methodDetails}} attribute. Requirements
and approaches for minimizing shared data are likely to vary by
payment method and might include:
@@ -5235,13 +5269,12 @@
Support for instructions from the payee identifying specific
elements to exclude or include from the payment method
- response data (returned through PaymentResponse.|details|).
- The payee might provide these instructions via
+ response data (returned through {{PaymentResponse}}.|details|). The
+ payee might provide these instructions via
PaymentMethodData.|data|, enabling a payment method
definition to evolve without requiring changes to the current API.
@@ -5258,9 +5291,9 @@
Merchant Validation
-
- It is important that the validationURL in a
- {{MerchantValidationEvent}} does not expose personally identifying
+
+ It is important that the {{MerchantValidationEvent/validationURL}} in
+ a {{MerchantValidationEvent}} does not expose personally identifying
information to unauthorized parties.
@@ -5268,18 +5301,19 @@
canMakePayment() protections
-
- The canMakePayment() and hasEnrolledInstrument()
- methods have the potential to expose user information that could be
- abused for fingerprinting purposes. User agents are expected to
- protect the user from abuse of the method. For example, user agents
- can reduce user fingerprinting by:
+
+ The {{PaymentRequest/canMakePayment()}} and
+ {{PaymentRequest/hasEnrolledInstrument()}} methods have the potential
+ to expose user information that could be abused for fingerprinting
+ purposes. User agents are expected to protect the user from abuse of
+ the method. For example, user agents can reduce user fingerprinting
+ by:
-
+
Allowing the user to configure the user agent to turn off
- canMakePayment() and hasEnrolledInstrument(), which
- would return a promise rejected with a {{"NotAllowedError"}}
- {{DOMException}}.
+ {{PaymentRequest/canMakePayment()}} and
+ {{PaymentRequest/hasEnrolledInstrument()}}, which would return a
+ promise rejected with a {{"NotAllowedError"}} {{DOMException}}.
Rate-limiting the frequency of calls with different parameters.
"modifiers" to how payments are made. For example, "if you pay with a
card belonging to network X, it incurs a US$3.00 processing fee".
-
The |options|: Optionally, a list of things as
- PaymentOptions that the site needs to deliver the good or
- service (e.g., for physical goods, the merchant will typically need a
- physical address to ship to. For digital goods, an email will usually
- suffice).
+
The |options|: Optionally, a list of things as {{PaymentOptions}}
+ that the site needs to deliver the good or service (e.g., for physical
+ goods, the merchant will typically need a physical address to ship to.
+ For digital goods, an email will usually suffice).
"PaymentRequest.PaymentRequest()">PaymentRequest(|methodData|,
|details|, |options|) constructor MUST act as follows:
-
+
If the current settings object's [=environment settings
object / responsible document=] is not allowed to use the
"[=payment-permission|payment=]" permission, then [=exception/throw=]
@@ -698,7 +697,7 @@
Let |serializedMethodData| be an empty list.
Process payment methods:
-
+
If the length of the |methodData| sequence is zero, then
[=exception/throw=] a {{TypeError}}, optionally informing the
developer that at least one payment method is required.
@@ -739,7 +738,7 @@
If |serializedData| is not null, and if required by the
specification that defines the
- |paymentMethod|.supportedMethods:
+ |paymentMethod|.{{PaymentMethodData/supportedMethods}}:
Let |object| be the result of JSON-parsing
@@ -750,8 +749,8 @@
[=converted to an IDL value|Convert=] |object| to an
IDL value of the type specified by the specification
that defines the
- |paymentMethod|.supportedMethods (e.g.,
- {{BasicCardRequest}} in the case of
+ |paymentMethod|.{{PaymentMethodData/supportedMethods}}
+ (e.g., {{BasicCardRequest}} in the case of
[[[?payment-method-basic-card]]]). Rethrow any
exceptions.
@@ -780,8 +779,9 @@
-
If the displayItems member of |details| is present, then
- for each |item| in |details|.displayItems:
+
If the {{PaymentDetailsBase/displayItems}} member of |details| is
+ present, then for each |item| in
+ |details|.{{PaymentDetailsBase/displayItems}}:
@@ -798,8 +798,8 @@
Let |options:PaymentShippingOption| be an empty
sequence<{{PaymentShippingOption}}>.
-
If the shippingOptions member of |details| is present,
- then:
+
If the {{PaymentDetailsBase/shippingOptions}} member of
+ |details| is present, then:
Set |modifiers| to
+ |details|.{{PaymentDetailsBase/modifiers}}.
For each |modifier| of |modifiers|:
@@ -1403,7 +1404,7 @@
A {{PaymentRequest}}'s {{PaymentRequest/shippingType}} attribute is
the type of shipping used to fulfill the transaction. Its value is
- either a PaymentShippingType enum value, or null if none is
+ either a {{PaymentShippingType}} enum value, or null if none is
provided by the developer during
[=PaymentRequest.PaymentRequest()|construction=] (see
{{PaymentOptions}}'s {{PaymentOptions/shippingType}} member).
@@ -1526,7 +1527,7 @@
"PaymentRequest">[[\options]]
- The PaymentOptions supplied to the constructor.
+ The {{PaymentOptions}} supplied to the constructor.
@@ -1566,7 +1567,7 @@
-
+
The constructor sets the initial state to
"[=state/created=]". The {{PaymentRequest/show()}} method
changes the state to "[=state/interactive=]". From
@@ -1873,10 +1874,9 @@
modifiers member
- A sequence of PaymentDetailsModifier dictionaries that
- contains modifiers for particular payment method identifiers. For
- example, it allows you to adjust the total amount based on payment
- method.
+ A sequence of {{PaymentDetailsModifier}} dictionaries that contains
+ modifiers for particular payment method identifiers. For example,
+ it allows you to adjust the total amount based on payment method.
@@ -2002,8 +2002,7 @@
-
+
PaymentDetailsModifier dictionary
@@ -2016,9 +2015,9 @@
};
- The PaymentDetailsModifier dictionary provides details that
- modify the {{PaymentDetailsBase}} based on a payment method
- identifier. It contains the following members:
+ The {{PaymentDetailsModifier}} dictionary provides details that modify
+ the {{PaymentDetailsBase}} based on a payment method identifier.
+ It contains the following members:
additionalDisplayItems member
@@ -2046,15 +2045,16 @@
display items that are appended to the
{{PaymentDetailsBase/displayItems}} member in the
{{PaymentDetailsBase}} dictionary for the payment method
- identifiers in the supportedMethods member. This member is
- commonly used to add a discount or surcharge line item indicating the
- reason for the different total amount for the selected
- payment method that the user agent MAY display.
+ identifiers in the {{PaymentDetailsModifier/supportedMethods}}
+ member. This member is commonly used to add a discount or surcharge
+ line item indicating the reason for the different
+ {{PaymentDetailsModifier/total}} amount for the selected payment
+ method that the user agent MAY display.
It is the developer's responsibility to verify that the
- total amount is the sum of the
+ {{PaymentDetailsModifier/total}} amount is the sum of the
{{PaymentDetailsBase/displayItems}} and the
- additionalDisplayItems.
+ {{PaymentDetailsModifier/additionalDisplayItems}}.
@@ -2103,7 +2103,7 @@
-
+
PaymentOptions dictionary
@@ -2118,24 +2118,24 @@
};
- The PaymentOptions dictionary is passed to the
- {{PaymentRequest}} constructor and provides information about the
- options desired for the payment request.
+ The {{PaymentOptions}} dictionary is passed to the {{PaymentRequest}}
+ constructor and provides information about the options desired for the
+ payment request.
requestBillingAddress member
-
+
A boolean that indicates whether the user agent SHOULD collect
and return the billing address associated with a payment
method (e.g., the billing address associated with a credit card).
Typically, the user agent will return the billing address as part of
- the {{PaymentMethodChangeEvent}}'s methodDetails. A merchant
- can use this information to, for example, calculate tax in certain
- jurisdictions and update the displayed total. See below for privacy
- considerations regarding exposing user
- information.
+ the {{PaymentMethodChangeEvent}}'s
+ {{PaymentMethodChangeEvent/methodDetails}}. A merchant can use this
+ information to, for example, calculate tax in certain jurisdictions
+ and update the displayed total. See below for privacy considerations
+ regarding exposing user information.
requestPayerName member
@@ -2178,21 +2178,21 @@
shippingType member
- A PaymentShippingType enum value. Some transactions require an
+ A {{PaymentShippingType}} enum value. Some transactions require an
address for delivery but the term "shipping" isn't appropriate. For
example, "pizza delivery" not "pizza shipping" and "laundry pickup"
- not "laundry shipping". If requestShipping is set to true,
- then the shippingType member can influence the way the user
- agent presents the user interface for gathering the shipping
- address.
+ not "laundry shipping". If {{PaymentOptions/requestShipping}} is set
+ to true, then the {{PaymentOptions/shippingType}} member can
+ influence the way the user agent presents the user interface
+ for gathering the shipping address.
- The shippingType member only affects the user interface for
- the payment request.
+ The {{PaymentOptions/shippingType}} member only affects the user
+ interface for the payment request.
-
+
PaymentItem dictionary
@@ -2227,11 +2227,11 @@
pending member
- A boolean. When set to true it means that the amount member is
- not final. This is commonly used to show items such as shipping or
- tax amounts that depend upon selection of shipping address or
- shipping option. User agents MAY indicate pending fields in
- the user interface for the payment request.
+ A boolean. When set to true it means that the {{PaymentItem/amount}}
+ member is not final. This is commonly used to show items such as
+ shipping or tax amounts that depend upon selection of shipping
+ address or shipping option. User agents MAY indicate pending
+ fields in the user interface for the payment request.
@@ -2308,7 +2308,7 @@
The phone number of the recipient or contact person at the address.
-
+
PaymentAddress interface
@@ -2356,7 +2356,7 @@
`PaymentAddress` with an optional {{AddressInit}}
|details:AddressInit| are given by the following algorithm:
-
+
Let |address:PaymentAddress| be a new instance of
{{PaymentAddress}}.
@@ -2640,7 +2640,7 @@
-
+
AddressInit dictionary
@@ -2729,7 +2729,7 @@
-
+
AddressErrors dictionary
@@ -2947,7 +2947,7 @@
If "region" is not in |redactList|:
-
In some countries (e.g., Belgium) it is uncommon for users to
include a region as part of a physical address
@@ -3296,15 +3296,15 @@
Payer details are any of the payer's name, payer's phone
number, and payer's email.
-
+
email member
Denotes that the payer's email suffers from a validation error.
In the user agent's UI, this member corresponds to the input
- field that provided the {{PaymentResponse}}'s payerEmail
- attribute's value.
+ field that provided the {{PaymentResponse}}'s
+ {{PaymentResponse/payerEmail}} attribute's value.
name member
@@ -3312,8 +3312,8 @@
Denotes that the payer's name suffers from a validation error. In
the user agent's UI, this member corresponds to the input field
- that provided the {{PaymentResponse}}'s payerName
- attribute's value.
+ that provided the {{PaymentResponse}}'s
+ {{PaymentResponse/payerName}} attribute's value.
phone member
@@ -3322,7 +3322,7 @@
Denotes that the payer's phone number suffers from a validation
error. In the user agent's UI, this member corresponds to the
input field that provided the {{PaymentResponse}}'s
- payerPhone attribute's value.
+ {{PaymentResponse/payerPhone}} attribute's value.
@@ -3379,9 +3379,9 @@
If the {{PaymentOptions/requestShipping}} member was set to true in
- the PaymentOptions passed to the {{PaymentRequest}}
- constructor, then {{PaymentRequest/shippingAddress}} will be the full
- and final shipping address chosen by the user.
+ the {{PaymentOptions}} passed to the {{PaymentRequest}} constructor,
+ then {{PaymentRequest/shippingAddress}} will be the full and final
+ shipping address chosen by the user.
@@ -3391,8 +3391,8 @@
If the {{PaymentOptions/requestShipping}} member was set to true in
- the PaymentOptions passed to the {{PaymentRequest}}
- constructor, then {{PaymentRequest/shippingOption}} will be the
+ the {{PaymentOptions}} passed to the {{PaymentRequest}} constructor,
+ then {{PaymentRequest/shippingOption}} will be the
{{PaymentShippingOption/id}} attribute of the selected shipping
option.
@@ -3403,9 +3403,9 @@
If the {{PaymentOptions/requestPayerName}} member was set to true in
- the PaymentOptions passed to the {{PaymentRequest}}
- constructor, then {{PaymentResponse/payerName}} will be the name
- provided by the user.
+ the {{PaymentOptions}} passed to the {{PaymentRequest}} constructor,
+ then {{PaymentResponse/payerName}} will be the name provided by the
+ user.
@@ -3415,9 +3415,9 @@
If the {{PaymentOptions/requestPayerEmail}} member was set to true in
- the PaymentOptions passed to the {{PaymentRequest}}
- constructor, then {{PaymentResponse/payerEmail}} will be the email
- address chosen by the user.
+ the {{PaymentOptions}} passed to the {{PaymentRequest}} constructor,
+ then {{PaymentResponse/payerEmail}} will be the email address chosen
+ by the user.
@@ -3427,9 +3427,9 @@
If the {{PaymentOptions/requestPayerPhone}} member was set to true in
- the PaymentOptions passed to the {{PaymentRequest}}
- constructor, then {{PaymentResponse/payerPhone}} will be the phone
- number chosen by the user.
+ the {{PaymentOptions}} passed to the {{PaymentRequest}} constructor,
+ then {{PaymentResponse/payerPhone}} will be the phone number chosen
+ by the user.
Let |details:PaymentDetailsUpdate| be the result of
[=converted to an IDL value|converting=] |value| to a
{{PaymentDetailsUpdate}} dictionary. If this [=exception/throw=]
@@ -4774,9 +4774,9 @@
-
If the displayItems member of |details| is
- present, then for each |item| in
- |details|.displayItems:
+
If the {{PaymentDetailsBase/displayItems}} member of
+ |details| is present, then for each |item| in
+ |details|.{{PaymentDetailsBase/displayItems}}:
If the shippingOptions member of |details| is
- present, and
+
If the {{PaymentDetailsBase/shippingOptions}} member of
+ |details| is present, and
|request|.{{PaymentRequest/[[options]]}}.{{PaymentOptions/requestShipping}}
is true, then:
Let |seenIDs| be an empty set.
For each |option| in
- |details|.shippingOptions:
+ |details|.{{PaymentDetailsBase/shippingOptions}}:
For each {{PaymentDetailsModifier}} |modifier| in
|modifiers|:
-
If the
- paymentMethodErrors member is present and |identifier| is
- not null:
+
If the {{PaymentDetailsUpdate/paymentMethodErrors}} member is
+ present and |identifier| is not null:
If required by the specification that defines the |pmi|,
then [=converted to an IDL value|convert=]
- paymentMethodErrors to an IDL value.
+ {{PaymentDetailsUpdate/paymentMethodErrors}} to an IDL value.
The payment handler SHOULD display an error for
- each relevant erroneous field of paymentMethodErrors.
+ each relevant erroneous field of
+ {{PaymentDetailsUpdate/paymentMethodErrors}}.
Update the {{PaymentRequest}} using the new details:
-
If the total
- member of |details| is present, then:
+
If the {{PaymentDetailsUpdate/total}} member of |details|
+ is present, then:
Set
- |request|.{{PaymentRequest/[[details]]}}.total
- to |details|.total.
+ |request|.{{PaymentRequest/[[details]]}}.{{PaymentDetailsInit/total}}
+ to |details|.{{PaymentDetailsUpdate/total}}.
-
If the displayItems member of |details| is
- present, then:
+
If the {{PaymentDetailsBase/displayItems}} member of
+ |details| is present, then:
Set
- |request|.{{PaymentRequest/[[details]]}}.displayItems
- to |details|.displayItems.
+ |request|.{{PaymentRequest/[[details]]}}.{{PaymentDetailsBase/displayItems}}
+ to |details|.{{PaymentDetailsBase/displayItems}}.
-
If the shippingOptions member of |details| is
- present, and
+
If the {{PaymentDetailsBase/shippingOptions}} member of
+ |details| is present, and
|request|.{{PaymentRequest/[[options]]}}.{{PaymentOptions/requestShipping}}
is true, then:
Set
- |request|.{{PaymentRequest/[[details]]}}.shippingOptions
+ |request|.{{PaymentRequest/[[details]]}}.{{PaymentDetailsBase/shippingOptions}}
to |shippingOptions|.
Set the value of |request|'s
@@ -4938,12 +4938,12 @@
-
If the modifiers member of |details| is present,
- then:
+
If the {{PaymentDetailsBase/modifiers}} member of
+ |details| is present, then:
Set
- |request|.{{PaymentRequest/[[details]]}}.modifiers
- to |details|.modifiers.
+ |request|.{{PaymentRequest/[[details]]}}.{{PaymentDetailsBase/modifiers}}
+ to |details|.{{PaymentDetailsBase/modifiers}}.
Set
|request|.{{PaymentRequest/[[serializedModifierData]]}}
@@ -4956,7 +4956,7 @@
If
|request|.{{PaymentRequest/[[options]]}}.{{PaymentOptions/requestShipping}}
is true, and
- |request|.{{PaymentRequest/[[details]]}}.shippingOptions
+ |request|.{{PaymentRequest/[[details]]}}.{{PaymentDetailsBase/shippingOptions}}
is empty, then the developer has signified that there are
no valid shipping options for the currently-chosen
shipping address (given by |request|'s
@@ -5074,9 +5074,10 @@
of the [[\acceptPromise]], i.e., the promise returned by
{{PaymentRequest/show()}}.
-
- Similarly, abort the update occurring during retry()
- causes the {{PaymentResponse/[[retryPromise]]}} to reject, and the
+
+ Similarly, abort the update occurring during
+ {{PaymentResponse/retry()}} causes the
+ {{PaymentResponse/[[retryPromise]]}} to reject, and the
corresponding {{PaymentRequest}}'s {{PaymentRequest/[[complete]]}}
internal slot will be set to true (i.e., it can no longer be used).
@@ -5143,7 +5144,7 @@
Privacy and Security Considerations
-
+
User protections with show() method
@@ -5202,7 +5203,7 @@
How user agents match payment handlers
-
+
As part of {{PaymentRequest/show()}}, the user agent typically
displays a list of matching payment handlers that satisfy the
payment methods accepted by the merchant and other conditions.
@@ -5211,7 +5212,7 @@
method owner, the payment handlers registered by the user,
user preferences, and other considerations.
-
. Key set of changes are viewable in the Changelog.
Added support for notification when the user selects a payment
@@ -161,6 +162,8 @@
Defined handling of multiple applicable modifiers.
+
Deprecated `allowpaymentrequest` attribute.
+
@@ -594,6 +597,29 @@
doPaymentRequest();
+
+
+ Using with cross-origin iframes
+
+
+ To indicate that a cross-origin [^iframe^] is allowed to invoke the
+ payment request API, the [^iframe/allow^] attribute along with the
+ "payment" keyword can be specified on the [^iframe^] element.
+
+ If the [^iframe^] will be navigated across multiple origins that
+ support the Payment Request API, then one can set [^iframe/allow^] to
+ `"payment *"`. The [[[permissions-policy]]] specification provides
+ further details and examples.
+
+
@@ -3574,18 +3600,6 @@
-
-
- PaymentRequest and iframe elements
-
-
- To indicate that a cross-origin [^iframe^] is allowed to invoke the
- payment request API, the [^iframe/allowpaymentrequest^] attribute can
- be specified on the [^iframe^] element. See [[[#permissions-policy]]]
- for details of how [^iframe/allowoaymentrequest=] and
- [[[permissions-policy]]] interact.
-
It is common for merchants and other payees to delegate checkout and
other e-commerce activities to payment service providers through an
iframe. This API supports payee-authorized cross-origin
- iframes through [[HTML]]'s [^iframe/allowpaymentrequest^] attribute.
+ iframes through [[HTML]]'s [^iframe/allow^] attribute.
Payment handlers have access to both the origin that hosts the
From 345eb6f1e5729ca434b57e202c2ae67581947557 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20C=C3=A1ceres?=
Date: Wed, 23 Sep 2020 17:34:35 +1000
Subject: [PATCH 008/101] chore: remove custom styles
---
index.html | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/index.html b/index.html
index 1779785b..7a4c4376 100644
--- a/index.html
+++ b/index.html
@@ -75,14 +75,6 @@
mdn: true,
};
-
@@ -1497,7 +1489,7 @@
Instances of {{PaymentRequest}} are created with the internal slots
in the following table:
-
+
Internal Slot
@@ -2568,7 +2560,7 @@
Internal
slots
-
+
Internal slot
@@ -3558,7 +3550,7 @@
Instances of {{PaymentResponse}} are created with the internal slots
in the following table:
-
+
Internal Slot
@@ -3628,7 +3620,7 @@
Summary
-
+
Event name
@@ -3845,7 +3837,7 @@
Instances of {{MerchantValidationEvent}} are created with the
internal slots in the following table:
-
+
Internal Slot
@@ -4107,7 +4099,7 @@
Instances of {{PaymentRequestUpdateEvent}} are created with the
internal slots in the following table:
-
Added support for {{PaymentResponse/retry()}} and fine-grain
error reporting to the user.
-
Added support for merchant validation by the payment handler.
-
Clearer definition of {{PaymentRequest/canMakePayment()}} and
worked to align implementations. {{PaymentRequest/canMakePayment()}}
does not reveal whether payment handler is primed to pay.
@@ -154,6 +152,9 @@
Defined handling of multiple applicable modifiers.
+
Removed support for merchant validation because of lack of
+ multi-implementer support.
+
- A {{PaymentRequest}}'s {{PaymentRequest/onmerchantvalidation}}
- attribute is an {{EventHandler}} for a {{MerchantValidationEvent}}
- named "merchantvalidation".
-
- When getting, returns the value it was initialized with. See
- {{MerchantValidationEvent/methodName}} member of
- {{MerchantValidationEventInit}} for more information.
-
-
-
-
- MerchantValidationEvent
- constructor
-
-
- The event constructing steps, which take a
- {{MerchantValidationEvent}} |event:MerchantValidationEvent|, are as
- follows:
-
-
-
Let |base:URL| be the [=context object|event=]’s relevant
- settings object’s [=environment settings object/api base URL=].
-
-
Let |validationURL:URL| be the result of [=URL parser|URL
- parsing=]
- |eventInitDict:MerchantValidationEventInit|.{{MerchantValidationEventInit/validationURL}}
- and |base|.
-
-
If |validationURL| is failure, throw a {{TypeError}}.
-
-
Initialize |event|.{{MerchantValidationEvent/validationURL}}
- attribute to |validationURL|.
-
-
If |eventInitDict|.{{MerchantValidationEventInit/methodName}}
- is not the empty string, run the steps to validate a payment
- method identifier with
- |eventInitDict|.{{MerchantValidationEventInit/methodName}}. If it
- returns false, then throw a {{RangeError}} exception. Optionally,
- inform the developer that the payment method identifier is invalid.
-
-
Initialize |event|.{{MerchantValidationEvent/methodName}}
- attribute to
- |eventInitDict|.{{MerchantValidationEventInit/methodName}}.
-
-
Initialize
- |event|.{{MerchantValidationEvent/[[waitForUpdate]]}} to false.
-
-
-
-
-
- validationURL attribute
-
-
- A URL from which a developer can fetch payment
- handler-specific verification data. By then passing that data
- (or a promise that resolves with that data) to
- {{PaymentResponse/complete()}}, the user agent can verify that the
- payment request is from an authorized merchant.
-
-
- When getting, returns the value it was initialized with.
-
-
-
-
- complete() method
-
-
- The {{MerchantValidationEvent}}'s
- complete(|merchantSessionPromise|) method MUST act as
- follows:
-
-
-
Let |event:MerchantValidationEvent| be [=this=]
-
-
If |event|'s {{Event/isTrusted}} attribute is false, then
- [=exception/throw=] an {{"InvalidStateError"}} {{DOMException}}.
-
-
If |event|.{{MerchantValidationEvent/[[waitForUpdate]]}} is
- true, then [=exception/throw=] an {{"InvalidStateError"}}
- {{DOMException}}.
-
-
Let |request:PaymentRequest| be |event|'s [=Event/target=].
-
-
If |request|.{{PaymentRequest/[[state]]}} is not
- "[=state/interactive=]", then [=exception/throw=] an
- {{"InvalidStateError"}} {{DOMException}}.
-
-
If |request|.{{PaymentRequest/[[updating]]}} is true, then
- [=exception/throw=] an {{"InvalidStateError"}} {{DOMException}}.
-
-
Set |event|'s [=Event/stop propagation flag=] and [=Event/stop
- immediate propagation flag=].
-
-
Set |event|.{{MerchantValidationEvent/[[waitForUpdate]]}} to
- true.
-
is set to "[=state/interactive=]", the user agent will trigger
the following algorithms based on user interaction.
-
-
- Merchant validation
-
-
- Merchant validation is the
- process by which a payment handler validates the identity of a
- merchant against some |value| (usually some cryptographic challenge
- response). Validated merchants are allowed to interface with a
- payment handler. Details of how actual validation is performed
- is outside the scope of this specification.
-
- For payment methods that support merchant validation,
- the user agent runs the request merchant validation
- algorithm. The algorithm takes a {{USVString}}
- |merchantSpecificURL|, provided by the payment handler:
-
-
-
Let |request:PaymentRequest| be the {{PaymentRequest}} object
- that the user is interacting with.
-
Assert: |request|.{{PaymentRequest/[[updating]]}} is false.
-
-
Assert: |request|.{{PaymentRequest/[[state]]}} is
- "[=state/interactive=]".
-
-
Let |eventInitDict:MerchantValidationEventInit| be an new
- {{MerchantValidationEventInit}} dictionary.
-
-
Set
- |eventInitDict|.{{MerchantValidationEventInit/validationURL}}] to
- |validationURL|.
-
-
Set
- |eventInitDict|.{{MerchantValidationEventInit/methodName}} to
- |methodName|.
-
-
Let |event:MerchantValidationEvent| be the result of calling
- the [=Event/constructor=] of {{MerchantValidationEvent}} with
- "merchantvalidation" and |eventInitDict|.
-
-
Initialize |event|’s {{Event/isTrusted}} attribute to true.
-
- The validate merchant's details algorithm takes a
- {{Promise}} |opaqueDataPromise| and a {{PaymentRequest}} |request|.
- The steps are conditional on the |opaqueDataPromise| settling. If
- |opaqueDataPromise| never settles then the payment request is
- blocked. The user agent SHOULD provide the user with a means to abort
- a payment request. Implementations MAY choose to implement a timeout
- for pending updates if |opaqueDataPromise| doesn't settle in a
- reasonable amount of time. If an implementation chooses to implement
- a timeout, they MUST execute the steps listed below in the "upon
- rejection" path. Such a timeout is a fatal error for the payment
- request.
-
-
-
Set |request|.{{PaymentRequest/[[updating]]}} to true.
-
-
- In parallel, disable the user interface that allows the user
- to accept the payment request. This is to ensure that the payment
- is not accepted until the user interface is updated with any new
- details.
-
Otherwise, set |request|.{{PaymentRequest/[[updating]]}} to
- false.
-
-
Enable the user interface, allowing the request for payment
- to proceed.
-
-
-
-
-
@@ -5283,16 +4958,6 @@
with a merchant.
-
-
- Merchant Validation
-
-
- It is important that the {{MerchantValidationEvent/validationURL}} in
- a {{MerchantValidationEvent}} does not expose personally identifying
- information to unauthorized parties.
-
The {{PaymentRequest/canMakePayment()}} method can be used by the
developer to determine if the user agent has support for one
@@ -1377,30 +1375,11 @@
A true result from {{PaymentRequest/canMakePayment()}} does not
imply that the user has a provisioned instrument ready for payment.
- For that, use {{PaymentRequest/hasEnrolledInstrument()}} instead.
The {{PaymentRequest/canMakePayment()}} method MUST run the can
- make payment algorithm with |checkForInstruments| set to false.
-
-
-
-
- hasEnrolledInstrument() method
-
-
- The {{PaymentRequest/hasEnrolledInstrument()}} method can be used by
- the developer to determine if the user agent has support for
- one of the desired payment methods and if a payment
- handler has an instrument ready for payment. See
- [[[#canmakepayment-protections]]].
-
-
- The {{PaymentRequest/hasEnrolledInstrument()}} method MUST run the
- can make payment algorithm with |checkForInstruments| set to
- true.
+ make payment algorithm.
@@ -3945,10 +3924,7 @@
The can make payment algorithm checks if the user
agent supports making payment with the payment methods
- with which the {{PaymentRequest}} was constructed. It takes a boolean
- argument, |checkForInstruments|, that specifies whether the algorithm
- checks for existence of enrolled instruments in addition to
- supporting a payment method.
+ with which the {{PaymentRequest}} was constructed.
Let |request:PaymentRequest| be the {{PaymentRequest}} object on
@@ -3958,11 +3934,9 @@
"[=state/created=]", then return a promise rejected with an
{{"InvalidStateError"}} {{DOMException}}.
This allows user agents to apply heuristics to detect and prevent
abuse of the calling method for fingerprinting purposes, such as
@@ -3985,39 +3959,9 @@
Let |identifier| be the first element in the |paymentMethod|
tuple.
-
If |checkForInstruments| is false, and the user agent has a
- payment handler that supports handling payment requests
- for |identifier|, resolve |hasHandlerPromise| with true and
- terminate this algorithm.
-
-
If |checkForInstruments| is true:
-
-
Let |data| be the result of JSON-parsing the second
- element in the |paymentMethod| tuple.
-
-
If required by the specification that defines the
- |identifier|, then [=converted to an IDL value|convert=]
- |data| to an IDL value. Otherwise, [=converted to an IDL
- value|convert=] to {{object}}.
-
-
Let |handlers| be a list of registered payment
- handlers that are authorized and can handle payment
- request for |identifier|.
-
If |hasEnrolledInstrument| is true, resolve
- |hasHandlerPromise| with true and terminate this
- algorithm.
-
-
-
-
+
If the user agent has a payment handler that supports
+ handling payment requests for |identifier|, resolve
+ |hasHandlerPromise| with true and terminate this algorithm.
@@ -4963,19 +4907,14 @@
canMakePayment() protections
- The {{PaymentRequest/canMakePayment()}} and
- {{PaymentRequest/hasEnrolledInstrument()}} methods have the potential
- to expose user information that could be abused for fingerprinting
- purposes. User agents are expected to protect the user from abuse of
- the method. For example, user agents can reduce user fingerprinting
- by:
+ The {{PaymentRequest/canMakePayment()}} method provides feature
+ detection for different payment methods. It may become a
+ fingerprinting vector if in the future, a large number of payment
+ methods are available. purposes. User agents are expected to protect
+ the user from abuse of the method. For example, user agents can
+ reduce user fingerprinting by:
-
Allowing the user to configure the user agent to turn off
- {{PaymentRequest/canMakePayment()}} and
- {{PaymentRequest/hasEnrolledInstrument()}}, which would return a
- promise rejected with a {{"NotAllowedError"}} {{DOMException}}.
-
Rate-limiting the frequency of calls with different parameters.
Calling {{PaymentRequest/show()}} now consumes the user
+ activation.
+
@@ -990,16 +993,19 @@
follows:
+
Let |request:PaymentRequest| be [=this=].
+
- If the [=relevant global object=] of [=this=] does not have
+ If the [=relevant global object=] of [=request=] does not have
[=transient activation=], return [=a promise rejected with=] with a
- {{"SecurityError"}} {{DOMException}}.
+ {{"NotAllowedError"}} {{DOMException}}.
-
Let |request:PaymentRequest| be [=this=].
+
[=Consume user
+ activation=] of the [=relevant global object=].
-
Let |document| be |request|'s [=relevant global object=]'s [=
- associated `Document`=].
+
Let |document| be |request|'s [=relevant global object=]'s
+ [=associated `Document`=].
is an implementation detail of a payment
+ handler. Concretely, each payment handler defines:
@@ -4687,8 +4687,8 @@
Abort the update
- To abort the update with a {{PaymentRequest}} |request|
- and exception |exception|:
+ To abort the update with a
+ {{PaymentRequest}} |request| and exception |exception|:
Optionally, show an error message to the user when letting them
From 2799b448b08dc3c7f6158a05ce7966dc10356ec2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20C=C3=A1ceres?=
Date: Mon, 16 Nov 2020 23:21:18 +1100
Subject: [PATCH 013/101] Editorial: Ralph's feedback
---
index.html | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/index.html b/index.html
index 4be6bd0d..4454591d 100644
--- a/index.html
+++ b/index.html
@@ -3572,10 +3572,10 @@
Permissions Policy integration
- This specification defines a policy-controlled permission identified by
- the string "payment". Its default allowlist is
- 'self'.
+ This specification defines a [=policy-controlled feature=] identified
+ by the string "payment" [[permissions-policy]]. Its default
+ allowlist is 'self'.
-
If required by the specification
- that defines the |identifier|, then [=converted to an IDL
- value|convert=] |data| to an IDL value of the type specified
- there. Otherwise, [=converted to an IDL value|convert=] to
- {{object}}.
+
If required by the specification that defines the
+ |identifier|, then [=converted to an IDL value|convert=] |data|
+ to an IDL value of the type specified there. Otherwise,
+ [=converted to an IDL value|convert=] to {{object}}.
If conversion results in an exception |error|:
@@ -1988,8 +1987,9 @@
- Payment method specific errors. See, for example,
- [[[?payment-method-basic-card]]]'s {{BasicCardErrors}}.
+ Payment method specific errors. See, for example,
+ [[[?payment-method-basic-card]]]'s {{BasicCardErrors}}.
@@ -3295,8 +3295,9 @@
paymentMethod member
- A payment method specific errors. See, for example,
- [[[?payment-method-basic-card]]]'s {{BasicCardErrors}}.
+ A payment method specific errors. See,
+ for example, [[[?payment-method-basic-card]]]'s
+ {{BasicCardErrors}}.
@@ -3372,7 +3373,7 @@
details attribute
-
+
An {{object}} or dictionary generated by a payment
method that a merchant can use to process or validate a
transaction (depending on the payment method).
From 8bbbb7e3c18039f2dca0c7b599a23fd1e61452f3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20C=C3=A1ceres?=
Date: Mon, 30 Nov 2020 12:36:58 +1100
Subject: [PATCH 017/101] Editorial: fixup more xrefs
---
index.html | 99 ++++++++++++++++++++++++++++--------------------------
1 file changed, 51 insertions(+), 48 deletions(-)
diff --git a/index.html b/index.html
index d0cc04e5..4a845fde 100644
--- a/index.html
+++ b/index.html
@@ -920,7 +920,7 @@
Set |request|.{{PaymentRequest/[[options]]}} to |options|.
Set |request|.{{PaymentRequest/[[state]]}} to
- "[=state/created=]".
+ "[=PaymentRequest/created=]".
Set |request|.{{PaymentRequest/[[updating]]}} to false.
@@ -1023,14 +1023,14 @@
If |request|.{{PaymentRequest/[[state]]}} is not
- "[=state/created=]" then return a promise rejected with an
- {{"InvalidStateError"}} {{DOMException}}.
+ "[=PaymentRequest/created=]" then return a promise rejected
+ with an {{"InvalidStateError"}} {{DOMException}}.
Set |request|.{{PaymentRequest/[[state]]}} to
- "[=state/closed=]".
+ "[=PaymentRequest/closed=]".
Reject |acceptPromise| with |error|.
@@ -1122,7 +1122,7 @@
If |handlers| is empty, then:
Set |request|.{{PaymentRequest/[[state]]}} to
- "[=state/closed=]".
+ "[=PaymentRequest/closed=]".
Reject |acceptPromise| with {{"NotSupportedError"}}
{{DOMException}}.
@@ -1305,7 +1305,7 @@
and to tear down any user interface that might be shown. The
{{PaymentRequest/abort()}} can only be called after the
{{PaymentRequest/show()}} method has been called (see
- states) and before this instance's
+ [=PaymentRequest/states=]) and before this instance's
{{PaymentRequest/[[acceptPromise]]}} has been resolved. For
example, developers might choose to do this if the goods they are
selling are only available for a limited amount of time. If the
@@ -1335,8 +1335,8 @@
{{"InvalidStateError"}} {{DOMException}}.
If the value of |request|.{{PaymentRequest/[[state]]}} is not
- "[=state/interactive=]" then return a promise rejected with an
- {{"InvalidStateError"}} {{DOMException}}.
+ "[=PaymentRequest/interactive=]" then return a promise rejected
+ with an {{"InvalidStateError"}} {{DOMException}}.
Set |request|.{{PaymentRequest/[[state]]}} to
- "[=state/closed=]".
+ "[=PaymentRequest/closed=]".
Reject the promise
|request|.{{PaymentRequest/[[acceptPromise]]}} with an
@@ -1528,47 +1528,48 @@
- The current state of the payment request, which
- transitions from:
+ The current state of the payment request, which transitions from:
- "created"
+ "created"
The payment request is constructed and has not been presented
to the user.
- "interactive"
+ "interactive"
The payment request is being presented to the user.
- "closed"
+ "closed"
The payment request completed.
- The state transitions are illustrated in the figure
- below:
+ The [=PaymentRequest/state=] transitions are illustrated in the
+ figure below:
- The constructor sets the initial state to
- "[=state/created=]". The {{PaymentRequest/show()}} method
- changes the state to "[=state/interactive=]". From
- there, the {{PaymentRequest/abort()}} method or any other
- error can send the state to "[=state/closed=]";
+ The constructor sets the initial [=PaymentRequest/state=] to
+ "[=PaymentRequest/created=]". The {{PaymentRequest/show()}}
+ method changes the [=PaymentRequest/state=] to
+ "[=PaymentRequest/interactive=]". From there, the
+ {{PaymentRequest/abort()}} method or any other error can send
+ the [=PaymentRequest/state=] to "[=PaymentRequest/closed=]";
similarly, the user accepts the payment request
algorithm and user aborts the payment request
- algorithm will change the state to
- "[=state/closed=]".
+ algorithm will change the [=PaymentRequest/state=] to
+ "[=PaymentRequest/closed=]".
@@ -3146,7 +3147,7 @@
{{DOMException}}.
Set |request|.{{PaymentRequest/[[state]]}} to
- "[=state/interactive=]".
+ "[=PaymentRequest/interactive=]".
Assert: |request| is an instance of {{PaymentRequest}}.
If |request|.{{PaymentRequest/[[state]]}} is not
- "[=state/interactive=]", then [=exception/throw=] an
+ "[=PaymentRequest/interactive=]", then [=exception/throw=] an
{{"InvalidStateError"}} {{DOMException}}.
If |request|.{{PaymentRequest/[[updating]]}} is true, then
@@ -3952,8 +3953,8 @@
When the internal slot [[\state]] of a {{PaymentRequest}} object
- is set to "[=state/interactive=]", the user agent will trigger
- the following algorithms based on user interaction.
+ is set to "[=PaymentRequest/interactive=]", the user agent will
+ trigger the following algorithms based on user interaction.
@@ -3969,8 +3970,8 @@
which the method was called.
If |request|.{{PaymentRequest/[[state]]}} is not
- "[=state/created=]", then return a promise rejected with an
- {{"InvalidStateError"}} {{DOMException}}.
+ "[=PaymentRequest/created=]", then return a promise rejected
+ with an {{"InvalidStateError"}} {{DOMException}}.
Assert: |request|.{{PaymentRequest/[[state]]}} is
- "[=state/interactive=]".
+ "[=PaymentRequest/interactive=]".
Let |event:PaymentRequestUpdateEvent| be the result of
creating an event using the {{PaymentRequestUpdateEvent}}
@@ -4197,7 +4198,7 @@
Assert: |request|.{{PaymentRequest/[[updating]]}} is false.
Assert: |request|.{{PaymentRequest/[[state]]}} is
- "[=state/interactive=]".
+ "[=PaymentRequest/interactive=]".
Let |options:PaymentOptions| be
|request|.{{PaymentRequest/[[options]]}}.
@@ -4266,9 +4267,9 @@
agent user interface SHOULD ensure that this never occurs.
If |request|.{{PaymentRequest/[[state]]}} is not
- "[=state/interactive=]", then terminate this algorithm and take no
- further action. The user agent user interface SHOULD ensure
- that this never occurs.
+ "[=PaymentRequest/interactive=]", then terminate this algorithm and
+ take no further action. The user agent user interface SHOULD
+ ensure that this never occurs.
If the {{PaymentOptions/requestShipping}} value of
|request|.{{PaymentRequest/[[options]]}} is true, then if the
@@ -4355,7 +4356,8 @@
When setting the {{PaymentResponse/payerPhone}} value, the user agent
SHOULD format the phone number to adhere to [[E.164]].
-
Set |request|.{{PaymentRequest/[[state]]}} to "[=state/closed=]".
+
Set |request|.{{PaymentRequest/[[state]]}} to
+ "[=PaymentRequest/closed=]".
If |isRetry| is true, resolve
|response|.{{PaymentResponse/[[retryPromise]]}} with undefined.
@@ -4380,11 +4382,12 @@
that the user is interacting with.
If |request|.{{PaymentRequest/[[state]]}} is not
- "[=state/interactive=]", then terminate this algorithm and take no
- further action. The user agent user interface SHOULD ensure
- that this never occurs.
+ "[=PaymentRequest/interactive=]", then terminate this algorithm and
+ take no further action. The user agent user interface SHOULD
+ ensure that this never occurs.
-
Set |request|.{{PaymentRequest/[[state]]}} to "[=state/closed=]".
+
Set |request|.{{PaymentRequest/[[state]]}} to
+ "[=PaymentRequest/closed=]".
Set |request|.{{PaymentRequest/[[state]]}} to
- "[=state/closed=]".
+ "[=PaymentRequest/closed=]".
Let |response:PaymentResponse| be
|request|.{{PaymentRequest/[[response]]}}.
@@ -4777,10 +4780,10 @@
event.
- Consequently, the {{PaymentRequest}} moves to a "[=state/closed=]"
- state. The error is signaled to the developer through the rejection
- of the [[\acceptPromise]], i.e., the promise returned by
- {{PaymentRequest/show()}}.
+ Consequently, the {{PaymentRequest}} moves to a
+ "[=PaymentRequest/closed=]" state. The error is signaled to the
+ developer through the rejection of the [[\acceptPromise]],
+ i.e., the promise returned by {{PaymentRequest/show()}}.
Represents the address line of the address. When getting,
returns the value of the {{PaymentAddress}}'s
- {{PaymentAddress/[[addressLine]]}} internal slot.
+ {{PaymentAddress/[[addressLine]]}} internal slot.
- The API defined in this specification is only exposed in secure
- contexts. In practice, this means that this API is only available
- over HTTPS. This is to limit the possibility of payment method data
- (e.g., credit card numbers) being sent in the clear.
+ The API defined in this specification is only exposed in a [=secure
+ context=] - see also the [[[secure-contexts]]] specification for more
+ details. In practice, this means that this API is only available over
+ HTTPS. This is to limit the possibility of payment method data (e.g.,
+ credit card numbers) being sent in the clear.
From 0e2ad2b248b2c7a36c0226f7b6eaf4be5bfc1a9b Mon Sep 17 00:00:00 2001
From: ianbjacobs
Date: Thu, 4 Feb 2021 15:38:20 -0600
Subject: [PATCH 020/101] Added based on issue 936 (#937)
* Added based on issue 936
https://github.com/w3c/payment-request/issues/936#issuecomment-766918305
* Marcos' edits
---
index.html | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/index.html b/index.html
index 6f924dc1..4a241ad6 100644
--- a/index.html
+++ b/index.html
@@ -4900,6 +4900,19 @@
The user agent MUST NOT share information about the user with
a developer (e.g., the shipping address) without user consent.
+
+ In particular, the {{PaymentMethodData}}'s {{PaymentMethodData/data}}
+ and {{PaymentResponse}}'s {{PaymentResponse/details}} members allow
+ for the arbitrary exchange of data. In light of the wide range of
+ data models used by existing payment methods, prescribing data
+ specifics in this API would limit its usefulness. The
+ {{PaymentResponse/details}} member carries data from the payment
+ handler, whether Web-based (as defined by the [[[payment-handler]]])
+ or proprietary. The [=user agent=] MUST NOT support payment handlers
+ unless they include adequate user consent mechanisms (such as
+ awareness of parties to the transaction and mechanisms for
+ demonstrating the intention to share data).
+
The user agent MUST NOT share the values of the
{{PaymentDetailsBase/displayItems}} member or
From 62e3ad0619043cc52b29b68069d7e4dc319a6fbb Mon Sep 17 00:00:00 2001
From: ianbjacobs
Date: Mon, 15 Mar 2021 19:24:47 -0500
Subject: [PATCH 021/101] Editorial: fix typo (#941)
---
index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/index.html b/index.html
index 4a241ad6..4d14aa09 100644
--- a/index.html
+++ b/index.html
@@ -5014,7 +5014,7 @@
From 1cbf910847bb5a0e8452dbe471eae061f6b68129 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20C=C3=A1ceres?=
Date: Fri, 19 Mar 2021 10:42:16 +1100
Subject: [PATCH 023/101] Editorial: use unicode name/code for currencies in
note (#942)
---
index.html | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/index.html b/index.html
index e2da430b..85f15600 100644
--- a/index.html
+++ b/index.html
@@ -1678,9 +1678,19 @@
alphabetic code (i.e., the numeric codes are not supported). Their
canonical form is upper case. However, the set of combinations of
currency code for which localized currency symbols are available is
- implementation dependent. Where a localized currency symbol is not
- available, a user agent SHOULD use U+00A4 (¤) for formatting. User
- agents MAY format the display of the
+ implementation dependent.
+
+
+ When displaying a monetary value, it is RECOMMENDED that user
+ agents display the currency code, but it's OPTIONAL for user agents
+ to display a currency symbol. This is because currency symbols can be
+ ambiguous due to use across a number of different currencies (e.g.,
+ "$" could mean any of USD, AUD, NZD, CAD, and so on.). User agent
+ that display currency symbols MAY use U+00A4 (¤) when a currency
+ symbol is not available.
+
+
+ User agents MAY format the display of the
{{PaymentCurrencyAmount/currency}} member to adhere to OS
conventions (e.g., for localization purposes).
@@ -1700,10 +1710,12 @@
[[ISO4217]] list (e.g., XBT, XRP, etc.). If the provided code is
a currency that the browser knows how to display, then an
implementation will generally display the appropriate currency
- symbol in the user interface (e.g., "USD" is shown as "$", "GBP"
- is "£", and the non-standard "XBT" could be shown as "Ƀ"). When a
- code cannot be matched, the specification recommends browsers
- show a scarab "¤".
+ symbol in the user interface (e.g., "USD" is shown as U+0024
+ Dollar Sign ($), "GBP" is U+00A3 Pound Sign (£), and the
+ non-standard "XBT" could be shown as U+0243 Latin Capital Letter
+ B with Stroke (Ƀ)). When a code cannot be matched, the
+ specification recommends showing a U+00A4 Currency Sign
+ (¤).
Efforts are underway at ISO to account for digital currencies,
From df6f802dcd487e3b5ced4ec6f201bf84aa7aba2c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20C=C3=A1ceres?=
Date: Tue, 23 Mar 2021 11:18:44 +1100
Subject: [PATCH 024/101] chore: tidy
---
index.html | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/index.html b/index.html
index 85f15600..28cba191 100644
--- a/index.html
+++ b/index.html
@@ -1683,11 +1683,11 @@
When displaying a monetary value, it is RECOMMENDED that user
agents display the currency code, but it's OPTIONAL for user agents
- to display a currency symbol. This is because currency symbols can be
- ambiguous due to use across a number of different currencies (e.g.,
- "$" could mean any of USD, AUD, NZD, CAD, and so on.). User agent
- that display currency symbols MAY use U+00A4 (¤) when a currency
- symbol is not available.
+ to display a currency symbol. This is because currency symbols can
+ be ambiguous due to use across a number of different currencies
+ (e.g., "$" could mean any of USD, AUD, NZD, CAD, and so on.). User
+ agent that display currency symbols MAY use U+00A4 (¤) when a
+ currency symbol is not available.
User agents MAY format the display of the
@@ -1714,8 +1714,7 @@
Dollar Sign ($), "GBP" is U+00A3 Pound Sign (£), and the
non-standard "XBT" could be shown as U+0243 Latin Capital Letter
B with Stroke (Ƀ)). When a code cannot be matched, the
- specification recommends showing a U+00A4 Currency Sign
- (¤).
+ specification recommends showing a U+00A4 Currency Sign (¤).
Efforts are underway at ISO to account for digital currencies,
From 407384a8690d335ea9d724a7188b1ffef769541d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20C=C3=A1ceres?=
Date: Tue, 20 Apr 2021 09:17:24 +1000
Subject: [PATCH 025/101] Editorial: fix typo $
---
index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/index.html b/index.html
index 28cba191..428eb72f 100644
--- a/index.html
+++ b/index.html
@@ -356,7 +356,7 @@
label: "Total due",
// The total is GBP£65.00 here because we need to
// add shipping (below). The selected shipping
- // costs GBP$5.00.
+ // costs GBP£5.00.
amount: { currency: "GBP", value: "65.00" },
},
};
From 3f825312dfde1b9195228cd6cc439aa7a1a95c02 Mon Sep 17 00:00:00 2001
From: ianbjacobs
Date: Mon, 19 Apr 2021 18:35:39 -0500
Subject: [PATCH 026/101] Editorial: Address issue 947 (#953)
---
index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/index.html b/index.html
index 428eb72f..f03b87e0 100644
--- a/index.html
+++ b/index.html
@@ -2343,7 +2343,7 @@
Efforts are underway at ISO to account for digital currencies,
From 4ce6ebb8b852f5019eb9232b57abd1e870953221 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20C=C3=A1ceres?=
Date: Tue, 20 Apr 2021 09:52:02 +1000
Subject: [PATCH 028/101] =?UTF-8?q?Drop=20metion=20of=20=C2=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
index.html | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/index.html b/index.html
index 4e7ee640..487a0a1e 100644
--- a/index.html
+++ b/index.html
@@ -1685,9 +1685,7 @@
agents display the currency code, but it's OPTIONAL for user agents
to display a currency symbol. This is because currency symbols can
be ambiguous due to use across a number of different currencies
- (e.g., "$" could mean any of USD, AUD, NZD, CAD, and so on.). User
- agent that display currency symbols MAY use U+00A4 (¤) when a
- currency symbol is not available.
+ (e.g., "$" could mean any of USD, AUD, NZD, CAD, and so on.).
User agents MAY format the display of the
@@ -1714,8 +1712,6 @@
Dollar Sign ($), "GBP" is shown as U+00A3 Pound Sign (£), "PLN"
is shown as U+007A U+0142 Złoty (zł), and the non-standard "XBT"
could be shown as U+0243 Latin Capital Letter B with Stroke (Ƀ)).
- When a code cannot be matched, the specification recommends
- showing a U+00A4 Currency Sign (¤).
Efforts are underway at ISO to account for digital currencies,
From ac804d35327a7731f1722d29ba1328d495f740a7 Mon Sep 17 00:00:00 2001
From: ianbjacobs
Date: Mon, 19 Apr 2021 21:25:52 -0500
Subject: [PATCH 029/101] Chore: Moved Danyao to former editor after her change
in affiliation (and with her permission) (#954)
---
index.html | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/index.html b/index.html
index 487a0a1e..c9f3330b 100644
--- a/index.html
+++ b/index.html
@@ -33,6 +33,11 @@
company: "Facebook",
w3cid: 88345,
},
+ {
+ name: "Danyao Wang",
+ company: "Google",
+ w3cid: 110796,
+ },
],
editors: [
{
@@ -41,13 +46,6 @@
company: "W3C Invited Expert",
w3cid: 39125,
},
- {
- name: "Danyao Wang",
- url: "https://github.com/danyao",
- company: "Google",
- companyURL: "https://www.google.com/",
- w3cid: 110796,
- },
{
name: "Rouslan Solomakhin",
url: "https://github.com/rsolomakhin",
From 4bb62e1994157f3a7e16bb48b6bbe42db63431df Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20C=C3=A1ceres?=
Date: Wed, 21 Apr 2021 16:28:26 +1000
Subject: [PATCH 030/101] Recommend Payment UI matches doc's language (#944)
---
index.html | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/index.html b/index.html
index c9f3330b..8ca237c5 100644
--- a/index.html
+++ b/index.html
@@ -1134,10 +1134,14 @@
-
+
Present a user interface that will allow the user to interact
with the |handlers|. The user agent SHOULD prioritize the user's
- preference when presenting payment methods.
+ preference when presenting payment methods. The user interface
+ SHOULD be presented using the language and locale-based
+ formatting that matches the |document|'s [=document
+ element|document element's=] [=Node/language=], if any, or an
+ appropriate fallback locale if that is not available.
The |details|: The details of the transaction, as a
PaymentDetailsInit dictionary. This includes total cost, and
- optionally a list of goods or services being purchased, for physical
- goods, and shipping options. Additionally, it can optionally include
- "modifiers" to how payments are made. For example, "if you pay with a
- card belonging to network X, it incurs a US$3.00 processing fee".
-
-
The |options|: Optionally, a list of things as {{PaymentOptions}}
- that the site needs to deliver the good or service (e.g., for physical
- goods, the merchant will typically need a physical address to ship to.
- For digital goods, an email will usually suffice).
+ optionally a list of goods or services being purchased. Additionally,
+ it can optionally include "modifiers" to how payments are made. For
+ example, "if you pay with a card belonging to network X, it incurs a
+ US$3.00 processing fee".
@@ -350,44 +307,20 @@
label: "Value-Added Tax (VAT)",
amount: { currency: "GBP", value: "5.00" },
},
+ {
+ label: "Standard shipping",
+ amount: { currency: "GBP", value: "5.00" },
+ },
],
total: {
label: "Total due",
// The total is GBP£65.00 here because we need to
- // add shipping (below). The selected shipping
- // costs GBP£5.00.
+ // add tax and shipping.
amount: { currency: "GBP", value: "65.00" },
},
};
-
-
- Adding shipping options
-
-
- Here we see an example of how to add two shipping options to the
- |details|.
-
Conditional modifications to payment request
@@ -422,30 +355,6 @@
Object.assign(details, { modifiers });
-
-
- Requesting specific information from the end user
-
-
- Some financial transactions require a user to provide specific
- information in order for a merchant to fulfill a purchase (e.g., the
- user's shipping address, in case a physical good needs to be
- shipped). To request this information, a merchant can pass a third
- optional argument (|options|) to the {{PaymentRequest}} constructor
- indicating what information they require. When the payment request is
- shown, the user agent will request this information from the end user
- and return it to the merchant when the user accepts the payment
- request.
-
async function doPaymentRequest() {
try {
const request = new PaymentRequest(methodData, details, options);
- // See below for a detailed example of handling these events
- request.onshippingaddresschange = ev => ev.updateWith(details);
- request.onshippingoptionchange = ev => ev.updateWith(details);
const response = await request.show();
await validateResponse(response);
} catch (err) {
@@ -487,79 +393,6 @@
doPaymentRequest();
-
-
- Handling events and updating the payment request
-
-
- Prior to the user accepting to make payment, the site is given an
- opportunity to update the payment request in response to user input.
- This can include, for example, providing additional shipping options
- (or modifying their cost), removing items that cannot ship to a
- particular address, etc.
-
-
- const request = new PaymentRequest(methodData, details, options);
- // Async update to details
- request.onshippingaddresschange = ev => {
- ev.updateWith(checkShipping(request));
- };
- // Sync update to the total
- request.onshippingoptionchange = ev => {
- // selected shipping option
- const { shippingOption } = request;
- const newTotal = {
- currency: "USD",
- label: "Total due",
- value: calculateNewTotal(shippingOption),
- };
- ev.updateWith({ total: newTotal });
- };
- async function checkShipping(request) {
- try {
- const json = request.shippingAddress.toJSON();
-
- await ensureCanShipTo(json);
- const { shippingOptions, total } = await calculateShipping(json);
-
- return { shippingOptions, total };
- } catch (err) {
- return { error: `Sorry! we can't ship to your address.` };
- }
- }
-
-
-
-
- Fine-grained error reporting
-
-
- A developer can use the
- {{PaymentDetailsUpdate/shippingAddressErrors}} member of the
- {{PaymentDetailsUpdate}} dictionary to indicate that there are
- validation errors with specific attributes of a {{PaymentAddress}}.
- The {{PaymentDetailsUpdate/shippingAddressErrors}} member is a
- {{AddressErrors}} dictionary, whose members specifically demarcate
- the fields of a physical address that are erroneous while also
- providing helpful error messages to be displayed to the end user.
-
-
- request.onshippingaddresschange = ev => {
- ev.updateWith(validateAddress(request.shippingAddress));
- };
- function validateAddress(shippingAddress) {
- const error = "Can't ship to this address.";
- const shippingAddressErrors = {
- city: "FarmVille is not a real place.",
- postalCode: "Unknown postal code for your country.",
- };
- // Empty shippingOptions implies that we can't ship
- // to this address.
- const shippingOptions = [];
- return { error, shippingAddressErrors, shippingOptions };
- }
-
-
POSTing payment response back to a server
@@ -626,8 +459,7 @@
while the user is providing input (up to the point of user approval
or denial of the payment request).
-
- The {{PaymentRequest/shippingAddress}},
- {{PaymentRequest/shippingOption}}, and
- {{PaymentRequest/shippingType}} attributes are populated during
- processing if the {{PaymentOptions/requestShipping}} member is set.
-
A |request|'s payment-relevant browsing context is that
@@ -686,15 +507,14 @@
The {{PaymentRequest}} is constructed using the supplied sequence of
PaymentMethodData |methodData| including any payment
- method specific {{PaymentMethodData/data}}, the
- PaymentDetailsInit |details|, and the {{PaymentOptions}}
- |options|.
+ method specific {{PaymentMethodData/data}}, and the
+ PaymentDetailsInit |details|.
+ "payment-request-constructor.https.sub.html, payment-request-insecure.http.html">
The PaymentRequest(|methodData|,
- |details|, |options|) constructor MUST act as follows:
+ |details|) constructor MUST act as follows:
Run the steps
- to validate a payment method identifier with
+ "payment-request-ctor-pmi-handling.https.sub.html">Run the
+ steps to validate a payment method identifier with
|paymentMethod|.{{PaymentMethodData/supportedMethods}}. If it
returns false, then throw a {{RangeError}} exception.
Optionally, inform the developer that the payment method
@@ -791,7 +611,7 @@
Process the total:
+ "payment-request-ctor-currency-code-checks.https.sub.html">
Check and canonicalize total amount
|details|.{{PaymentDetailsInit/total}}.{{PaymentItem/amount}}.
Rethrow any exceptions.
@@ -803,54 +623,12 @@
|details|.{{PaymentDetailsBase/displayItems}}:
+ "payment-request-ctor-currency-code-checks.https.sub.html">
Check and canonicalize amount
|item|.{{PaymentItem/amount}}. Rethrow any exceptions.
-
Let |selectedShippingOption| be null.
-
-
If the {{PaymentOptions/requestShipping}} member of |options| is
- present and set to true, process shipping options:
-
-
Let |options:PaymentShippingOption| be an empty
- sequence<{{PaymentShippingOption}}>.
-
-
If the {{PaymentDetailsBase/shippingOptions}} member of
- |details| is present, then:
-
-
Let |seenIDs| be an empty set.
-
-
For each |option:PaymentShippingOption| in
- |details|.{{PaymentDetailsBase/shippingOptions}}:
-
-
If |seenIDs| contains
- |option|.{{PaymentShippingOption/id}}, then throw a
- {{TypeError}}. Optionally, inform the developer that
- shipping option IDs must be unique.
-
-
Otherwise, append
- |option|.{{PaymentShippingOption/id}} to |seenIDs|.
-
-
If |option|.{{PaymentShippingOption/selected}} is
- true, then set |selectedShippingOption| to
- |option|.{{PaymentShippingOption/id}}.
-
-
-
-
-
-
Set |details|.{{PaymentDetailsBase/shippingOptions}} to
- |options|.
-
-
-
Let |serializedModifierData| be an empty list.
Process payment details modifiers:
@@ -870,7 +648,7 @@
|modifier| is present, then:
+ "payment-request-ctor-currency-code-checks.https.sub.html">
Check and canonicalize total amount
|modifier|.{{PaymentDetailsModifier/total}}.{{PaymentItem/amount}}.
Rethrow any exceptions.
@@ -883,7 +661,7 @@
+ "payment-request-ctor-currency-code-checks.https.sub.html">
Check and canonicalize amount
|item|.{{PaymentItem/amount}}. Rethrow any
exceptions.
@@ -917,8 +695,6 @@
Set |request|.{{PaymentRequest/[[handler]]}} to `null`.
-
Set |request|.{{PaymentRequest/[[options]]}} to |options|.
-
Set |request|.{{PaymentRequest/[[state]]}} to
"[=PaymentRequest/created=]".
@@ -934,17 +710,6 @@
Set |request|.{{PaymentRequest/[[response]]}} to null.
-
Set the value of |request|'s {{PaymentRequest/shippingOption}}
- attribute to |selectedShippingOption|.
-
-
Set the value of the {{PaymentRequest/shippingAddress}} attribute
- on |request| to null.
-
-
If |options|.{{PaymentOptions/requestShipping}} is set to true,
- then set the value of the {{PaymentRequest/shippingType}} attribute
- on |request| to |options|.{{PaymentOptions/shippingType}}. Otherwise,
- set it to null.
-
- A {{PaymentRequest}}'s {{PaymentRequest/shippingAddress}} attribute
- is populated when the user provides a shipping address. It is null by
- default. When a user provides a shipping address, the shipping
- address changed algorithm runs.
-
-
-
-
- shippingType attribute
-
-
- A {{PaymentRequest}}'s {{PaymentRequest/shippingType}} attribute is
- the type of shipping used to fulfill the transaction. Its value is
- either a {{PaymentShippingType}} enum value, or null if none is
- provided by the developer during
- [=PaymentRequest.PaymentRequest()|construction=] (see
- {{PaymentOptions}}'s {{PaymentOptions/shippingType}} member).
-
-
-
-
- onshippingaddresschange attribute
-
-
- A {{PaymentRequest}}'s {{PaymentRequest/onshippingaddresschange}}
- attribute is an {{EventHandler}} for a {{PaymentRequestUpdateEvent}}
- named shippingaddresschange.
-
-
-
-
- shippingOption attribute
-
-
- A {{PaymentRequest}}'s {{PaymentRequest/shippingOption}} attribute is
- populated when the user chooses a shipping option. It is null by
- default. When a user chooses a shipping option, the shipping
- option changed algorithm runs.
-
-
-
-
- onshippingoptionchange attribute
-
-
- A {{PaymentRequest}}'s {{PaymentRequest/onshippingoptionchange}}
- attribute is an {{EventHandler}} for a {{PaymentRequestUpdateEvent}}
- named shippingoptionchange.
-
-
onpaymentmethodchange attribute
-
+
A {{PaymentRequest}}'s {{PaymentRequest/onpaymentmethodchange}}
attribute is an {{EventHandler}} for a {{PaymentMethodChangeEvent}}
named "paymentmethodchange".
@@ -1517,15 +1223,6 @@
{{PaymentDetailsInit/total}} amount is the sum of these items.
-
- shippingOptions member
-
-
-
- A sequence containing the different shipping options for the user
- to choose from.
-
-
- If an item in the sequence has the
- {{PaymentShippingOption/selected}} member set to true, then this
- is the shipping option that will be used by default and
- {{PaymentRequest/shippingOption}} will be set to the
- {{PaymentShippingOption/id}} of this option without running the
- shipping option changed algorithm. If more than one item
- in the sequence has {{PaymentShippingOption/selected}} set to
- true, then the user agent selects the last one in the
- sequence.
-
-
- The {{PaymentDetailsBase/shippingOptions}} member is only used if
- the {{PaymentRequest}} was constructed with {{PaymentOptions}}
- and {{PaymentOptions/requestShipping}} set to true.
-
- A human-readable string that explains why goods cannot be shipped
- to the chosen shipping address, or any other reason why no shipping
- options are available. When the payment request is updated using
- {{PaymentRequestUpdateEvent/updateWith()}}, the
- {{PaymentDetailsUpdate}} can contain a message in the
- {{PaymentDetailsUpdate/error}} member that will be displayed to the
- user if the {{PaymentDetailsUpdate}} indicates that there are no
- valid {{PaymentDetailsBase/shippingOptions}} (and the
- {{PaymentRequest}} was constructed with the
- {{PaymentOptions/requestShipping}} option set to true).
-
total member
@@ -1982,19 +1625,6 @@
is a negative number.
-
- shippingAddressErrors member
-
-
- Represents validation errors with the shipping address that is
- associated with the potential event target.
-
- This is the default and refers to the address being collected as the
- destination for shipping.
-
-
- "delivery"
-
-
- This refers to the address being collected as the destination for
- delivery. This is commonly faster than shipping. For example, it
- might be used for food delivery.
-
-
- "pickup"
-
-
- This refers to the address being collected as part of a service
- pickup. For example, this could be the address for laundry pickup.
-
- The {{PaymentOptions}} dictionary is passed to the {{PaymentRequest}}
- constructor and provides information about the options desired for the
- payment request.
-
-
-
- requestBillingAddress member
-
-
- A boolean that indicates whether the user agent SHOULD collect
- and return the billing address associated with a payment
- method (e.g., the billing address associated with a credit card).
- Typically, the user agent will return the billing address as part of
- the {{PaymentMethodChangeEvent}}'s
- {{PaymentMethodChangeEvent/methodDetails}}. A merchant can use this
- information to, for example, calculate tax in certain jurisdictions
- and update the displayed total. See below for privacy considerations
- regarding exposing user information.
-
-
- requestPayerName member
-
-
- A boolean that indicates whether the user agent SHOULD collect
- and return the payer's name as part of the payment request. For
- example, this would be set to true to allow a merchant to make a
- booking in the payer's name.
-
-
- requestPayerEmail member
-
-
- A boolean that indicates whether the user agent SHOULD collect
- and return the payer's email address as part of the payment request.
- For example, this would be set to true to allow a merchant to email a
- receipt.
-
-
- requestPayerPhone member
-
-
- A boolean that indicates whether the user agent SHOULD collect
- and return the payer's phone number as part of the payment request.
- For example, this would be set to true to allow a merchant to phone a
- customer with a billing enquiry.
-
-
- requestShipping member
-
-
- A boolean that indicates whether the user agent SHOULD collect
- and return a shipping address as part of the payment request. For
- example, this would be set to true when physical goods need to be
- shipped by the merchant to the user. This would be set to false for
- the purchase of digital goods.
-
-
- shippingType member
-
-
- A {{PaymentShippingType}} enum value. Some transactions require an
- address for delivery but the term "shipping" isn't appropriate. For
- example, "pizza delivery" not "pizza shipping" and "laundry pickup"
- not "laundry shipping". If {{PaymentOptions/requestShipping}} is set
- to true, then the {{PaymentOptions/shippingType}} member can
- influence the way the user agent presents the user interface
- for gathering the shipping address.
-
- The {{PaymentOptions/shippingType}} member only affects the user
- interface for the payment request.
-
-
-
-
PaymentItem dictionary
@@ -2241,831 +1746,38 @@
-
+
- Physical addresses
+ PaymentComplete enum
-
- A physical address is composed of the following parts.
-
-
-
- Country
-
-
- The country corresponding to the address.
-
-
- Address line
-
-
- The most specific part of the address. It can include, for example, a
- street name, a house number, apartment number, a rural delivery
- route, descriptive instructions, or a post office box number.
-
-
- Region
-
-
- The top level administrative subdivision of the country. For example,
- this can be a state, a province, an oblast, or a prefecture.
-
-
- City
-
-
- The city/town portion of the address.
-
-
- Dependent locality
-
-
- The dependent locality or sublocality within a city. For example,
- neighborhoods, boroughs, districts, or UK dependent localities.
-
-
- Postal code
-
-
- The postal code or ZIP code, also known as PIN code in India.
-
- The sorting code system, such as the CEDEX system used in France.
+ Indicates that processing of the payment failed. The user
+ agent MAY display UI indicating failure.
- Organization
+ "success"
- The organization, firm, company, or institution at the address.
+ Indicates the payment was successfully processed. The user
+ agent MAY display UI indicating success.
- Recipient
+ "unknown"
- The name of the recipient or contact person at the address.
-
-
- Phone number
-
-
- The phone number of the recipient or contact person at the address.
-
- The steps to internally construct a
- `PaymentAddress` with an optional {{AddressInit}}
- |details:AddressInit| are given by the following algorithm:
-
-
-
Let |address:PaymentAddress| be a new instance of
- {{PaymentAddress}}.
-
-
Set |address|.{{PaymentAddress/[[addressLine]]}} to the empty
- frozen array, and all other [=PaymentAddress slots|internal slots=]
- to the empty string.
-
-
If |details| was not passed, return |address|.
-
-
If |details|.{{AddressInit/country}} is present and not the
- empty string:
-
-
Set |address|.{{PaymentAddress/[[addressLine]]}} to a new
- frozen array created from |cleanAddressLines|.
-
-
If |details|.{{AddressInit/region}} is present, strip
- leading and trailing ASCII whitespace from
- |details|.{{AddressInit/region}} and set
- |address|.{{PaymentAddress/[[region]]}} to the result.
-
-
If |details|.{{AddressInit/city}} is present, strip leading
- and trailing ASCII whitespace from
- |details|.{{AddressInit/city}} and set
- |address|.{{PaymentAddress/[[city]]}} to the result.
-
-
If |details|.{{AddressInit/dependentLocality}} is present,
- strip leading and trailing ASCII whitespace from
- |details|.{{AddressInit/dependentLocality}} and set
- |address|.{{PaymentAddress/[[dependentLocality]]}} to the result.
-
-
If |details|.{{AddressInit/postalCode}} is present, strip
- leading and trailing ASCII whitespace from
- |details|.{{AddressInit/postalCode}} and set
- |address|.{{PaymentAddress/[[postalCode]]}} to the result.
-
-
If |details|.{{AddressInit/sortingCode}} is present, strip
- leading and trailing ASCII whitespace from
- |details|.{{AddressInit/sortingCode}} and set
- |address|.{{PaymentAddress/[[sortingCode]]}} to the result.
-
-
If |details|.{{AddressInit/organization}} is present, strip
- leading and trailing ASCII whitespace from
- |details|.{{AddressInit/organization}} and set
- |address|.{{PaymentAddress/[[organization]]}} to the result.
-
-
If |details|.{{AddressInit/recipient}} is present, strip
- leading and trailing ASCII whitespace from
- |details|.{{AddressInit/recipient}} and set
- |address|.{{PaymentAddress/[[recipient]]}} to the result.
-
-
If |details|.{{AddressInit/phone}} is present, strip leading
- and trailing ASCII whitespace from
- |details|.{{AddressInit/phone}} and set
- |address|.{{PaymentAddress/[[phone]]}} to the result.
-
-
Return |address|.
-
-
-
-
-
- country attribute
-
-
- Represents the country of the address. When getting, returns
- the value of the {{PaymentAddress}}'s
- {{PaymentAddress/[[country]]}} internal slot.
-
-
-
-
- addressLine attribute
-
-
- Represents the address line of the address. When getting,
- returns the value of the {{PaymentAddress}}'s
- {{PaymentAddress/[[addressLine]]}} internal slot.
-
-
-
-
- region attribute
-
-
- Represents the region of the address. When getting, returns
- the value of the {{PaymentAddress}}'s {{PaymentAddress/[[region]]}}
- internal slot.
-
-
-
-
- city attribute
-
-
- Represents the city of the address. When getting, returns
- the value of the {{PaymentAddress}}'s {{PaymentAddress/[[city]]}}
- internal slot.
-
-
-
-
- dependentLocality attribute
-
-
- Represents the dependent locality of the address. When
- getting, returns the value of the {{PaymentAddress}}'s
- {{PaymentAddress/[[dependentLocality]]}} internal slot.
-
-
-
-
- postalCode attribute
-
-
- Represents the postal code of the address. When getting,
- returns the value of the {{PaymentAddress}}'s
- {{PaymentAddress/[[postalCode]]}} internal slot.
-
-
-
-
- sortingCode attribute
-
-
- Represents the sorting code of the address. When getting,
- returns the value of the {{PaymentAddress}}'s
- {{PaymentAddress/[[sortingCode]]}} internal slot.
-
-
-
-
- organization attribute
-
-
- Represents the organization of the address. When getting,
- returns the value of the {{PaymentAddress}}'s
- {{PaymentAddress/[[organization]]}} internal slot.
-
-
-
-
- recipient attribute
-
-
- Represents the recipient of the address. When getting,
- returns the value of the {{PaymentAddress}}'s
- {{PaymentAddress/[[recipient]]}} internal slot.
-
-
-
-
- phone attribute
-
-
- Represents the phone number of the address. When getting,
- returns the value of the {{PaymentAddress}}'s
- {{PaymentAddress/[[phone]]}} internal slot.
-
-
-
-
- Internal
- slots
-
-
-
-
- Internal slot
-
-
- Description (non-normative)
-
-
-
-
- [[\country]]
-
-
- A country as an [[ISO3166-1]] alpha-2 code stored in its
- canonical uppercase form or the empty string. For example,
- "JP".
-
-
-
-
- [[\addressLine]]
-
-
- A frozen array, possibly of zero length, representing an
- address line.
-
-
-
-
- [[\region]]
-
-
- A region as a country subdivision name or the
- empty string, such as "Victoria", representing the state of
- Victoria in Australia.
-
- The members of the {{AddressErrors}} dictionary represent validation
- errors with specific parts of a physical address. Each
- dictionary member has a dual function: firstly, its presence denotes
- that a particular part of an address is suffering from a validation
- error. Secondly, the string value allows the developer to describe
- the validation error (and possibly how the end user can fix the
- error).
-
-
- Developers need to be aware that users might not have the ability to
- fix certain parts of an address. As such, they need to be mindful not
- to ask the user to fix things they might not have control over.
-
-
-
- addressLine member
-
-
- Denotes that the address line has a validation error. In the
- user agent's UI, this member corresponds to the input field that
- provided the {{PaymentAddress}}'s {{PaymentAddress/addressLine}}
- attribute's value.
-
-
- city member
-
-
- Denotes that the city has a validation error. In the user
- agent's UI, this member corresponds to the input field that
- provided the {{PaymentAddress}}'s {{PaymentAddress/city}}
- attribute's value.
-
-
- country member
-
-
- Denotes that the country has a validation error. In the user
- agent's UI, this member corresponds to the input field that
- provided the {{PaymentAddress}}'s {{PaymentAddress/country}}
- attribute's value.
-
-
- dependentLocality member
-
-
- Denotes that the dependent locality has a validation error.
- In the user agent's UI, this member corresponds to the input field
- that provided the {{PaymentAddress}}'s
- {{PaymentAddress/dependentLocality}} attribute's value.
-
-
- organization member
-
-
- Denotes that the organization has a validation error. In the
- user agent's UI, this member corresponds to the input field that
- provided the {{PaymentAddress}}'s {{PaymentAddress/organization}}
- attribute's value.
-
-
- phone member
-
-
- Denotes that the phone number has a validation error. In the
- user agent's UI, this member corresponds to the input field that
- provided the {{PaymentAddress}}'s {{PaymentAddress/phone}}
- attribute's value.
-
-
- postalCode member
-
-
- Denotes that the postal code has a validation error. In the
- user agent's UI, this member corresponds to the input field that
- provided the {{PaymentAddress}}'s {{PaymentAddress/postalCode}}
- attribute's value.
-
-
- recipient member
-
-
- Denotes that the recipient has a validation error. In the
- user agent's UI, this member corresponds to the input field that
- provided the {{PaymentAddress}}'s {{PaymentAddress/addressLine}}
- attribute's value.
-
-
- region member
-
-
- Denotes that the region has a validation error. In the user
- agent's UI, this member corresponds to the input field that
- provided the {{PaymentAddress}}'s {{PaymentAddress/region}}
- attribute's value.
-
-
- sortingCode member
-
-
- The sorting code has a validation error. In the user agent's
- UI, this member corresponds to the input field that provided the
- {{PaymentAddress}}'s {{PaymentAddress/sortingCode}} attribute's
- value.
-
-
-
-
-
- Creating a `PaymentAddress` from user-provided input
-
-
- The steps to create a `PaymentAddress` from
- user-provided input are given by the following algorithm. The
- algorithm takes a list |redactList|.
-
-
-
- The |redactList| optionally gives user agents the possibility to
- limit the amount of personal information about the recipient that
- the API shares with the merchant.
-
-
- For merchants, the resulting {{PaymentAddress}} object provides
- enough information to, for example, calculate shipping costs, but,
- in most cases, not enough information to physically locate and
- uniquely identify the recipient.
-
-
- Unfortunately, even with the |redactList|, recipient anonymity
- cannot be assured. This is because in some countries postal codes
- are so fine-grained that they can uniquely identify a recipient.
-
-
-
-
Let |details:AddressInit| be a newly created {{AddressInit}}
- dictionary.
-
-
If "addressLine" is not in |redactList|, set
- |details|.{{AddressInit/addressLine}} to the result of splitting the
- user-provided address line into a list.
-
-
-
If "country" is not in |redactList|, set
- |details|.{{AddressInit/country}} to the user-provided country as an
- upper case [[ISO3166-1]] alpha-2 code.
-
-
If "phone" is not in |redactList|, set
- |details|.{{AddressInit/phone}} to the user-provided phone number.
-
-
-
If "city" is not in |redactList|, set
- |details|.{{AddressInit/city}} to the user-provided city, or to the
- empty string if none was provided.
-
-
If "dependentLocality" is not in |redactList|, set |
- details|.{{AddressInit/dependentLocality}} to the user-provided
- dependent locality.
-
-
If "organization" is not in |redactList|, set
- |details|.{{AddressInit/organization}} to the user-provided recipient
- organization.
-
-
If "postalCode" is not in |redactList|, set
- |details|.{{AddressInit/postalCode}} to the user-provided postal
- code. Optionally, redact part of
- |details|.{{AddressInit/postalCode}}.
-
-
- Postal codes in certain countries can be so specific as
- to uniquely identify an individual. This being a privacy
- concern, some user agents only return the part of a postal code
- that they deem sufficient for a merchant to calculate shipping
- costs. This varies across countries and regions, and so the
- choice to redact part, or all, of the postal code is left to
- the discretion of implementers in the interest of protecting
- users' privacy.
-
-
-
-
If "recipient" is not in |redactList|, set
- |details|.{{AddressInit/recipient}} to the user-provided recipient of
- the transaction.
-
-
-
- If "region" is not in |redactList|:
-
-
- In some countries (e.g., Belgium) it is uncommon for users to
- include a region as part of a physical address
- (even if all the regions of a country are part of [[ISO3166-2]]).
- As such, when the user agent knows that the user is inputting the
- address for a particular country, it might not provide a field
- for the user to input a region. In such cases, the user
- agent returns an empty string for both {{PaymentAddress}}'s
- {{PaymentAddress/region}} attribute - but the address can still
- serve its intended purpose (e.g., be valid for shipping or
- billing purposes).
-
-
-
Set |details|.{{AddressInit/region}} to the user-provided
- region.
-
-
-
-
If "sortingCode" is not in |redactList|, set
- |details|.{{AddressInit/sortingCode}} to the user-provided sorting
- code.
-
-
[=PaymentAddress.PaymentAddress()|Internally construct a new
- `PaymentAddress`=] with |details| and return the result.
-
- The {{PaymentShippingOption}} dictionary has members describing a
- shipping option. Developers can provide the user with one or more
- shipping options by calling the
- {{PaymentRequestUpdateEvent/updateWith()}} method in response to a
- change event.
-
-
-
- id member
-
-
- A string identifier used to reference this {{PaymentShippingOption}}.
- It MUST be unique for a given {{PaymentRequest}}.
-
-
- label member
-
-
- A human-readable string description of the item. The user
- agent SHOULD use this string to display the shipping option to
- the user.
-
-
- amount member
-
-
- A {{PaymentCurrencyAmount}} containing the monetary amount for the
- item.
-
-
- selected member
-
-
- A boolean. When true, it indicates that this is the default selected
- {{PaymentShippingOption}} in a sequence. User agents SHOULD
- display this option by default in the user interface.
-
- Indicates that processing of the payment failed. The user
- agent MAY display UI indicating failure.
-
-
- "success"
-
-
- Indicates the payment was successfully processed. The user
- agent MAY display UI indicating success.
-
-
- "unknown"
-
-
- The developer did not indicate success or failure and the user
- agent SHOULD NOT display UI indicating success or failure.
+ The developer did not indicate success or failure and the user
+ agent SHOULD NOT display UI indicating success or failure.
The retry(|errorFields:PaymentValidationErrors|) method
MUST act as follows:
@@ -3168,35 +1873,6 @@
If |errorFields:PaymentValidationErrors| was passed:
-
Optionally, show a warning in the developer console if any of
- the following are true:
-
-
- |request|.{{PaymentRequest/[[options]]}}.{{PaymentOptions/requestPayerName}}
- is false, and
- |errorFields|.{{PaymentValidationErrors/payer}}.{{PayerErrors/name}}
- is present.
-
-
- |request|.{{PaymentRequest/[[options]]}}.{{PaymentOptions/requestPayerEmail}}
- is false, and
- |errorFields|.{{PaymentValidationErrors/payer}}.{{PayerErrors/email}}
- is present.
-
-
- |request|.{{PaymentRequest/[[options]]}}.{{PaymentOptions/requestPayerPhone}}
- is false, and
- |errorFields|.{{PaymentValidationErrors/payer}}.{{PayerErrors/phone}}
- is present.
-
-
- |request|.{{PaymentRequest/[[options]]}}.{{PaymentOptions/requestShipping}}
- is false, and
- |errorFields|.{{PaymentValidationErrors/shippingAddress}} is
- present.
-
- The {{PayerErrors}} is used to represent validation errors with one
- or more payer details.
-
-
- Payer details are any of the payer's name, payer's phone
- number, and payer's email.
-
-
-
- email member
-
-
- Denotes that the payer's email suffers from a validation error.
- In the user agent's UI, this member corresponds to the input
- field that provided the {{PaymentResponse}}'s
- {{PaymentResponse/payerEmail}} attribute's value.
-
-
- name member
-
-
- Denotes that the payer's name suffers from a validation error. In
- the user agent's UI, this member corresponds to the input field
- that provided the {{PaymentResponse}}'s
- {{PaymentResponse/payerName}} attribute's value.
-
-
- phone member
-
-
- Denotes that the payer's phone number suffers from a validation
- error. In the user agent's UI, this member corresponds to the
- input field that provided the {{PaymentResponse}}'s
- {{PaymentResponse/payerPhone}} attribute's value.
-
-
-
- const payer = {
- email: "The domain is invalid.",
- phone: "Unknown country code.",
- name: "Not in database.",
- };
- await response.retry({ payer });
-
-
@@ -3409,66 +2013,6 @@
-
-
- shippingAddress attribute
-
-
- If the {{PaymentOptions/requestShipping}} member was set to true in
- the {{PaymentOptions}} passed to the {{PaymentRequest}} constructor,
- then {{PaymentRequest/shippingAddress}} will be the full and final
- shipping address chosen by the user.
-
-
-
-
- shippingOption attribute
-
-
- If the {{PaymentOptions/requestShipping}} member was set to true in
- the {{PaymentOptions}} passed to the {{PaymentRequest}} constructor,
- then {{PaymentRequest/shippingOption}} will be the
- {{PaymentShippingOption/id}} attribute of the selected shipping
- option.
-
-
-
-
- payerName attribute
-
-
- If the {{PaymentOptions/requestPayerName}} member was set to true in
- the {{PaymentOptions}} passed to the {{PaymentRequest}} constructor,
- then {{PaymentResponse/payerName}} will be the name provided by the
- user.
-
-
-
-
- payerEmail attribute
-
-
- If the {{PaymentOptions/requestPayerEmail}} member was set to true in
- the {{PaymentOptions}} passed to the {{PaymentRequest}} constructor,
- then {{PaymentResponse/payerEmail}} will be the email address chosen
- by the user.
-
-
-
-
- payerPhone attribute
-
-
- If the {{PaymentOptions/requestPayerPhone}} member was set to true in
- the {{PaymentOptions}} passed to the {{PaymentRequest}} constructor,
- then {{PaymentResponse/payerPhone}} will be the phone number chosen
- by the user.
-
changes made by the end user through the UI), developers need to
immediately call {{PaymentRequestUpdateEvent/updateWith()}}.
-
- // ❌ Bad - this won't work!
- request.onshippingaddresschange = async ev => {
- // await goes to next tick, and updateWith()
- // was not called.
- const details = await getNewDetails(oldDetails);
- // 💥 So it's now too late! updateWith()
- // throws "InvalidStateError".
- ev.updateWith(details);
- };
-
- // ✅ Good - UI will wait.
- request.onshippingaddresschange = ev => {
- // Calling updateWith() with a promise is ok 👍
- const promiseForNewDetails = getNewDetails(oldDetails);
- ev.updateWith(promiseForNewDetails);
- };
-
Additionally, {{PaymentRequestUpdateEvent/[[waitForUpdate]]}}
prevents reuse of {{PaymentRequestUpdateEvent}}.
-
- // ❌ Bad - calling updateWith() twice doesn't work!
- request.addEventListener("shippingaddresschange", ev => {
- ev.updateWith(details); // this is ok.
- // 💥 [[waitForUpdate]] is true, throws "InvalidStateError".
- ev.updateWith(otherDetails);
- });
-
- // ❌ Bad - this won't work either!
- request.addEventListener("shippingaddresschange", async ev => {
- const p = Promise.resolve({ ...details });
- ev.updateWith(p);
- await p;
- // 💥 Only one call to updateWith() is allowed,
- // so the following throws "InvalidStateError"
- ev.updateWith({ ...newDetails });
- });
-
+ "PaymentRequestUpdateEvent/updatewith-method.https.html">
The {{PaymentRequestUpdateEvent/updateWith()}} with
|detailsPromise:Promise| method MUST act as follows:
@@ -4020,88 +2476,6 @@
-
-
- Shipping address changed algorithm
-
-
- The shipping address changed algorithm runs when the user
- provides a new shipping address. It MUST run the following steps:
-
-
-
Let |request:PaymentRequest| be the {{PaymentRequest}} object
- that the user is interacting with.
-
- The |redactList| limits the amount of personal information
- about the recipient that the API shares with the merchant.
-
-
- For merchants, the resulting {{PaymentAddress}} object
- provides enough information to, for example, calculate
- shipping costs, but, in most cases, not enough information
- to physically locate and uniquely identify the recipient.
-
-
- Unfortunately, even with the |redactList|, recipient
- anonymity cannot be assured. This is because in some
- countries postal codes are so fine-grained that they can
- uniquely identify a recipient.
-
-
-
-
Let |redactList:list| be the empty list. Set |redactList| to
- « "organization", "phone", "recipient", "addressLine" ».
-
method identifier of the payment handler the user is
interacting with.
-
- When the user selects or changes a payment method (e.g., a credit
- card), the {{PaymentMethodChangeEvent}} includes redacted billing
- address information for the purpose of performing tax calculations.
- Redacted attributes include, but are not limited to, address
- line, dependent locality, organization, phone
- number, and recipient.
-
Let |request:PaymentRequest| be the {{PaymentRequest}} object
that the user is interacting with.
@@ -4154,7 +2519,7 @@
PaymentRequest updated algorithm
-
+
The PaymentRequest updated algorithm is run by other
algorithms above to fire an event to indicate that a user has
made a change to a {{PaymentRequest}} called |request| with an event
@@ -4185,85 +2550,11 @@
-
-
- Payer detail changed algorithm
-
-
- The user agent MUST run the payer detail changed algorithm
- when the user changes the |payer name|, or the |payer email|, or the
- |payer phone| in the user interface:
-
-
-
Let |request:PaymentRequest| be the {{PaymentRequest}} object
- that the user is interacting with.
-
-
If |request|.{{PaymentRequest/[[response]]}} is null, return.
-
-
Let |response:PaymentResponse| be
- |request|.{{PaymentRequest/[[response]]}}.
-
If |event|.{{PaymentRequestUpdateEvent/[[waitForUpdate]]}} is
- true, disable any part of the user interface that could cause
- another change to the payer details to be fired.
-
-
Otherwise, set
- |event|.{{PaymentRequestUpdateEvent/[[waitForUpdate]]}} to true.
-
-
-
-
-
User accepts the payment request algorithm
-
+
The user accepts the
payment request algorithm runs when the user accepts the
payment request and confirms that they want to pay. It MUST queue
@@ -4283,13 +2574,6 @@
If the {{PaymentOptions/requestShipping}} value of
- |request|.{{PaymentRequest/[[options]]}} is true, then if the
- {{PaymentRequest/shippingAddress}} attribute of |request| is null or
- if the {{PaymentRequest/shippingOption}} attribute of |request| is
- null, then terminate this algorithm and take no further action. The
- user agent SHOULD ensure that this never occurs.
-
Let |isRetry:boolean| be true if
|request|.{{PaymentRequest/[[response]]}} is not null, false
otherwise.
@@ -4324,50 +2608,6 @@
If the {{PaymentOptions/requestShipping}} value of
- |request|.{{PaymentRequest/[[options]]}} is false, then set the
- {{PaymentResponse/shippingAddress}} attribute value of |response| to
- null. Otherwise:
-
-
Set the {{PaymentResponse/shippingAddress}} attribute value
- of |response| to |shippingAddress|.
-
-
Set the {{PaymentResponse/shippingAddress}} attribute value
- of |request| to |shippingAddress|.
-
-
-
-
If the {{PaymentOptions/requestShipping}} value of
- |request|.{{PaymentRequest/[[options]]}} is true, then set the
- {{PaymentResponse/shippingOption}} attribute of |response| to the
- value of the {{PaymentResponse/shippingOption}} attribute of
- |request|. Otherwise, set it to null.
-
-
If the {{PaymentOptions/requestPayerName}} value of
- |request|.{{PaymentRequest/[[options]]}} is true, then set the
- {{PaymentResponse/payerName}} attribute of |response| to the payer's
- name provided by the user, or to null if none was provided.
- Otherwise, set it to null.
-
-
If the {{PaymentOptions/requestPayerEmail}} value of
- |request|.{{PaymentRequest/[[options]]}} is true, then set the
- {{PaymentResponse/payerEmail}} attribute of |response| to the payer's
- email address provided by the user, or to null if none was provided.
- Otherwise, set it to null.
-
-
If the {{PaymentOptions/requestPayerPhone}} value of
- |request|.{{PaymentRequest/[[options]]}} is true, then set the
- {{PaymentResponse/payerPhone}} attribute of |response| to the payer's
- phone number provided by the user, or to null if none was provided.
- When setting the {{PaymentResponse/payerPhone}} value, the user agent
- SHOULD format the phone number to adhere to [[E.164]].
-
Set |request|.{{PaymentRequest/[[state]]}} to
"[=PaymentRequest/closed=]".
@@ -4479,11 +2719,6 @@
Let |serializedModifierData| be an empty list.
-
Let |selectedShippingOption| be null.
-
-
Let |shippingOptions| be an empty
- sequence<{{PaymentShippingOption}}>.
-
Validate and canonicalize the details:
If the {{PaymentDetailsUpdate/total}} member of |details|
@@ -4509,41 +2744,6 @@
-
If the {{PaymentDetailsBase/shippingOptions}} member of
- |details| is present, and
- |request|.{{PaymentRequest/[[options]]}}.{{PaymentOptions/requestShipping}}
- is true, then:
-
-
Let |seenIDs| be an empty set.
-
-
For each |option| in
- |details|.{{PaymentDetailsBase/shippingOptions}}:
-
-
If the {{PaymentDetailsBase/shippingOptions}} member of
- |details| is present, and
- |request|.{{PaymentRequest/[[options]]}}.{{PaymentOptions/requestShipping}}
- is true, then:
-
-
Set
- |request|.{{PaymentRequest/[[details]]}}.{{PaymentDetailsBase/shippingOptions}}
- to |shippingOptions|.
-
-
Set the value of |request|'s
- {{PaymentRequest/shippingOption}} attribute to
- |selectedShippingOption|.
-
-
-
If the {{PaymentDetailsBase/modifiers}} member of
|details| is present, then:
@@ -4674,50 +2857,6 @@
-
-
- If
- |request|.{{PaymentRequest/[[options]]}}.{{PaymentOptions/requestShipping}}
- is true, and
- |request|.{{PaymentRequest/[[details]]}}.{{PaymentDetailsBase/shippingOptions}}
- is empty, then the developer has signified that there are
- no valid shipping options for the currently-chosen
- shipping address (given by |request|'s
- {{PaymentRequest/shippingAddress}}).
-
-
- In this case, the user agent SHOULD display an error
- indicating this, and MAY indicate that the
- currently-chosen shipping address is invalid in some way.
- The user agent SHOULD use the
- {{PaymentDetailsUpdate/error}} member of |details|, if it
- is present, to give more information about why there are
- no valid shipping options for that address.
-
-
- Further, if
- |details|["{{PaymentDetailsUpdate/shippingAddressErrors}}"]
- member is present, the user agent SHOULD display an error
- specifically for each erroneous field of the shipping
- address. This is done by matching each present member of
- the {{AddressErrors}} to a corresponding input field in
- the shown user interface.
-
-
- Similarly, if |details|["{{payerErrors}}"] member is
- present and |request|.{{PaymentRequest/[[options]]}}'s
- {{PaymentOptions/requestPayerName}},
- {{PaymentOptions/requestPayerEmail}}, or
- {{PaymentOptions/requestPayerPhone}} is true, then
- display an error specifically for each erroneous field.
-
-
- Likewise, if
- |details|.{{PaymentDetailsUpdate/paymentMethodErrors}} is
- present, then display errors specifically for each
- erroneous input field for the particular payment method.
-
-
@@ -4910,7 +3049,7 @@
The user agent MUST NOT share information about the user with
- a developer (e.g., the shipping address) without user consent.
+ a developer without user consent.
In particular, the {{PaymentMethodData}}'s {{PaymentMethodData/data}}
@@ -4945,22 +3084,8 @@
data shared via the {{PaymentMethodChangeEvent}}'s
{{PaymentMethodChangeEvent/methodDetails}} attribute. Requirements
and approaches for minimizing shared data are likely to vary by
- payment method and might include:
+ payment method.
Support for instructions from the payee identifying specific
- elements to exclude or include from the payment method
- response data (returned through {{PaymentResponse}}.|details|). The
- payee might provide these instructions via
- PaymentMethodData.|data|, enabling a payment method
- definition to evolve without requiring changes to the current API.
-
-
Where sharing of privacy-sensitive information might not be obvious
to users (e.g., when [=payment handler/payment method changed
@@ -5012,9 +3137,7 @@
For the user-facing aspects of Payment Request API, implementations
integrate with platform accessibility APIs via form controls and other
- input modalities. Furthermore, to increase the intelligibility of
- total, shipping addresses, and contact information, implementations
- format data according to system conventions.
+ input modalities.
@@ -5068,7 +3191,7 @@
way desired, so long as the end result is indistinguishable from the
result that would be obtained by the specification's algorithms.
-
+
User agents MAY impose implementation-specific limits on otherwise
unconstrained inputs, e.g., to prevent denial of service attacks, to
guard against running out of memory, or to work around
From 409ee8945b3141cbdc109c429b066959cbcc6ae9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20C=C3=A1ceres?=
Date: Thu, 20 May 2021 12:41:09 +1000
Subject: [PATCH 037/101] Editorial: clarification re: deriving doc language
(#956)
---
index.html | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/index.html b/index.html
index b7e82ec0..e7223056 100644
--- a/index.html
+++ b/index.html
@@ -907,17 +907,19 @@
SHOULD be presented using the language and locale-based
formatting that matches the |document|'s [=document
element|document element's=] [=Node/language=], if any, or an
- appropriate fallback locale if that is not available.
+ appropriate fallback if that is not available.