diff --git a/index.html b/index.html index 2ce307fb..67eaee36 100644 --- a/index.html +++ b/index.html @@ -171,7 +171,7 @@

- A can make payment algorithm: + Steps to check if a payment can be made:
How a payment handler determines whether it, or the user, can @@ -184,7 +184,7 @@

Steps to respond to a payment request:
- An algorithm that returns an object or dictionary that a merchant uses to process or validate the transaction. The structure of this object is specific to each payment method. For an example of such an @@ -192,6 +192,15 @@

"payment-method-basic-card#dom-basiccardresponse">BasicCardResponse dictionary of [[payment-method-basic-card]].

+
+ Steps for when a user changes payment method (optional) +
+
+ Steps that describe how to handle the user changing payment method or + monetary instrument (e.g., from a debit card to a credit card) that + results in a dictionary or + object or null. +

This API also enables web sites to take advantage of more secure @@ -575,8 +584,8 @@

readonly attribute PaymentShippingType? shippingType; attribute EventHandler onshippingaddresschange; - attribute EventHandler onshippingoptionchange; + attribute EventHandler onpaymentmethodchange; };
@@ -997,8 +1006,8 @@

  • For each handler in registeredHandlers:
    1. Let canMakePayment be the result of running - handler's can make payment algorithm with - data. + handler's steps to check if a payment can be + made with data.
    2. If canMakePayment is true, then append handler to handlers. @@ -1218,8 +1227,8 @@

    3. For each handler in handlers:
      1. Let canMakePayment be the result of running - handler's can make payment algorithm with - data. + handler's steps to check if a payment can be + made with data.
      2. If canMakePayment is true, resolve promise with true, and return. @@ -1291,6 +1300,16 @@

        shippingoptionchange.

        +
        +

        + onpaymentmethodchange attribute +

        +

        + A PaymentRequest's onpaymentmethodchange attribute is + an EventHandler for a PaymentRequestUpdateEvent named + "paymentmethodchange". +

        +

        Internal Slots @@ -3401,8 +3420,80 @@

        The user chooses a new shipping option. + + + paymentmethodchange + + + PaymentMethodChangeEvent + + + The user chooses a different payment method within a + payment handler. + +

        +
        +

        + PaymentMethodChangeEvent interface +

        +
        +          [Constructor(DOMString type, optional PaymentMethodChangeEventInit eventInitDict), SecureContext, Exposed=Window]
        +          interface PaymentMethodChangeEvent : PaymentRequestUpdateEvent {
        +            readonly attribute DOMString methodName;
        +            readonly attribute object? methodDetails;
        +          };
        +        
        +
        +

        + methodDetails attribute +

        +

        + When getting, returns the value it was initialized with. See + 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 dictionary +

        +
        +            dictionary PaymentMethodChangeEventInit : PaymentRequestUpdateEventInit {
        +              required DOMString methodName;
        +              object? methodDetails;
        +            };
        +          
        +
        +
        + methodName member +
        +
        + A DOMString representing the payment method identifier. +
        +
        + methodDetails member +
        +
        + An object representing the some data from the payment method, or + null. +
        +
        +
        +

        @@ -3671,6 +3762,49 @@

      +
      +

      + Payment method changed algorithm +

      +

      + A payment handler MAY run the payment method changed + algorithm when the user changes payment method with + methodDetails, which is either dictionary or an object or null, and a methodName, + which is a DOMString that represents the payment method + identifier of the payment handler the user is interacting + with: +

      +
        +
      1. Let request be the PaymentRequest object that + the user is interacting with. +
      2. +
      3. + Queue a task on the user interaction task source to + run the following steps: +
          +
        1. If the request.[[\updating]] is true, then + terminate this algorithm and take no further action. Only one + update may take place at a time. The user agent SHOULD + ensure that this never occurs. +
        2. +
        3. If the request.[[\state]] is not set to + "interactive", then terminate this algorithm and take no + further action. The user agent user interface SHOULD + ensure that this never occurs. +
        4. +
        5. + Fire an event named "paymentmethodchange" at + request using PaymentMethodChangeEvent, with + its methodName attribute initialized to + methodName, and its methodDetails attribute + initialized to methodDetails. +
        6. +
        +
      4. +
      +

      PaymentRequest updated algorithm