Secure contextThis 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. When callingupdateWith()
, includingerror
in the updated data causes the user agent to display the text as a general error message. For address field specific errors, useshippingAddressErrors
. 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 of 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 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.
Return value
undefined
.
Specifications
Specification | Status | Comment |
Payment Request APIThe definition of 'PaymentRequestUpdateEvent.updateWith()' in that specification. | Candidate Recommendation | Initial definition. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
updateWith()
|
Chrome
Full support 60 |
Edge
Full support 15 |
Firefox No support No No support No Notes' Available only in nightly builds. |
IE
No support No |
Opera
Full support 47 |
Safari
Full support 11.1 |
WebView Android
No support No |
Chrome Android
Full support 56 |
Firefox Android No support No No support No Notes' Available only in nightly builds. |
Opera Android
Full support 43 |
Safari iOS
Full support 11.3 |
Samsung Internet Android
Full support 6.0 |
Legend
- Full support
- Full support
- No support
- No support
- See implementation notes.'
- See implementation notes.
PaymentRequestUpdateEvent.updateWith() by Mozilla Contributors is licensed under CC-BY-SA 2.5.