PaymentResponse

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

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

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. This data is returned by the payment app that satisfies the payment request, and 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 Compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support611 Yes563 No No ?
details61115563 No No ?
methodName61115563 No No ?
payerEmail61115563 No No ?
payerName61115563 No No ?
payerPhone61115563 No No ?
requestId61116563 No No ?
shippingAddress61115563 No No ?
shippingOption61115563 No No ?
complete61115563 No No ?
toJSON611 ? ? ? ? ?
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support No532 Yes563 No ?6.0
details No532 Yes563 No ?6.0
methodName No532 Yes563 No ?6.0
payerEmail No532 Yes563 No ?6.0
payerName No584 Yes563 No ?7.0
payerPhone No532 Yes563 No ?6.0
requestId No605 Yes563 No ? No
shippingAddress No532 Yes563 No ?6.0
shippingOption No532 Yes563 No ?6.0
complete No532 Yes563 No ?6.0
toJSON ?556 ? ? ? ? ?

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.

4. 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.

5. 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.

6. 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.

Document Tags and Contributors

Last updated by: marcoscaceres,