files/en-us/web/api/paymentrequestupdateevent/updatewith/index.md
{{APIRef("Payment Request API")}}{{securecontext_header}}
The updateWith() method of the
{{domxref("PaymentRequestUpdateEvent")}} interface updates the details of an existing
{{domxref("PaymentRequest")}}.
updateWith(details)
details
displayItems {{optional_inline}}
amount
currency
value
label
pending
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}}
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}}
: 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!").
shippingAddressErrors {{optional_inline}} {{deprecated_inline}} {{non-standard_inline}}
shippingOptions {{optional_inline}} {{deprecated_inline}} {{non-standard_inline}}
total {{optional_inline}}
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.None ({{jsxref("undefined")}}).
{{Specifications}}
{{Compat}}