diff --git a/index.html b/index.html index 9646b95..780dd57 100644 --- a/index.html +++ b/index.html @@ -1151,6 +1151,63 @@

+
+

+ The PaymentMethodChangeResponse +

+

+ The PaymentMethodChangeResponse contains the updated + total (optionally with modifiers) and possible errors resulting from + user selection of a payment method within a payment handler. +

+
+        dictionary PaymentMethodChangeResponse {
+          DOMString error;
+          PaymentCurrencyAmount total;
+          FrozenArray<PaymentDetailsModifier> modifiers;
+          object paymentMethodErrors;
+        };
+        
+
+

+ error member +

+

+ A human readable string that explains why the payment method cannot + be used. +

+
+
+

+ total member +

+

+ Updated total based on the changed payment method. The total can + change, for example, because the billing address of the payment + method selected by the user changes the Value Added Tax (VAT). +

+
+
+

+ modifiers member +

+

+ Updated modifiers based on the changed payment method. For example, + if the overall total has increased by €1.00 based on the billing + address, then the totals specified in each of the modifiers should + also increase by €1.00. +

+
+
+

+ paymentMethodErrors member +

+

+ Validation errors for the payment method, if any. +

+
+

@@ -1172,7 +1229,9 @@

readonly attribute object total; readonly attribute FrozenArray<PaymentDetailsModifier> modifiers; readonly attribute DOMString instrumentKey; + readonly attribute bool requestBillingAddress; Promise<WindowClient?> openWindow(USVString url); + Promise<PaymentMethodChangeResponse?> changePaymentMethod(DOMString methodName, optional object? methodDetails = null); void respondWith(Promise<PaymentHandlerResponse>handlerResponsePromise); }; @@ -1263,6 +1322,15 @@

PaymentInstrument.

+
+

+ requestBillingAddress attribute +

+

+ The value of PaymentOptions.requestBillingAddress + in the PaymentRequest. +

+

openWindow() method @@ -1272,6 +1340,18 @@

user. When called, it runs the open window algorithm.

+
+

+ changePaymentMethod() + method +

+

+ This method is used by the payment handler to get updated total + given such payment method details as the billing address. When + called, it runs the change payment method algorithm. +

+

+
+

+ Change Payment Method Algorithm +

+

+ When this algorithm is invoked with methodName and + methodDetails parameters, the user agent MUST run the + following steps: +

+
    +
  1. Run the payment method changed algorithm with + PaymentMethodChangeEvent event constructed using + the given methodName and methodDetails + parameters. +
  2. +
  3. If event.updateWith(detailsPromise) is not run, + return null. +
  4. +
  5. If event.updateWith(detailsPromise) throws, + rethrow the error. +
  6. +
  7. If event.updateWith(detailsPromise) times out + (optional), throw "InvalidStateError" DOMException. +
  8. +
  9. Construct and return a PaymentMethodChangeResponse from + the detailsPromise in + event.updateWith(detailsPromise). +
  10. +
+

Respond to PaymentRequest Algorithm @@ -2134,13 +2244,21 @@

"!payment-request#paymentdetailsinit-dictionary">paymentDetailsInit, PaymentMethodData, + PaymentOptions, + PaymentMethodChangeEvent, ID, canMakePayment(), - show(), and + show(), + updateWith(detailsPromise), user - accepts the payment request algorithm , payment method + changed algorithm, and JSON-serializable are defined by the Payment Request API specification [[!payment-request]].