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 contents of the object depend on the payment method being used. Developers need to consult whomever controls the URL for the expected shape of the details object.
-
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 totrue
in theoptions
parameter of thePaymentRequest()
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 theoptions
parameter of thePaymentRequest()
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 totrue
in theoptions
parameter of thePaymentRequest()
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 thePaymentRequest()
constructor bydetails.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 totrue
in theoptions
parameter of thePaymentRequest()
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 totrue
in theoptions
parameter of thePaymentRequest()
constructor.
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.
Events
Listen to this event using addEventListener()
or by assigning an event listener to the oneventname
property of this interface.
-
payerdetailchange
Secure context -
Fired during a retry when the user makes changes to their personal information while filling out a payment request form. Allows the developer to revalidate any requested user data (e.g., the phone number or the email address) if it changes. Also available via the
onpayerdetailchange
property.
Specifications
Specification |
---|
Payment Request API # paymentresponse-interface |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
PaymentResponse |
60 |
15 |
No
Available only in nightly builds. Requires
dom.payments.request.enabled to be set to true and the comma-delineated list in dom.payments.request.supportedRegions to contain one or more of the supported 2-character ISO locales, currently US and CA. |
No |
47 |
11.1 |
No |
56 |
No
Available only in nightly builds. Requires
dom.payments.request.enabled to be set to true and the comma-delineated list in dom.payments.request.supportedRegions to contain one or more of the supported 2-character ISO locales, currently US and CA. |
43 |
11.3 |
6.0 |
complete |
60 |
15 |
No
Available only in nightly builds.
|
No |
47 |
11.1 |
No |
56 |
No
Available only in nightly builds.
|
43 |
11.3 |
6.0 |
details |
60 |
15 |
No
Available only in nightly builds.
|
No |
47 |
11.1 |
No |
56 |
No
Available only in nightly builds.
|
43 |
11.3 |
6.0 |
methodName |
60 |
15 |
No
Available only in nightly builds.
|
No |
47 |
11.1 |
No |
56 |
No
Available only in nightly builds.
|
43 |
11.3 |
6.0 |
onpayerdetailchange |
78 |
79 |
No
Available only in nightly builds.
|
No |
47 |
12.1 |
No |
Yes |
No
Available only in nightly builds.
|
43 |
12.2 |
Yes |
payerdetailchange_event |
No |
No |
No
Available only in nightly builds.
|
No |
No |
12.1 |
No |
No |
No
Available only in nightly builds.
|
No |
12.2 |
No |
payerEmail |
60 |
15 |
No
Available only in nightly builds.
|
No |
47 |
11.1 |
No |
56 |
No
Available only in nightly builds.
|
43 |
11.3 |
6.0 |
payerName |
60 |
15 |
No
Available only in nightly builds.
|
No |
47 |
11.1 |
No |
58 |
No
Available only in nightly builds.
|
43 |
11.3 |
7.0 |
payerPhone |
60 |
15 |
No
Available only in nightly builds.
|
No |
47 |
11.1 |
No |
56 |
No
Available only in nightly builds.
|
43 |
11.3 |
6.0 |
requestId |
60 |
16 |
No
Available only in nightly builds.
|
No |
47 |
11.1 |
No |
60 |
No
Available only in nightly builds.
|
43 |
11.3 |
8.0 |
retry |
78 |
79 |
No
Available only in nightly builds.
|
No |
47 |
12.1 |
No |
78 |
No
Available only in nightly builds.
|
43 |
11.3 |
10.0 |
shippingAddress |
60 |
15 |
No
Available only in nightly builds.
|
No |
47 |
11.1 |
No |
56 |
No
Available only in nightly builds.
|
43 |
11.3 |
6.0 |
shippingOption |
60 |
15 |
No
Available only in nightly builds.
|
No |
47 |
11.1 |
No |
56 |
No
Available only in nightly builds.
|
43 |
11.3 |
6.0 |
toJSON |
60 |
15 |
No
Available only in nightly builds.
|
No |
47 |
11.1 |
No |
56 |
No
Available only in nightly builds.
|
43 |
11.3 |
6.0 |
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/PaymentResponse