W3cubDocs

/DOM

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.

Methods

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

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 61 (Yes) No support[1] ? No support ?
payerName property 61 ? No support[1] ? No support ?
requestId property 61 ? ? ? No support ?
Feature Android Webview Chrome for Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support No support 53 (Yes) No support[1] ? No support ?
payerName property No support 58 ? No support[1] ? No support ?
requestId property No support 60 ? ? ? No support ?

[1] Supported since 56 but disabled on all versions. Hidden behind the dom.payments.request.enabled pref.

© 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