Search completed in 1.30 seconds.
PaymentRequest.shippingAddress - Web APIs
// Initialization of PaymentRequest arguments are excerpted for the sake of // brevity. ...
... // Initialization of PaymentRequest arguments are excerpted for the sake of // brevity. ...
... // Initialization of PaymentRequest arguments are excerpted for the sake of // brevity. ...
...And 7 more matches
PaymentRequest.onshippingaddresschange - Web APIs
If the address stored by the user agent changes at any time during a payment process, the event is triggered. To make sure an updated address is included when sending payment information to the server, you should add event listeners for a PaymentRequest object after instantiation, but before the call to show(). ...
...If the address stored by the user agent changes at any time during a payment process, the event is triggered. To make sure an updated address is included when sending payment information to the server, you should add event listeners for a PaymentRequest object after instantiation, but before the call to show(). ...
...}; Examples The
shippingaddresschange event is triggered by a user-agent controlled interaction. ...
...And 4 more matches
PaymentRequest: shippingaddresschange event - Web APIs
The
shippingaddresschange event is sent to the PaymentRequest object when the user selects a shipping address or changes details of their shipping address. Bubbles No Cancelable No Interface PaymentRequestUpdateEvent Event handler property on
shippingaddresschange Usage notes Depending on the browser, the shipping address information may be redacted for privacy reasons. That is, the PaymentAddress which contains the shipping address may have some portions of its content altered, obscured, or left out entirely in order to prevent identifying the user without their consent (since if they choose to have you ship products to them, you'll need their address). ...
...hipping address information may be redacted for privacy reasons. That is, the PaymentAddress which contains the shipping address may have some portions of its content altered, obscured, or left out entirely in order to prevent identifying the user without their consent (since if they choose to have you ship products to them, you'll need their address). ...
...vent identifying the user without their consent (since if they choose to have you ship products to them, you'll need their address). Example In this example, a handler for the
shippingaddresschange event is set up to validate that the address meets requirements set by the web application. ...
...And 2 more matches
PaymentResponse.shippingAddress - Web APIs
The
shippingAddress read-only property of the PaymentRequest interface returns a PaymentAddress object containing the shipping address provided by the user. Syntax var
shippingAddress = PaymentRequest.
shippingAddress; Value A PaymentAddress object providing details comprising the shipping address provided by the user. Example Generally, the user agent will fill the
shippingAddress property for you. You can trigger this by setting PaymentOptions.requestShipping to true when calling the PaymentRequest constructor. In the example below, the cost of shipping varies by geography. When the PaymentRequest.on
shippingaddresschange is called, updateDetails() is called to update the details of the PaymentRequest, using
shippingAddress to set the correct shipping cost. // Initialization of PaymentRequest...
...cost of shipping varies by geography. When the PaymentRequest.on
shippingaddresschange is called, updateDetails() is called to update the details of the PaymentRequest, using
shippingAddress to set the correct shipping cost. // Initialization of PaymentRequest arguments are excerpted for brevity. var payment = new PaymentRequest(supportedInstruments, details, options); request.addEventListener('
shippingaddresschange', function(evt) { evt.updateWith(new Promise(function(resolve) { updateDetails(details, request.
shippingAddress, resolve); })); }); payment.show().then(function(paymentResponse) { // Processing of paymentResponse exerpted for the same of brevity. }).catch(function(err) { console.error("Uh oh, something bad happened", err.message); }); function updateDetails(details, shippingAd...
... evt.updateWith(new Promise(function(resolve) { updateDetails(details, request.
shippingAddress, resolve); })); }); payment.show().then(function(paymentResponse) { // Processing of paymentResponse exerpted for the same of brevity. ...
...And 2 more matches
PaymentDetailsUpdate.shippingAddressErrors - Web APIs
The PaymentDetailsUpdate dictionary's
shippingAddressErrors property, if present, contains an AddressErrors object whose contents provide error messages for one or more of the values in the PaymentAddress specified as PaymentRequest.
shippingAddress. Syntax var addressErrors = PaymentDetailsUpdate.
shippingAddressErrors; Value An AddressErrors object, which contains DOMStrings describing errors in the properties of a PaymentAddress. For each property in PaymentAddress, a property by the same name is found in
shippingAddressErrors if and only if a validation error occurred for that property. In that case, the property in
shippingAddressErrors is a string describing the validation error, ideally including suggestions about fixing the error. Specifications Specification Status ...
...operty by the same name is found in
shippingAddressErrors if and only if a validation error occurred for that property. In that case, the property in
shippingAddressErrors is a string describing the validation error, ideally including suggestions about fixing the error. Specifications Specification Status Comment Payment Request APIThe definition of 'PaymentDetailsUpdate.
shippingAddressErrors' in that specification. Candidate Recommendation Initial definition. ...
AddressErrors - Web APIs
The AddressErrors dictionary is used by the Payment Request API to to report validation errors in a physical address (typically a billing address or a shipping address). Any members which is present indicates that a validation error occurred for the member of the same name in an address described using PaymentAddress. AddressErrors is the type of the object returned by
shippingAddressErrors in the PaymentDetailsUpdate passed into PaymentRequestUpdateEvent.updateWith() by the
shippingaddresschange event handler if a change to the address resulted in a validation error occurring. See the examples below to see how this works. Properties addressLine A DOMString which, if present, indicates that the addressLine property of the PaymentAddress could not be validated. The contents of the string provide a...
...n't change, and there may be situations in which you need to allow validation errors to be accepted anyway (for example, if you validate addresses against a postal service database and a new home has been built and its address is not yet in the database). Examples Snippet: Limiting destination countries This first example is just a snippet showing an implementation of the event handler for the
shippingaddresschange event which checks to be sure the chosen address is located within one of a limited number of countries. function handleAddressChange(ev) { const validCountries = ["US", "CA", "GB", "JP", "CN", "MX"]; const genericAddressError = "Unable to ship to the given address. Please check for any errors."; const invalidCountryError = "At this time, we only ship to the United States, Canada, G...
...dress is located within one of a limited number of countries. function handleAddressChange(ev) { const validCountries = ["US", "CA", "GB", "JP", "CN", "MX"]; const genericAddressError = "Unable to ship to the given address. ...
...And 13 more matches
Index - Web APIs
iated. 2918 PaymentDetailsUpdate.error API, Error, Payment Request, Payment Request API, PaymentDetailsUpdate, Property, Reference, payment The PaymentDetailsUpdate dictionary's error property is a human-readable DOMString which provides an error message to be displayed if the specified information doesn't offer any valid shipping options. ...
... The PaymentDetailsUpdate dictionary's error property is a human-readable DOMString which provides an error message to be displayed if the specified information doesn't offer any valid shipping options. 2919 PaymentDetailsUpdate.
shippingAddressErrors API, Address, Errors, Payment Request, Payment Request API, PaymentDetailsUpdate, Property, Reference, Shipping, Validation, payment,
shippingAddressErrors The PaymentDetailsUpdate dictionary's
shippingAddressErrors property, if present, contains an AddressErrors object whose contents provide error messages for one or more of the values in the PaymentAddress specified as PaymentRequest.
shippingAddress. 2920 PaymentItem API, Commerce, Dictionary, Payment Request, Payment Request API, PaymentItem, Reference, payment T...
... 2932 PaymentRequest.onshippingoptionchange ...
...And 5 more matches
PaymentResponse.retry() - Web APIs
iant object which provides appropriate error messages for any of the fields describing the payer which failed validation. paymentMethod Optional Any payment method specific errors which may have occurred. This object's contents will vary depending on the payment used. For example, if the user chose to pay by credit card using the basic-card payment method, this is a BasicCardErrors object.
shippingAddress Optional An AddressErrors object which contains error messages for any of the fields in the shipping address that failed validation. Return value A Promise which is resolved when the payment is successfully completed. The promise is rejected with an appropriate exception value if the payment fails again. Typically you will use this by calling show(), then entering a loop or recursive func...
...tRequest(methodData, details, options); const response = await request.show(); await recursiveValidate(request, response); await response.complete("success"); } // Keep validating until the data looks good! ...
...s, options); const response = await request.show(); await recursiveValidate(request, response); await response.complete("success"); } // Keep validating until the data looks good! ...
...t, response); await response.complete("success"); } // Keep validating until the data looks good! ...
PaymentDetailsUpdate - Web APIs
l 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 calling updateWith(), including error in the updated data causes the user agent to display the text as a general error message. ...
...ed data causes the user agent to display the text as a general error message. For address field specific errors, use
shippingAddressErrors. 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 ...
PaymentRequest.onshippingoptionchange - Web APIs
pdated option is included when sending payment information to the server, you should add event listeners for a PaymentRequest object after instantiation, but before the call to show(). // Initialization of PaymentRequest arguments are excerpted for clarity. ...
... 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/b...
PaymentRequest.shippingOption - Web APIs
elow, the PaymentRequest.onshippingoptionchange and the PaymentRequest.onshippingaoptionchange events are dispatched. In each calls to updateDetails() are made, one using a promise, and the other with a plain JS object. This demotrates synchrounous and asynchronous updates to a payment sheet. ...
...we can't ship to your address.` }; } } Specifications Specification Status Comment Payment Request APIThe definition of 'shippingOption' in that s...
PaymentRequest.show() - Web APIs
it syntax or the use of show().then().catch() to handle the response and any possible rejection. ...
...tions to the order. Starting the payment process, in the end, is as simple as calling the processPayment() method. then/catch syntax You can also use the older promise-based approach to work with payments, using the then() and catch() functions on the promise returned by show(): function processsPayment() { const payRequest = new PaymentRequest(methodData, details, options); payRequest.on
shippingaddresschange = ev => ev.updateWith(checkAddress(payRequest)); payRequest.onshippingoptionchange = ev => ev.updateWith(checkShipping(payRequest)); payRequest.show() .then(response => validateResponse(response)) .catch(err => handleError(err)); } This is functionally equivalent to the processPayment() method using the await syntax. function validateResponse(response) { checkAllValues(res...
PaymentRequest - Web APIs
and apps accept payments from the end user on behalf of the operator of the site or the publisher of the app. Constructor PaymentRequest() Secure context Creates a new PaymentRequest object. Properties PaymentRequest.id Read only Secure context An unique identifier for a particular PaymentRequest, which can be set via details.id. When none is set, it defaults to a UUID. PaymentRequest.
shippingAddress Read only Secure context If requested via payment options, returns the shipping address chosen by the user for the purposes of calculating shipping. This property is only populated if the constructor is called with the requestShipping flag set to true. Additionally, in some browsers, the parts of the address will be redacted for privacy until the user indicates they are ready to complete the tr...
...te that the merchant or vendor requesting payment is legitimate. Also available using the onmerchantvalidation event handler property. paymentmethodchange Secure context With some payment handlers (e.g., Apple Pay), dispatched whenever the user changes payment instrument, like switching from a credit card to a debit card. Also available using the onpaymentmethodchange event handler property.
shippingaddresschange Secure context Dispatched whenever the user changes their shipping address. Also available using the on
shippingaddresschange event handler property. shippingoptionchange Secure context Dispatched whenever the user changes a shipping option. Also available using the onshippingoptionchange event handler property. Specifications Specification Status Comment Paym...
PaymentRequestUpdateEvent.updateWith() - Web APIs
l 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 calling updateWith(), including error in the updated data causes the user agent to display the text as a general error message. ...
...ed data causes the user agent to display the text as a general error message. For address field specific errors, use
shippingAddressErrors. 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 ...
PaymentRequestUpdateEvent - Web APIs
shippingoptionchange Secure context Dispatched whenever the user changes a shipping option. Also available using the onshippingoptionchange event handler property. ...
... shippingoptionchange Secure context Dispatched whenever the user changes a shipping option. Also available using the onshippingoptionchange event handler property. ...
PaymentAddress.country - Web APIs
That field contains an AddressErrors-compliant object whose country property is a string indicating the validation error that occurred and, if possible, suggests how to fix it. Specifications Specification Status Comment Payment Request APIThe definition of 'PaymentAddress.country' in that specification. Candidate Recommendation Initial definition. ...
PaymentRequest: paymentmethodchange event - Web APIs
e Apple Pay request, and compute and return an PaymentDetailsUpdate object that specifies changes to be applied to the PaymentRequest in order to add any service fees that the payment method might require. Before the event handler returns, it calls the event's PaymentMethodChangeEvent.updateWith.updateWith() method to integrate the changes into the request. Related events merchantvalidation,
shippingaddresschange, shippingoptionchange, and payerdetailchange Specifications Specification Status Comment Payment Request APIThe definition of 'paymentmethodchange' in that specification. Candidate Recommendation ...
PaymentResponse.details - Web APIs
eturned from PaymentRequest.show(). In a real-world implementation this data would then be sent to a payment server. payment.show().then(paymentResponse => { var paymentData = { // payment method string method: paymentResponse.methodName, // payment details as you requested details: paymentResponse.details, // shipping address information address: toDict(paymentResponse.
shippingAddress) }; // Send information to the server }); Specifications Specification Status Comment Payment Request API 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...
PaymentResponse.methodName - Web APIs
eturned from PaymentRequest.show(). In a real-world implementation this data would then be sent to a payment server. payment.show().then(paymentResponse => { var paymentData = { // payment method string method: paymentResponse.methodName, // payment details as you requested details: paymentResponse.details, // shipping address information address: toDict(paymentResponse.
shippingAddress) }; // Send information to the server }); Specifications Specification Status Comment Payment Request API Candidate Recommendation Initial definition. ...
PaymentResponse - Web APIs
ber supplied by the user. This option is only present when the requestPayerPhone option is set to true in the options parameter of the PaymentRequest() constructor. PaymentResponse.requestId Read only Secure context Returns the identifier of the PaymentRequest that produced the current response. This is the same value supplied in the PaymentRequest() constructor by details.id. PaymentResponse.
shippingAddress Read only Secure context Returns the shipping Address supplied by the user. This option is only present when the requestShipping option is set to true in the options parameter of the PaymentRequest() constructor. PaymentResponse.shippingOption Read only Secure context Returns the ID attribute of the shipping option selected by the user. This option is only present when the requestShipping op...
PaymentValidationErrors - Web APIs
iant object which provides appropriate error messages for any of the fields describing the payer which failed validation. paymentMethod Optional Any payment method specific errors which may have occurred. This object's contents will vary depending on the payment used. For example, if the user chose to pay by credit card using the basic-card payment method, this is a BasicCardErrors object.
shippingAddress Optional An AddressErrors object which contains error messages for any of the fields in the shipping address that failed validation. Example Specifications Specification Status Comment Payment Request API Candidate Recommendation Initial definition. Basic Card Payment Working Draft Defines BasicCardErrors ...