web api instance method
PaymentRequestUpdateEvent: updateWith() method
Secure context
The updateWith() method of the
PaymentRequestUpdateEvent interface updates the details of an existing
PaymentRequest.
Syntax
updateWith(details)
Parameters
details- : Either an object or a
Promisethat resolves to an object, specifying the changes applied to the payment request:-
displayItemsOptional- : An array of objects, each describing one line item for the payment request. These represent the line items on a receipt or invoice, each with the following properties:
amount- : An object describing the monetary value of the item. This object includes the following fields:
currencyvalue- : A string containing a valid decimal value representing the mount of currency constituting the payment amount. This string must only contain an optional leading ”-” to indicate a negative value, then one or more digits from 0 to 9, and an optional decimal point (”.”, regardless of locale) followed by at least one more digit. No whitespace is permitted.
- : An object describing the monetary value of the item. This object includes the following fields:
label- : A string specifying a human-readable name or description of the item or service being charged for. This may be displayed to the user by the user agent, depending on the design of the interface.
pending- : A Boolean value which is
trueif the specifiedamounthas 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.
- : A Boolean value which is
- : An array of objects, each describing one line item for the payment request. These represent the line items on a receipt or invoice, each with the following properties:
-
errorOptional Deprecated- : A string specifying an error message to present to the user. When calling
updateWith(), includingerrorin the updated data causes the user agent to display the text as a general error message. For address field-specific errors, use theshippingAddressErrorsfield.
- : A string specifying an error message to present to the user. When calling
-
modifiersOptional -
shippingAddressErrorsOptional Deprecated- : An object which includes an error message for each property of the shipping address that could not be validated.
-
shippingOptionsOptional Deprecated- : An array of objects, each describing one available shipping option from which the user may choose.
-
totalOptional- : An object with the same properties as the objects in
displayItemsproviding an updated total for the payment. Make sure this equals the sum of all of the items indisplayItems. 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.
- : An object with the same properties as the objects in
-
- : Either an object or a
Return value
None (undefined).
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.