diff --git a/index.html b/index.html index 156fc1e0..5cb47c8c 100644 --- a/index.html +++ b/index.html @@ -399,10 +399,19 @@

PaymentRequest constructor

If the first character of details.total.amount.value is U+002D HYPHEN-MINUS, then throw a TypeError. total MUST be a non-negative amount. +
  • + If a payment method identifier appears more than once in the methodData + or details.modififiers sequences, then throw a TypeError. +
  • For each PaymentMethodData in methodData, if the data field is supplied but is not a JSON-serializable object, then throw a TypeError.
  • +
  • + For each PaymentDetailsModifier in details.modifiers, if the total field + is supplied and the first character of total.amount.value is U+002D HYPHEN-MINUS, then throw a + TypeError. total MUST be a non-negative amount. +
  • Let request be a new PaymentRequest.
  • Store methodData into request@[[\methodData]]. @@ -686,6 +695,7 @@

    PaymentDetails dictionary

    PaymentItem total; sequence<PaymentItem> displayItems; sequence<PaymentShippingOption> shippingOptions; + sequence<PaymentDetailsModifier> modifiers; }; @@ -739,6 +749,57 @@

    PaymentDetails dictionary

    will be fired for this option unless the user selects an alternative option first.

    +
    modifiers
    +
    + This sequence of PaymentDetailsModifier dictionaries contains modifiers + for particular payment method identifiers. For example, it allows you to adjust the total + amount based on payment method. +
    + + + +
    +

    PaymentDetailsModifier dictionary

    +
    +    dictionary PaymentDetailsModifier {
    +      required sequence<DOMString> supportedMethods;
    +      PaymentItem total;
    +      sequence<PaymentItem> additionalDisplayItems;
    +    };
    +  
    + +

    + The PaymentDetailsModifier dictionary provides details that modify the + PaymentDetails based on payment method identifier. It contains the + following fields: +

    + +
    +
    supportedMethods
    +
    + The supportedMethods field contains a sequence of payment method identifiers. + The remaining fields in the PaymentDetailsModifier apply only if the user selects + a payment method included in this sequence. +
    +
    total
    +
    + This PaymentItem value overrides the total field in the + PaymentDetails dictionary for the payment method identifiers + in the supportedMethods field. +
    +
    additionalDisplayItems
    +
    + This sequence of PaymentItem dictionaries provides additional display + items that are appended to the displayItems field in the PaymentDetails + dictionary for the payment method identifiers in the supportedMethods + field. This field 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. +

    + The user agent MAY validate that the total amount is the sum of the displayItems + and the additionalDisplayItems, but it is the responsibility of the calling code to ensure that. +

    +
    @@ -921,6 +982,7 @@

    PaymentResponse interface

    interface PaymentResponse { readonly attribute DOMString methodName; + readonly attribute PaymentCurrencyAmount totalAmount; readonly attribute object details; readonly attribute PaymentAddress? shippingAddress; readonly attribute DOMString? payerEmail; @@ -940,6 +1002,15 @@

    PaymentResponse interface

    The payment method identifier for the payment method that the user selected to fulfil the transaction. +
    totalAmount
    +
    + This is the amount value from the PaymentItem representing + the payment request total. This will either be the total.amount value from + the PaymentDetails dictionary for the payment request or it will + be the total.amount value from a PaymentDetailsModifier + matching the payment method identifier for the payment method that the user selected + to fulfil the transaction. +
    details
    A JSON-serializable object that provides a payment method specific message used by the merchant to @@ -1114,6 +1185,10 @@

    PaymentRequestUpdateEvent

    If details contains a displayItems value, then copy this value to the displayItems field of target@[[\details]].
  • +
  • + If details contains a modifiers value, then copy + this value to the modifiers field of target@[[\details]]. +
  • If details contains a shippingOptions sequence, then:
      @@ -1269,6 +1344,18 @@

      User accepts the payment request algorithm

      Set the methodName attribute value of response to the payment method identifier for the payment method that the user selected to accept the payment. +
    1. + Let amount be the total.amount value from request@[[\details]]. +
    2. +
    3. + If there is a PaymentDetailsModifier modifier in the modifiers sequence + in request@[[\details]] that matches the payment method identifier for the + payment method that the user selected to accept the payment, then let amount + be the total.amount value from modifier. +
    4. +
    5. + Set the totalAmount attribute value of response to amount. +
    6. Set the details attribute value of response to a JSON-serializable object containing the payment method specific message used by the merchant to process