From 8a9a044faf0ea2a25d08091dc1f790cdc0713373 Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Thu, 4 Jan 2024 17:09:44 +0800 Subject: [PATCH 01/21] updateWith method is defined on PaymentRequestUpdateEvent --- .../web/api/paymentrequest/paymentmethodchange_event/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/en-us/web/api/paymentrequest/paymentmethodchange_event/index.md b/files/en-us/web/api/paymentrequest/paymentmethodchange_event/index.md index b405a3992f9caf7..0426b4c01bfdf41 100644 --- a/files/en-us/web/api/paymentrequest/paymentmethodchange_event/index.md +++ b/files/en-us/web/api/paymentrequest/paymentmethodchange_event/index.md @@ -85,7 +85,7 @@ handlePaymentChange = (event) => { This begins by looking at the event's {{domxref("PaymentMethodChangeEvent.methodName", "methodName")}} property; if that indicates that the user is trying to use Apple Pay, we pass the {{domxref("PaymentMethodChangeEvent.methodDetails", "methodDetails")}} into a function called `calculateServiceFee()`, which we might create to take the information about the transaction, such as the underlying credit card being used to service the Apple Pay request, and compute and return an object that specifies changes to be applied to the {{domxref("PaymentRequest")}} in order to add any service fees that the payment method might require. -Before the event handler returns, it calls the event's {{domxref("PaymentMethodChangeEvent.updateWith()")}} method to integrate the changes into the request. +Before the event handler returns, it calls the event's {{domxref("PaymentRequestUpdateEvent.updateWith()", "updateWith()")}} method to integrate the changes into the request. ## Specifications From 9e5a453bae01fe0fa34ec35b8ffa1e3b23878eb4 Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Thu, 4 Jan 2024 17:10:03 +0800 Subject: [PATCH 02/21] PaymentInstrument is a non-standard dictionary --- files/en-us/web/api/paymentrequestevent/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/en-us/web/api/paymentrequestevent/index.md b/files/en-us/web/api/paymentrequestevent/index.md index 1b6b456d54bb83c..a1e0488c591db5a 100644 --- a/files/en-us/web/api/paymentrequestevent/index.md +++ b/files/en-us/web/api/paymentrequestevent/index.md @@ -21,7 +21,7 @@ The **`PaymentRequestEvent`** interface of the {{domxref("Payment Handler API", ## Instance properties - {{domxref("PaymentRequestEvent.instrumentKey","instrumentKey")}} {{ReadOnlyInline}} {{Deprecated_Inline}} {{Non-standard_Inline}} - - : Returns a {{domxref("PaymentInstrument")}} object reflecting the payment instrument selected by the user or an empty string if the user has not registered or chosen a payment instrument. + - : Returns a `PaymentInstrument` object reflecting the payment instrument selected by the user or an empty string if the user has not registered or chosen a payment instrument. - {{domxref("PaymentRequestEvent.methodData","methodData")}} {{ReadOnlyInline}} {{Experimental_Inline}} - : Returns an array of objects containing payment method identifiers for the payment methods that the website accepts and any associated payment method specific data. - {{domxref("PaymentRequestEvent.modifiers","modifiers")}} {{ReadOnlyInline}} {{Experimental_Inline}} From 1f488a8130308f974df5947cdf45c2725cac38e1 Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Thu, 4 Jan 2024 17:15:16 +0800 Subject: [PATCH 03/21] payerdetailchange event is on PaymentResponse --- .../web/api/paymentrequest/merchantvalidation_event/index.md | 2 +- .../web/api/paymentrequest/paymentmethodchange_event/index.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/files/en-us/web/api/paymentrequest/merchantvalidation_event/index.md b/files/en-us/web/api/paymentrequest/merchantvalidation_event/index.md index 18cad439011b1b4..e46440ee4ba14be 100644 --- a/files/en-us/web/api/paymentrequest/merchantvalidation_event/index.md +++ b/files/en-us/web/api/paymentrequest/merchantvalidation_event/index.md @@ -88,7 +88,7 @@ For more information, see [Merchant validation](/en-US/docs/Web/API/Payment_Requ - `onmerchantvalidation` event handler property - [Merchant validation](/en-US/docs/Web/API/Payment_Request_API/Concepts#merchant_validation) - {{domxref("PaymentRequest")}} -- {{domxref("PaymentRequest.payerdetailchange_event", "payerdetailchange")}} event +- {{domxref("PaymentResponse.payerdetailchange_event", "payerdetailchange")}} event - {{domxref("PaymentRequest.paymentmethodchange_event", "paymentmethodchange")}} event - {{domxref("PaymentRequest.shippingaddresschange_event", "shippingaddresschange")}} event - {{domxref("PaymentRequest.shippingoptionchange_event", "shippingoptionchange")}} event diff --git a/files/en-us/web/api/paymentrequest/paymentmethodchange_event/index.md b/files/en-us/web/api/paymentrequest/paymentmethodchange_event/index.md index 0426b4c01bfdf41..8de1a360e9962df 100644 --- a/files/en-us/web/api/paymentrequest/paymentmethodchange_event/index.md +++ b/files/en-us/web/api/paymentrequest/paymentmethodchange_event/index.md @@ -100,6 +100,6 @@ Before the event handler returns, it calls the event's {{domxref("PaymentRequest - [Payment Request API](/en-US/docs/Web/API/Payment_Request_API) - [Using the Payment Request API](/en-US/docs/Web/API/Payment_Request_API/Using_the_Payment_Request_API) - {{domxref("PaymentRequest.merchantvalidation_event", "merchantvalidation")}} event -- {{domxref("PaymentRequest.payerdetailchange_event", "payerdetailchange")}} event +- {{domxref("PaymentResponse.payerdetailchange_event", "payerdetailchange")}} event - {{domxref("PaymentRequest.shippingaddresschange_event", "shippingaddresschange")}} event - {{domxref("PaymentRequest.shippingoptionchange_event", "shippingoptionchange")}} event From 715eff6f3a8981d4819b9cf321a3ba57bfa46ae8 Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Thu, 4 Jan 2024 17:24:44 +0800 Subject: [PATCH 04/21] PaymentShippingOption is a non-standard dictionary --- .../web/api/paymentrequest/paymentmethodchange_event/index.md | 2 +- files/en-us/web/api/paymentrequest/show/index.md | 2 +- .../en-us/web/api/paymentrequestupdateevent/updatewith/index.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/files/en-us/web/api/paymentrequest/paymentmethodchange_event/index.md b/files/en-us/web/api/paymentrequest/paymentmethodchange_event/index.md index 8de1a360e9962df..0dd1ea1cc04794d 100644 --- a/files/en-us/web/api/paymentrequest/paymentmethodchange_event/index.md +++ b/files/en-us/web/api/paymentrequest/paymentmethodchange_event/index.md @@ -43,7 +43,7 @@ _In addition to the properties below, this interface includes properties inherit Let's take a look at an example. This code creates a new {{domxref("PaymentRequest")}}, adds a handler for the `paymentmethodchange` event by calling the request's {{domxref("EventTarget.addEventListener", "addEventListener()")}}, then calls {{domxref("PaymentRequest.show", "show()")}} to present the payment interface to the user. -The code assumes the existence of a method `detailsForShipping()`, which returns an object containing the shipping options for the `ground` shipping method, in the form found in the {{domxref("PaymentShippingOption")}} dictionary. By doing so, the payment form defaults to the ground shipping method. +The code assumes the existence of a method `detailsForShipping()`, which returns an object containing the shipping options for the `ground` shipping method, in the form found in the `PaymentShippingOption` dictionary. By doing so, the payment form defaults to the ground shipping method. ```js const options = { diff --git a/files/en-us/web/api/paymentrequest/show/index.md b/files/en-us/web/api/paymentrequest/show/index.md index cfb847cdc0e5220..63fdddb525c1eb3 100644 --- a/files/en-us/web/api/paymentrequest/show/index.md +++ b/files/en-us/web/api/paymentrequest/show/index.md @@ -76,7 +76,7 @@ show(detailsPromise) - `shippingAddressErrors` {{optional_inline}} {{deprecated_inline}} - : An {{domxref("AddressErrors")}} object which includes an error message for each property of the shipping address that could not be validated. - `shippingOptions` {{optional_inline}} - - : An array of {{domxref("PaymentShippingOption")}} objects, each describing one available shipping option from which the user may choose. + - : An array of objects, each describing one available shipping option from which the user may choose. - `total` {{optional_inline}} - : An object with the same properties as the objects in `displayItems` providing an updated total for the payment. Make sure this equals the sum of all of the items in `displayItems`. _This is not calculated automatically_. You must update this value yourself anytime the total amount due changes. This lets you have flexibility for how to handle things like tax, discounts, and other adjustments to the total price charged. diff --git a/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md b/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md index c898dccd26e700f..e394b14c285eacb 100644 --- a/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md +++ b/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md @@ -46,7 +46,7 @@ updateWith(details) - `shippingAddressErrors` {{optional_inline}} {{deprecated_inline}} - : An {{domxref("AddressErrors")}} object which includes an error message for each property of the shipping address that could not be validated. - `shippingOptions` {{optional_inline}} - - : An array of {{domxref("PaymentShippingOption")}} objects, each describing one available shipping option from which the user may choose. + - : An array of objects, each describing one available shipping option from which the user may choose. - `total` {{optional_inline}} - : An object with the same properties as the objects in `displayItems` providing an updated total for the payment. Make sure this equals the sum of all of the items in `displayItems`. _This is not calculated automatically_. You must update this value yourself anytime the total amount due changes. This lets you have flexibility for how to handle things like tax, discounts, and other adjustments to the total price charged. From 2d6107c39dd27b4e134a1caf9711739c3e7eaee3 Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Thu, 4 Jan 2024 17:26:19 +0800 Subject: [PATCH 05/21] PaymentDetailsModifier is a dictionary --- files/en-us/web/api/paymentrequest/show/index.md | 2 +- .../api/paymentrequestevent/changepaymentmethod/index.md | 2 +- files/en-us/web/api/paymentrequestevent/modifiers/index.md | 6 +++--- .../web/api/paymentrequestupdateevent/updatewith/index.md | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/files/en-us/web/api/paymentrequest/show/index.md b/files/en-us/web/api/paymentrequest/show/index.md index 63fdddb525c1eb3..c956318337d66ef 100644 --- a/files/en-us/web/api/paymentrequest/show/index.md +++ b/files/en-us/web/api/paymentrequest/show/index.md @@ -72,7 +72,7 @@ show(detailsPromise) - `error` {{optional_inline}} {{deprecated_inline}} - : A string specifying an error message to present to the user*.* When calling {{domxref("PaymentRequestUpdateEvent.updateWith", "updateWith()")}}, including `error` in the updated data causes the {{Glossary("user agent")}} to display the text as a general error message. For address field specific errors, use `shippingAddressErrors`. - `modifiers` {{optional_inline}} - - : An array of {{domxref("PaymentDetailsModifier")}} objects, each describing a modifier for particular payment method identifiers. For example, you can use one to adjust the total payment amount based on the selected payment method ("5% cash discount!"). + - : An array of objects, each describing a modifier for particular payment method identifiers. For example, you can use one to adjust the total payment amount based on the selected payment method ("5% cash discount!"). - `shippingAddressErrors` {{optional_inline}} {{deprecated_inline}} - : An {{domxref("AddressErrors")}} object which includes an error message for each property of the shipping address that could not be validated. - `shippingOptions` {{optional_inline}} diff --git a/files/en-us/web/api/paymentrequestevent/changepaymentmethod/index.md b/files/en-us/web/api/paymentrequestevent/changepaymentmethod/index.md index 14eafa75857b139..36147c10678c284 100644 --- a/files/en-us/web/api/paymentrequestevent/changepaymentmethod/index.md +++ b/files/en-us/web/api/paymentrequestevent/changepaymentmethod/index.md @@ -37,7 +37,7 @@ A {{jsxref("Promise")}} that resolves with a `PaymentRequestDetailsUpdate` objec - `total` - : An 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 applicable sales tax. - `modifiers` - - : An array of [`PaymentDetailsModifier`](https://www.w3.org/TR/payment-request/#paymentdetailsmodifier-dictionary) objects. + - : An array of objects containing modifiers for payment details. - `paymentMethodErrors` - : An object containing validation errors for the payment method, if any. diff --git a/files/en-us/web/api/paymentrequestevent/modifiers/index.md b/files/en-us/web/api/paymentrequestevent/modifiers/index.md index d0a7ecb4bba0662..f898e763f819634 100644 --- a/files/en-us/web/api/paymentrequestevent/modifiers/index.md +++ b/files/en-us/web/api/paymentrequestevent/modifiers/index.md @@ -11,14 +11,14 @@ browser-compat: api.PaymentRequestEvent.modifiers {{SeeCompatTable}}{{APIRef("Payment Handler API")}} The **`modifiers`** read-only property of the -{{domxref("PaymentRequestEvent")}} interface returns an array of `PaymentDetailsModifier` objects containing modifiers for payment details. +{{domxref("PaymentRequestEvent")}} interface returns an array of objects containing modifiers for payment details. ## Value -An array of `PaymentDetailsModifier` objects containing modifiers for payment details. These objects contain the following properties: +An array of objects containing modifiers for payment details. These objects contain the following properties: - `supportedMethods` - - : A payment method identifier. The members of the `PaymentDetailsModifier` object only apply to the payment if the user selects this payment method. + - : A payment method identifier. The members of the object only apply to the payment if the user selects this payment method. - `total` - : A `PaymentItem` object containing the following properties: - `label` diff --git a/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md b/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md index e394b14c285eacb..2d591d61a485c01 100644 --- a/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md +++ b/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md @@ -42,7 +42,7 @@ updateWith(details) - `error` {{optional_inline}} {{deprecated_inline}} - : A string specifying an error message to present to the user*.* When calling `updateWith()`, including `error` in the updated data causes the {{Glossary("user agent")}} to display the text as a general error message. For address field specific errors, use `shippingAddressErrors`. - `modifiers` {{optional_inline}} - - : An array of {{domxref("PaymentDetailsModifier")}} objects, each describing a modifier for particular payment method identifiers. For example, you can use one to adjust the total payment amount based on the selected payment method ("5% cash discount!"). + - : An array of objects, each describing a modifier for particular payment method identifiers. For example, you can use one to adjust the total payment amount based on the selected payment method ("5% cash discount!"). - `shippingAddressErrors` {{optional_inline}} {{deprecated_inline}} - : An {{domxref("AddressErrors")}} object which includes an error message for each property of the shipping address that could not be validated. - `shippingOptions` {{optional_inline}} From b558a346c54a73a797775b0fe28b9eb32eefd348 Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Thu, 4 Jan 2024 17:27:38 +0800 Subject: [PATCH 06/21] AddressErrors is a dictionary --- files/en-us/web/api/paymentrequest/show/index.md | 2 +- .../en-us/web/api/paymentrequestupdateevent/updatewith/index.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/files/en-us/web/api/paymentrequest/show/index.md b/files/en-us/web/api/paymentrequest/show/index.md index c956318337d66ef..ae50098fffa1b37 100644 --- a/files/en-us/web/api/paymentrequest/show/index.md +++ b/files/en-us/web/api/paymentrequest/show/index.md @@ -74,7 +74,7 @@ show(detailsPromise) - `modifiers` {{optional_inline}} - : An array of objects, each describing a modifier for particular payment method identifiers. For example, you can use one to adjust the total payment amount based on the selected payment method ("5% cash discount!"). - `shippingAddressErrors` {{optional_inline}} {{deprecated_inline}} - - : An {{domxref("AddressErrors")}} object which includes an error message for each property of the shipping address that could not be validated. + - : An object which includes an error message for each property of the shipping address that could not be validated. - `shippingOptions` {{optional_inline}} - : An array of objects, each describing one available shipping option from which the user may choose. - `total` {{optional_inline}} diff --git a/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md b/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md index 2d591d61a485c01..931a17a80d8b719 100644 --- a/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md +++ b/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md @@ -44,7 +44,7 @@ updateWith(details) - `modifiers` {{optional_inline}} - : An array of objects, each describing a modifier for particular payment method identifiers. For example, you can use one to adjust the total payment amount based on the selected payment method ("5% cash discount!"). - `shippingAddressErrors` {{optional_inline}} {{deprecated_inline}} - - : An {{domxref("AddressErrors")}} object which includes an error message for each property of the shipping address that could not be validated. + - : An object which includes an error message for each property of the shipping address that could not be validated. - `shippingOptions` {{optional_inline}} - : An array of objects, each describing one available shipping option from which the user may choose. - `total` {{optional_inline}} From c82c605f8a9f15a63887a51f34b2c23aac9fa626 Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Thu, 4 Jan 2024 17:29:51 +0800 Subject: [PATCH 07/21] the two methods are on PaymentResponse --- files/en-us/web/api/paymentrequest/show/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/en-us/web/api/paymentrequest/show/index.md b/files/en-us/web/api/paymentrequest/show/index.md index ae50098fffa1b37..b7f27d2feb1526b 100644 --- a/files/en-us/web/api/paymentrequest/show/index.md +++ b/files/en-us/web/api/paymentrequest/show/index.md @@ -316,6 +316,6 @@ document.getElementById("buyButton").onclick = requestPayment; - [Payment Request API](/en-US/docs/Web/API/Payment_Request_API) - [Using the Payment Request API](/en-US/docs/Web/API/Payment_Request_API/Using_the_Payment_Request_API) - {{domxref('PaymentRequest.abort()')}} -- {{domxref("PaymentRequest.retry()")}} -- {{domxref("PaymentRequest.complete()")}} - {{domxref("PaymentResponse")}} +- {{domxref("PaymentResponse.retry()")}} +- {{domxref("PaymentResponse.complete()")}} From d791c10f2484551214fcd842b0d7933e1ed52f08 Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Wed, 10 Jan 2024 01:43:33 +0800 Subject: [PATCH 08/21] remove links of payerdetailchange event --- .../web/api/paymentrequest/merchantvalidation_event/index.md | 2 -- .../web/api/paymentrequest/paymentmethodchange_event/index.md | 1 - 2 files changed, 3 deletions(-) diff --git a/files/en-us/web/api/paymentrequest/merchantvalidation_event/index.md b/files/en-us/web/api/paymentrequest/merchantvalidation_event/index.md index e46440ee4ba14be..33a8a1660fb8569 100644 --- a/files/en-us/web/api/paymentrequest/merchantvalidation_event/index.md +++ b/files/en-us/web/api/paymentrequest/merchantvalidation_event/index.md @@ -87,8 +87,6 @@ For more information, see [Merchant validation](/en-US/docs/Web/API/Payment_Requ - [Using the Payment Request API](/en-US/docs/Web/API/Payment_Request_API/Using_the_Payment_Request_API) - `onmerchantvalidation` event handler property - [Merchant validation](/en-US/docs/Web/API/Payment_Request_API/Concepts#merchant_validation) -- {{domxref("PaymentRequest")}} -- {{domxref("PaymentResponse.payerdetailchange_event", "payerdetailchange")}} event - {{domxref("PaymentRequest.paymentmethodchange_event", "paymentmethodchange")}} event - {{domxref("PaymentRequest.shippingaddresschange_event", "shippingaddresschange")}} event - {{domxref("PaymentRequest.shippingoptionchange_event", "shippingoptionchange")}} event diff --git a/files/en-us/web/api/paymentrequest/paymentmethodchange_event/index.md b/files/en-us/web/api/paymentrequest/paymentmethodchange_event/index.md index 0dd1ea1cc04794d..634ddfbed7afa74 100644 --- a/files/en-us/web/api/paymentrequest/paymentmethodchange_event/index.md +++ b/files/en-us/web/api/paymentrequest/paymentmethodchange_event/index.md @@ -100,6 +100,5 @@ Before the event handler returns, it calls the event's {{domxref("PaymentRequest - [Payment Request API](/en-US/docs/Web/API/Payment_Request_API) - [Using the Payment Request API](/en-US/docs/Web/API/Payment_Request_API/Using_the_Payment_Request_API) - {{domxref("PaymentRequest.merchantvalidation_event", "merchantvalidation")}} event -- {{domxref("PaymentResponse.payerdetailchange_event", "payerdetailchange")}} event - {{domxref("PaymentRequest.shippingaddresschange_event", "shippingaddresschange")}} event - {{domxref("PaymentRequest.shippingoptionchange_event", "shippingoptionchange")}} event From 35fc71f8b1c6c82a9ff9d27322d16d3d415cfff2 Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Wed, 10 Jan 2024 02:15:21 +0800 Subject: [PATCH 09/21] update details for PaymentDetailsModifier --- files/en-us/web/api/paymentrequest/show/index.md | 16 +++++++++++++++- .../changepaymentmethod/index.md | 13 ++++++++++++- .../updatewith/index.md | 16 +++++++++++++++- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/files/en-us/web/api/paymentrequest/show/index.md b/files/en-us/web/api/paymentrequest/show/index.md index b7f27d2feb1526b..3cb725cd7255246 100644 --- a/files/en-us/web/api/paymentrequest/show/index.md +++ b/files/en-us/web/api/paymentrequest/show/index.md @@ -71,8 +71,22 @@ show(detailsPromise) - `error` {{optional_inline}} {{deprecated_inline}} - : A string specifying an error message to present to the user*.* When calling {{domxref("PaymentRequestUpdateEvent.updateWith", "updateWith()")}}, including `error` in the updated data causes the {{Glossary("user agent")}} to display the text as a general error message. For address field specific errors, use `shippingAddressErrors`. + - `modifiers` {{optional_inline}} - - : An array of objects, each describing a modifier for particular payment method identifiers. For example, you can use one to adjust the total payment amount based on the selected payment method ("5% cash discount!"). + + - : An array of objects, each describing a modifier for particular payment method identifiers, each with the following properties: + + - `supportedMethods` + - : A string that represents the payment method identifier. The payment method identifier only applies if the user selects this payment method. + - `total` {{optional_inline}} + - : An object that overrides the `total` property of the `detailsPromise` parameter if this payment method is selected by the user. The property takes the same input with the `total` property of the `detailsPromise` parameter. + - `additionalDisplayItems` {{optional_inline}} + - : An {{jsxref("Array")}} of objects provide additional display items that are appended to the `displayItems` property of the `detailsPromise` parameter if this payment method is selected by the user. This property 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 property takes the same input with the `displayItems` property of the `detailsPromise` parameter. + - `data` {{optional_inline}} + - : A serializable object that provides optional information that might be needed by the supported payment methods. + + For example, you can use one to adjust the total payment amount based on the selected payment method ("5% cash discount!"). + - `shippingAddressErrors` {{optional_inline}} {{deprecated_inline}} - : An object which includes an error message for each property of the shipping address that could not be validated. - `shippingOptions` {{optional_inline}} diff --git a/files/en-us/web/api/paymentrequestevent/changepaymentmethod/index.md b/files/en-us/web/api/paymentrequestevent/changepaymentmethod/index.md index 36147c10678c284..63309012be9ac4f 100644 --- a/files/en-us/web/api/paymentrequestevent/changepaymentmethod/index.md +++ b/files/en-us/web/api/paymentrequestevent/changepaymentmethod/index.md @@ -37,7 +37,18 @@ A {{jsxref("Promise")}} that resolves with a `PaymentRequestDetailsUpdate` objec - `total` - : An 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 applicable sales tax. - `modifiers` - - : An array of objects containing modifiers for payment details. + + - : An {{jsxref("Array")}} of objects containing modifiers for payment details, each with the following properties: + + - `supportedMethods` + - : A string that represents the payment method identifier. The members of the object only apply to the payment if the user selects this payment method. + - `total` {{optional_inline}} + - : An object that overrides the `total` property of the `detailsPromise` parameter if this payment method is selected by the user. The property takes the same input with the `total` property of the `detailsPromise` parameter. + - `additionalDisplayItems` {{optional_inline}} + - : An {{jsxref("Array")}} of objects provide additional display items that are appended to the `displayItems` property of the `detailsPromise` parameter if this payment method is selected by the user. This property 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 property takes the same input with the `displayItems` property of the `detailsPromise` parameter. + - `data` {{optional_inline}} + - : A serializable object that provides optional information that might be needed by the supported payment methods. + - `paymentMethodErrors` - : An object containing validation errors for the payment method, if any. diff --git a/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md b/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md index 931a17a80d8b719..2353235ba321628 100644 --- a/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md +++ b/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md @@ -41,8 +41,22 @@ updateWith(details) - `error` {{optional_inline}} {{deprecated_inline}} - : A string specifying an error message to present to the user*.* When calling `updateWith()`, including `error` in the updated data causes the {{Glossary("user agent")}} to display the text as a general error message. For address field specific errors, use `shippingAddressErrors`. + - `modifiers` {{optional_inline}} - - : An array of objects, each describing a modifier for particular payment method identifiers. For example, you can use one to adjust the total payment amount based on the selected payment method ("5% cash discount!"). + + - : An array of objects, each describing a modifier for particular payment method identifiers, each with the following properties: + + - `supportedMethods` + - : A string that represents the payment method identifier. The payment method identifier only applies if the user selects this payment method. + - `total` {{optional_inline}} + - : An object that overrides the `total` property of the `detailsPromise` parameter if this payment method is selected by the user. The property takes the same input with the `total` property of the `detailsPromise` parameter. + - `additionalDisplayItems` {{optional_inline}} + - : An {{jsxref("Array")}} of objects provide additional display items that are appended to the `displayItems` property of the `detailsPromise` parameter if this payment method is selected by the user. This property 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 property takes the same input with the `displayItems` property of the `detailsPromise` parameter. + - `data` {{optional_inline}} + - : A serializable object that provides optional information that might be needed by the supported payment methods. + + For example, you can use one to adjust the total payment amount based on the selected payment method ("5% cash discount!"). + - `shippingAddressErrors` {{optional_inline}} {{deprecated_inline}} - : An object which includes an error message for each property of the shipping address that could not be validated. - `shippingOptions` {{optional_inline}} From 5ccbb3a7b0372da40e9bc88cd338f81213bc0689 Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Wed, 10 Jan 2024 02:20:09 +0800 Subject: [PATCH 10/21] add . --- .../paymentrequestupdateevent/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/en-us/web/api/paymentrequestupdateevent/paymentrequestupdateevent/index.md b/files/en-us/web/api/paymentrequestupdateevent/paymentrequestupdateevent/index.md index af0da8b7f48725f..d54f8b42189ab57 100644 --- a/files/en-us/web/api/paymentrequestupdateevent/paymentrequestupdateevent/index.md +++ b/files/en-us/web/api/paymentrequestupdateevent/paymentrequestupdateevent/index.md @@ -26,7 +26,7 @@ None. ### Return value -A new `PaymentRequestUpdateEvent` +A new `PaymentRequestUpdateEvent`. ## Specifications From f15159f54435e7560819d416e25cc932fe9cc442 Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Wed, 10 Jan 2024 02:23:15 +0800 Subject: [PATCH 11/21] remove mention of PaymentInstrument --- files/en-us/web/api/paymentrequestevent/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/en-us/web/api/paymentrequestevent/index.md b/files/en-us/web/api/paymentrequestevent/index.md index a1e0488c591db5a..07185ef9952dcf5 100644 --- a/files/en-us/web/api/paymentrequestevent/index.md +++ b/files/en-us/web/api/paymentrequestevent/index.md @@ -21,7 +21,7 @@ The **`PaymentRequestEvent`** interface of the {{domxref("Payment Handler API", ## Instance properties - {{domxref("PaymentRequestEvent.instrumentKey","instrumentKey")}} {{ReadOnlyInline}} {{Deprecated_Inline}} {{Non-standard_Inline}} - - : Returns a `PaymentInstrument` object reflecting the payment instrument selected by the user or an empty string if the user has not registered or chosen a payment instrument. + - : Returns an object reflecting the payment instrument selected by the user or an empty string if the user has not registered or chosen a payment instrument. - {{domxref("PaymentRequestEvent.methodData","methodData")}} {{ReadOnlyInline}} {{Experimental_Inline}} - : Returns an array of objects containing payment method identifiers for the payment methods that the website accepts and any associated payment method specific data. - {{domxref("PaymentRequestEvent.modifiers","modifiers")}} {{ReadOnlyInline}} {{Experimental_Inline}} From eeee67d18ff7dc5188ad0ea59ed54f1f34581154 Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Wed, 10 Jan 2024 02:31:49 +0800 Subject: [PATCH 12/21] add {{non-standard_inline}} for shippingAddressErrors & error param of PaymentRequest.show & PaymentRequestUpdateEvent.updateWith --- files/en-us/web/api/paymentrequest/show/index.md | 4 ++-- .../web/api/paymentrequestupdateevent/updatewith/index.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/files/en-us/web/api/paymentrequest/show/index.md b/files/en-us/web/api/paymentrequest/show/index.md index 3cb725cd7255246..6aa16399d24fe43 100644 --- a/files/en-us/web/api/paymentrequest/show/index.md +++ b/files/en-us/web/api/paymentrequest/show/index.md @@ -69,7 +69,7 @@ show(detailsPromise) - `pending` - : A Boolean value which is `true` if the specified `amount` has not yet been finalized. This can be used to show items such as shipping or tax amounts that depend upon the selection of shipping address, shipping option, or so forth. The user agent may show this information but is not required to do so. - - `error` {{optional_inline}} {{deprecated_inline}} + - `error` {{optional_inline}} {{deprecated_inline}} {{non-standard_inline}} - : A string specifying an error message to present to the user*.* When calling {{domxref("PaymentRequestUpdateEvent.updateWith", "updateWith()")}}, including `error` in the updated data causes the {{Glossary("user agent")}} to display the text as a general error message. For address field specific errors, use `shippingAddressErrors`. - `modifiers` {{optional_inline}} @@ -87,7 +87,7 @@ show(detailsPromise) For example, you can use one to adjust the total payment amount based on the selected payment method ("5% cash discount!"). - - `shippingAddressErrors` {{optional_inline}} {{deprecated_inline}} + - `shippingAddressErrors` {{optional_inline}} {{deprecated_inline}} {{non-standard_inline}} - : An object which includes an error message for each property of the shipping address that could not be validated. - `shippingOptions` {{optional_inline}} - : An array of objects, each describing one available shipping option from which the user may choose. diff --git a/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md b/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md index 2353235ba321628..dd5594bf3ce77bb 100644 --- a/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md +++ b/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md @@ -39,7 +39,7 @@ updateWith(details) - `pending` - : A Boolean value which is `true` if the specified `amount` has not yet been finalized. This can be used to show items such as shipping or tax amounts that depend upon the selection of shipping address, shipping option, or so forth. The user agent may show this information but is not required to do so. - - `error` {{optional_inline}} {{deprecated_inline}} + - `error` {{optional_inline}} {{deprecated_inline}} {{non-standard_inline}} - : A string specifying an error message to present to the user*.* When calling `updateWith()`, including `error` in the updated data causes the {{Glossary("user agent")}} to display the text as a general error message. For address field specific errors, use `shippingAddressErrors`. - `modifiers` {{optional_inline}} @@ -57,7 +57,7 @@ updateWith(details) For example, you can use one to adjust the total payment amount based on the selected payment method ("5% cash discount!"). - - `shippingAddressErrors` {{optional_inline}} {{deprecated_inline}} + - `shippingAddressErrors` {{optional_inline}} {{deprecated_inline}} {{non-standard_inline}} - : An object which includes an error message for each property of the shipping address that could not be validated. - `shippingOptions` {{optional_inline}} - : An array of objects, each describing one available shipping option from which the user may choose. From 50886bd49f849670311ffb68003dd19963b22ece Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Wed, 10 Jan 2024 02:33:17 +0800 Subject: [PATCH 13/21] add {{deprecated_inline}} & {{non-standard_inline}} to `shippingOptions` of PaymentRequest.show & PaymentRequestUpdateEvent.updateWith --- files/en-us/web/api/paymentrequest/show/index.md | 2 +- .../en-us/web/api/paymentrequestupdateevent/updatewith/index.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/files/en-us/web/api/paymentrequest/show/index.md b/files/en-us/web/api/paymentrequest/show/index.md index 6aa16399d24fe43..4b0098fb6f1ba04 100644 --- a/files/en-us/web/api/paymentrequest/show/index.md +++ b/files/en-us/web/api/paymentrequest/show/index.md @@ -89,7 +89,7 @@ show(detailsPromise) - `shippingAddressErrors` {{optional_inline}} {{deprecated_inline}} {{non-standard_inline}} - : An object which includes an error message for each property of the shipping address that could not be validated. - - `shippingOptions` {{optional_inline}} + - `shippingOptions` {{optional_inline}} {{deprecated_inline}} {{non-standard_inline}} - : An array of objects, each describing one available shipping option from which the user may choose. - `total` {{optional_inline}} - : An object with the same properties as the objects in `displayItems` providing an updated total for the payment. Make sure this equals the sum of all of the items in `displayItems`. _This is not calculated automatically_. You must update this value yourself anytime the total amount due changes. This lets you have flexibility for how to handle things like tax, discounts, and other adjustments to the total price charged. diff --git a/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md b/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md index dd5594bf3ce77bb..824e8d476961012 100644 --- a/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md +++ b/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md @@ -59,7 +59,7 @@ updateWith(details) - `shippingAddressErrors` {{optional_inline}} {{deprecated_inline}} {{non-standard_inline}} - : An object which includes an error message for each property of the shipping address that could not be validated. - - `shippingOptions` {{optional_inline}} + - `shippingOptions` {{optional_inline}} {{deprecated_inline}} {{non-standard_inline}} - : An array of objects, each describing one available shipping option from which the user may choose. - `total` {{optional_inline}} - : An object with the same properties as the objects in `displayItems` providing an updated total for the payment. Make sure this equals the sum of all of the items in `displayItems`. _This is not calculated automatically_. You must update this value yourself anytime the total amount due changes. This lets you have flexibility for how to handle things like tax, discounts, and other adjustments to the total price charged. From 3329e270f63a8dd7d518105666a7827641416ba8 Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Wed, 10 Jan 2024 02:48:12 +0800 Subject: [PATCH 14/21] update example of PaymentRequest.paymentmethodchange_event --- .../api/paymentrequest/paymentmethodchange_event/index.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/files/en-us/web/api/paymentrequest/paymentmethodchange_event/index.md b/files/en-us/web/api/paymentrequest/paymentmethodchange_event/index.md index 634ddfbed7afa74..8bdf7ac42da38f7 100644 --- a/files/en-us/web/api/paymentrequest/paymentmethodchange_event/index.md +++ b/files/en-us/web/api/paymentrequest/paymentmethodchange_event/index.md @@ -43,17 +43,12 @@ _In addition to the properties below, this interface includes properties inherit Let's take a look at an example. This code creates a new {{domxref("PaymentRequest")}}, adds a handler for the `paymentmethodchange` event by calling the request's {{domxref("EventTarget.addEventListener", "addEventListener()")}}, then calls {{domxref("PaymentRequest.show", "show()")}} to present the payment interface to the user. -The code assumes the existence of a method `detailsForShipping()`, which returns an object containing the shipping options for the `ground` shipping method, in the form found in the `PaymentShippingOption` dictionary. By doing so, the payment form defaults to the ground shipping method. +The code assumes the existence of a method `detailsForShipping()`, which will return an object provides information about the requested transaction. ```js -const options = { - requestShipping: true, -}; - const paymentRequest = new PaymentRequest( paymentMethods, detailsForShipping("ground"), - options, ); paymentRequest.addEventListener( From f2a9a902f1dc69cd4b212f1c6121f128d7efc376 Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Wed, 10 Jan 2024 12:38:21 +0800 Subject: [PATCH 15/21] fix lint error --- files/en-us/web/api/paymentrequest/show/index.md | 1 + .../en-us/web/api/paymentrequestupdateevent/updatewith/index.md | 1 + 2 files changed, 2 insertions(+) diff --git a/files/en-us/web/api/paymentrequest/show/index.md b/files/en-us/web/api/paymentrequest/show/index.md index 4b0098fb6f1ba04..b46a27ee3ce8097 100644 --- a/files/en-us/web/api/paymentrequest/show/index.md +++ b/files/en-us/web/api/paymentrequest/show/index.md @@ -70,6 +70,7 @@ show(detailsPromise) - : A Boolean value which is `true` if the specified `amount` has not yet been finalized. This can be used to show items such as shipping or tax amounts that depend upon the selection of shipping address, shipping option, or so forth. The user agent may show this information but is not required to do so. - `error` {{optional_inline}} {{deprecated_inline}} {{non-standard_inline}} + - : A string specifying an error message to present to the user*.* When calling {{domxref("PaymentRequestUpdateEvent.updateWith", "updateWith()")}}, including `error` in the updated data causes the {{Glossary("user agent")}} to display the text as a general error message. For address field specific errors, use `shippingAddressErrors`. - `modifiers` {{optional_inline}} diff --git a/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md b/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md index 824e8d476961012..dd60e1457a94048 100644 --- a/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md +++ b/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md @@ -40,6 +40,7 @@ updateWith(details) - : A Boolean value which is `true` if the specified `amount` has not yet been finalized. This can be used to show items such as shipping or tax amounts that depend upon the selection of shipping address, shipping option, or so forth. The user agent may show this information but is not required to do so. - `error` {{optional_inline}} {{deprecated_inline}} {{non-standard_inline}} + - : A string specifying an error message to present to the user*.* When calling `updateWith()`, including `error` in the updated data causes the {{Glossary("user agent")}} to display the text as a general error message. For address field specific errors, use `shippingAddressErrors`. - `modifiers` {{optional_inline}} From 4ad26ee5a235d29b569c4e792a2b3162a2a13418 Mon Sep 17 00:00:00 2001 From: skyclouds2001 <95597335+skyclouds2001@users.noreply.github.com> Date: Wed, 10 Jan 2024 16:46:36 +0800 Subject: [PATCH 16/21] Update files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md Co-authored-by: Jean-Yves Perrier --- .../en-us/web/api/paymentrequestupdateevent/updatewith/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md b/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md index dd60e1457a94048..f5dc855709faa7e 100644 --- a/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md +++ b/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md @@ -41,7 +41,7 @@ updateWith(details) - `error` {{optional_inline}} {{deprecated_inline}} {{non-standard_inline}} - - : A string specifying an error message to present to the user*.* When calling `updateWith()`, including `error` in the updated data causes the {{Glossary("user agent")}} to display the text as a general error message. For address field specific errors, use `shippingAddressErrors`. + - : A string specifying an error message to present to the user*.* When calling `updateWith()`, including `error` in the updated data causes the {{Glossary("user agent")}} to display the text as a general error message. For address field-specific errors, use the `shippingAddressErrors` field. - `modifiers` {{optional_inline}} From 64eb40556f0070cc466bf33b14b17313392cdfc0 Mon Sep 17 00:00:00 2001 From: skyclouds2001 <95597335+skyclouds2001@users.noreply.github.com> Date: Wed, 10 Jan 2024 16:46:46 +0800 Subject: [PATCH 17/21] Update files/en-us/web/api/paymentrequest/show/index.md Co-authored-by: Jean-Yves Perrier --- files/en-us/web/api/paymentrequest/show/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/en-us/web/api/paymentrequest/show/index.md b/files/en-us/web/api/paymentrequest/show/index.md index b46a27ee3ce8097..8805ecc8a69bb1d 100644 --- a/files/en-us/web/api/paymentrequest/show/index.md +++ b/files/en-us/web/api/paymentrequest/show/index.md @@ -71,7 +71,7 @@ show(detailsPromise) - `error` {{optional_inline}} {{deprecated_inline}} {{non-standard_inline}} - - : A string specifying an error message to present to the user*.* When calling {{domxref("PaymentRequestUpdateEvent.updateWith", "updateWith()")}}, including `error` in the updated data causes the {{Glossary("user agent")}} to display the text as a general error message. For address field specific errors, use `shippingAddressErrors`. + - : A string specifying an error message to present to the user*.* When calling {{domxref("PaymentRequestUpdateEvent.updateWith", "updateWith()")}}, including `error` in the updated data causes the {{Glossary("user agent")}} to display the text as a general error message. For address-field specific errors, use the `shippingAddressErrors` field. - `modifiers` {{optional_inline}} From fa38bc208a2bf75fbc7156984fac11b2f758cc02 Mon Sep 17 00:00:00 2001 From: skyclouds2001 <95597335+skyclouds2001@users.noreply.github.com> Date: Sun, 21 Jan 2024 19:43:27 +0800 Subject: [PATCH 18/21] Apply suggestions from code review Co-authored-by: wbamberg --- .../web/api/paymentrequest/paymentmethodchange_event/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/en-us/web/api/paymentrequest/paymentmethodchange_event/index.md b/files/en-us/web/api/paymentrequest/paymentmethodchange_event/index.md index 8bdf7ac42da38f7..d7f2cbdccda6608 100644 --- a/files/en-us/web/api/paymentrequest/paymentmethodchange_event/index.md +++ b/files/en-us/web/api/paymentrequest/paymentmethodchange_event/index.md @@ -43,12 +43,12 @@ _In addition to the properties below, this interface includes properties inherit Let's take a look at an example. This code creates a new {{domxref("PaymentRequest")}}, adds a handler for the `paymentmethodchange` event by calling the request's {{domxref("EventTarget.addEventListener", "addEventListener()")}}, then calls {{domxref("PaymentRequest.show", "show()")}} to present the payment interface to the user. -The code assumes the existence of a method `detailsForShipping()`, which will return an object provides information about the requested transaction. +The code assumes the existence of a method `detailsForTransaction()`, which will return an object that can be passed as the [`details`](/en-US/docs/Web/API/PaymentRequest/PaymentRequest#details) argument to the `PaymentRequest` constructor. ```js const paymentRequest = new PaymentRequest( paymentMethods, - detailsForShipping("ground"), + detailsForTransaction(), ); paymentRequest.addEventListener( From 096a2ac775318f3b00c1633ee02ae42695fccd98 Mon Sep 17 00:00:00 2001 From: skyclouds2001 <95597335+skyclouds2001@users.noreply.github.com> Date: Sun, 21 Jan 2024 19:55:56 +0800 Subject: [PATCH 19/21] Apply suggestions from code review --- .../paymentrequestevent/changepaymentmethod/index.md | 11 +---------- .../web/api/paymentrequestevent/modifiers/index.md | 2 +- .../api/paymentrequestupdateevent/updatewith/index.md | 11 +---------- 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/files/en-us/web/api/paymentrequestevent/changepaymentmethod/index.md b/files/en-us/web/api/paymentrequestevent/changepaymentmethod/index.md index 63309012be9ac4f..ac238aa9b3aa84c 100644 --- a/files/en-us/web/api/paymentrequestevent/changepaymentmethod/index.md +++ b/files/en-us/web/api/paymentrequestevent/changepaymentmethod/index.md @@ -38,16 +38,7 @@ A {{jsxref("Promise")}} that resolves with a `PaymentRequestDetailsUpdate` objec - : An 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 applicable sales tax. - `modifiers` - - : An {{jsxref("Array")}} of objects containing modifiers for payment details, each with the following properties: - - - `supportedMethods` - - : A string that represents the payment method identifier. The members of the object only apply to the payment if the user selects this payment method. - - `total` {{optional_inline}} - - : An object that overrides the `total` property of the `detailsPromise` parameter if this payment method is selected by the user. The property takes the same input with the `total` property of the `detailsPromise` parameter. - - `additionalDisplayItems` {{optional_inline}} - - : An {{jsxref("Array")}} of objects provide additional display items that are appended to the `displayItems` property of the `detailsPromise` parameter if this payment method is selected by the user. This property 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 property takes the same input with the `displayItems` property of the `detailsPromise` parameter. - - `data` {{optional_inline}} - - : A serializable object that provides optional information that might be needed by the supported payment methods. + - : An {{jsxref("Array")}} of `PaymentDetailsModifier` objects, whose properties are described in the {{domxref("PaymentRequestEvent.modifiers")}}. - `paymentMethodErrors` - : An object containing validation errors for the payment method, if any. diff --git a/files/en-us/web/api/paymentrequestevent/modifiers/index.md b/files/en-us/web/api/paymentrequestevent/modifiers/index.md index f898e763f819634..2c02153f3f7665b 100644 --- a/files/en-us/web/api/paymentrequestevent/modifiers/index.md +++ b/files/en-us/web/api/paymentrequestevent/modifiers/index.md @@ -11,7 +11,7 @@ browser-compat: api.PaymentRequestEvent.modifiers {{SeeCompatTable}}{{APIRef("Payment Handler API")}} The **`modifiers`** read-only property of the -{{domxref("PaymentRequestEvent")}} interface returns an array of objects containing modifiers for payment details. +{{domxref("PaymentRequestEvent")}} interface returns an {{jsxref("Array")}} of `PaymentDetailsModifier` objects containing modifiers for payment details. ## Value diff --git a/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md b/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md index f5dc855709faa7e..fe747e764727047 100644 --- a/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md +++ b/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md @@ -45,16 +45,7 @@ updateWith(details) - `modifiers` {{optional_inline}} - - : An array of objects, each describing a modifier for particular payment method identifiers, each with the following properties: - - - `supportedMethods` - - : A string that represents the payment method identifier. The payment method identifier only applies if the user selects this payment method. - - `total` {{optional_inline}} - - : An object that overrides the `total` property of the `detailsPromise` parameter if this payment method is selected by the user. The property takes the same input with the `total` property of the `detailsPromise` parameter. - - `additionalDisplayItems` {{optional_inline}} - - : An {{jsxref("Array")}} of objects provide additional display items that are appended to the `displayItems` property of the `detailsPromise` parameter if this payment method is selected by the user. This property 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 property takes the same input with the `displayItems` property of the `detailsPromise` parameter. - - `data` {{optional_inline}} - - : A serializable object that provides optional information that might be needed by the supported payment methods. + - : An {{jsxref("Array")}} of `PaymentDetailsModifier` objects, whose properties are described in the {{domxref("PaymentRequestEvent.modifiers")}}. For example, you can use one to adjust the total payment amount based on the selected payment method ("5% cash discount!"). From 2d29b5fb39bd24f1cd9ec321ca4cadc3f77bca73 Mon Sep 17 00:00:00 2001 From: wbamberg Date: Mon, 22 Jan 2024 10:37:57 -0800 Subject: [PATCH 20/21] Update files/en-us/web/api/paymentrequestevent/changepaymentmethod/index.md --- .../web/api/paymentrequestevent/changepaymentmethod/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/en-us/web/api/paymentrequestevent/changepaymentmethod/index.md b/files/en-us/web/api/paymentrequestevent/changepaymentmethod/index.md index ac238aa9b3aa84c..04bf63d291c373a 100644 --- a/files/en-us/web/api/paymentrequestevent/changepaymentmethod/index.md +++ b/files/en-us/web/api/paymentrequestevent/changepaymentmethod/index.md @@ -38,7 +38,7 @@ A {{jsxref("Promise")}} that resolves with a `PaymentRequestDetailsUpdate` objec - : An 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 applicable sales tax. - `modifiers` - - : An {{jsxref("Array")}} of `PaymentDetailsModifier` objects, whose properties are described in the {{domxref("PaymentRequestEvent.modifiers")}}. + - : An {{jsxref("Array")}} of `PaymentDetailsModifier` objects, whose properties are described in {{domxref("PaymentRequestEvent.modifiers")}}. - `paymentMethodErrors` - : An object containing validation errors for the payment method, if any. From a8107afa3cf0d9799783d7c1c8a38b6e9568a05f Mon Sep 17 00:00:00 2001 From: wbamberg Date: Mon, 22 Jan 2024 10:38:38 -0800 Subject: [PATCH 21/21] Update files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md --- .../en-us/web/api/paymentrequestupdateevent/updatewith/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md b/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md index fe747e764727047..7afc3803a8bdaaa 100644 --- a/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md +++ b/files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md @@ -45,7 +45,7 @@ updateWith(details) - `modifiers` {{optional_inline}} - - : An {{jsxref("Array")}} of `PaymentDetailsModifier` objects, whose properties are described in the {{domxref("PaymentRequestEvent.modifiers")}}. + - : An {{jsxref("Array")}} of `PaymentDetailsModifier` objects, whose properties are described in {{domxref("PaymentRequestEvent.modifiers")}}. For example, you can use one to adjust the total payment amount based on the selected payment method ("5% cash discount!").