W3cubDocs

/DOM

PaymentResponse

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

The PaymentResponse interface of the Payment Request API is returned after a user selects a payment method and approves a payment request.

Properties

PaymentResponse.details Read only Secure context
Returns a JSON-serializable object that provides a payment method specific message used by the merchant to process the transaction and determine successful fund transfer. The conteints of the object depend on the payment method being used; for example, if the Basic Card payment method is used, this object must conform to the structure defined in the BasicCardResponse dictionary.
PaymentResponse.methodName Read only Secure context
Returns the payment method identifier for the payment method that the user selected, for example, Visa, Mastercard, Paypal, etc..
PaymentResponse.payerEmail Read only Secure context
Returns the email address supplied by the user. This option is only present when the requestPayerEmail option is set to true in the options parameter of the PaymentRequest() constructor.
PaymentResponse.payerName Read only Secure context
Returns the name supplied by the user. This option is only present when the requestPayerName option is set to true in the options parameter of the PaymentRequest() constructor.
PaymentResponse.payerPhone Read only Secure context
Returns the phone number 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 option is set to true in the options parameter of the PaymentRequest() constructor.

Event handlers

PaymentResponse.onpayerdetailchange Secure context
During a .retry(), it allows the developer to be notified if the requested user's details change. This allows you to revalidate any requested user data (e.g., the phone number or the email address).

Methods

PaymentResponse.retry() Secure context
If something is wrong with the payment response's data (and there is a recoverable error), this method allows a merchant to request that the user retry the payment. The method takes an object as argument, which is used to signal to the user exactly what is wrong with the payment response so they can try to correct any issues.
PaymentResponse.complete() Secure context
Notifies the user agent that the user interaction is over. This causes any remaining user interface to be closed. This method should only be called after the Promise returned by the PaymentRequest.show() method.

Specifications

Specification Status Comment
Payment Request API
The definition of 'PaymentResponse' in that specification.
Candidate Recommendation Initial definition.

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support 61
Disabled
61
Disabled
Disabled 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.
Yes 56
Disabled
56
Disabled
Disabled 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.
No No ?
details 61
Disabled
61
Disabled
Disabled 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.
15 56
Disabled
56
Disabled
Disabled 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.
No No ?
methodName 61
Disabled
61
Disabled
Disabled 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.
15 56
Disabled
56
Disabled
Disabled 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.
No No ?
payerEmail 61
Disabled
61
Disabled
Disabled 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.
15 56
Disabled
56
Disabled
Disabled 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.
No No ?
payerName 61
Disabled
61
Disabled
Disabled 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.
15 56
Disabled
56
Disabled
Disabled 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.
No No ?
payerPhone 61
Disabled
61
Disabled
Disabled 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.
15 56
Disabled
56
Disabled
Disabled 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.
No No ?
requestId 61
Disabled
61
Disabled
Disabled 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.
16 56
Disabled
56
Disabled
Disabled 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.
No No ?
shippingAddress 61
Disabled
61
Disabled
Disabled 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.
15 56
Disabled
56
Disabled
Disabled 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.
No No ?
shippingOption 61
Disabled
61
Disabled
Disabled 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.
15 56
Disabled
56
Disabled
Disabled 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.
No No ?
complete 61
Disabled
61
Disabled
Disabled 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.
15 56
Disabled
56
Disabled
Disabled 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.
No No ?
toJSON 61
Disabled
61
Disabled
Disabled 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.
? ? ? ? ?
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support No 53
Disabled
53
Disabled
Disabled 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.
Yes 56
Disabled
56
Disabled
Disabled 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.
No ? 6.0
details No 53
Disabled
53
Disabled
Disabled 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.
Yes 56
Disabled
56
Disabled
Disabled 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.
No ? 6.0
methodName No 53
Disabled
53
Disabled
Disabled 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.
Yes 56
Disabled
56
Disabled
Disabled 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.
No ? 6.0
payerEmail No 53
Disabled
53
Disabled
Disabled 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.
Yes 56
Disabled
56
Disabled
Disabled 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.
No ? 6.0
payerName No 58
Disabled
58
Disabled
Disabled From version 58: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Yes 56
Disabled
56
Disabled
Disabled 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.
No ? 7.0
payerPhone No 53
Disabled
53
Disabled
Disabled 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.
Yes 56
Disabled
56
Disabled
Disabled 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.
No ? 6.0
requestId No 60
Disabled
60
Disabled
Disabled From version 60: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Yes 56
Disabled
56
Disabled
Disabled 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.
No ? No
shippingAddress No 53
Disabled
53
Disabled
Disabled 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.
Yes 56
Disabled
56
Disabled
Disabled 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.
No ? 6.0
shippingOption No 53
Disabled
53
Disabled
Disabled 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.
Yes 56
Disabled
56
Disabled
Disabled 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.
No ? 6.0
complete No 53
Disabled
53
Disabled
Disabled 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.
Yes 56
Disabled
56
Disabled
Disabled 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.
No ? 6.0
toJSON ? 55
Disabled
55
Disabled
Disabled From version 55: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
? ? ? ? ?

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/PaymentResponse