PaymentRequestUpdateEvent.updateWith()

Secure context
This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The updateWith() method of the PaymentRequestUpdateEvent interface updates the details of an existing PaymentRequest.

Syntax

paymentRequestUpdateEvent.updateWith(details);

Parameters

details
A PaymentDetailsUpdate object specifying the changes applied to the payment request:
displayItems Optional
An array of PaymentItem objects, each describing one line item for the payment request. These represent the line items on a receipt or invoice.
error Optional
A DOMString specifying an error message to present to the user. Spec says stuff expressly about updateWith() here but not about the promise, so need to clarify that.
modifiers Optional
An array of 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!").
shippingAddressErrors Optional
An AddressErrors object which includes an error message for each property orf the shipping address that could not be validated.
shippingOptions Optional
An array of PaymentShippingOption objects, each describing one available shipping option from which the user may choose.
total Optional
A PaymentItem providing an updated total for the payment. Make sure this equals the sum of all of the items in displayItems.

Returns

undefined.

Specifications

Specification Status Comment
Payment Request API
The definition of 'PaymentRequestUpdateEvent.updateWith()' in that specification.
Candidate Recommendation Initial definition.

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support61115563 No No ?
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support No532 ?563 No ?6.0

1. From version 61: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.

2. From version 53: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.

3. From version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.