PaymentResponse

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

PaymentResponse interface of the 支付请求 API is returned after a user selects a payment method and approves a payment request.

特性

PaymentResponse.details 只读 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; for example, if the Basic Card payment method is used, this object must conform to the structure defined in the BasicCardResponse dictionary.
PaymentResponse.methodName 只读 Secure context
Returns the payment method identifier for the payment method that the user selected, for example, Visa, Mastercard, Paypal, etc..
PaymentResponse.payerEmail 只读 Secure context
Returns the email address supplied by the user. This option is only present when the requestPayerEmail option is set to true options parameter of the PaymentRequest() 构造函数。
PaymentResponse.payerName 只读 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() 构造函数。
PaymentResponse.payerPhone 只读 Secure context
Returns the phone number supplied by the user. This option is only present when the requestPayerPhone option is set to true options parameter of the PaymentRequest() 构造函数。
PaymentResponse.requestId 只读 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 只读 Secure context
Returns the shipping Address supplied by the user. This option is only present when the requestShipping option is set to true options parameter of the PaymentRequest() 构造函数。
PaymentResponse.shippingOption 只读 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 options parameter of the PaymentRequest() 构造函数。

方法

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() 方法。

Events

Listen to this event using addEventListener() 或通过把事件监听器赋值给 on eventname 特性为此接口。

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 特性。

规范

规范 状态 Comment
支付请求 API
The definition of 'PaymentResponse' in that specification.
候选推荐 初始定义。

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
PaymentResponse Chrome 56 Edge ≤18 Firefox 55
注意事项 Disabled
55
注意事项 Disabled
Available only in nightly builds.
Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true ) and the dom.payments.request.supportedRegions preference (needs to be set to A comma-delineated list of one or more 2-character ISO country codes indicating the countries in which to support payments (for example, US,CA . ). To change preferences in Firefox, visit about:config.
IE 不支持 No Opera 不支持 No Safari Yes WebView Android 不支持 No Chrome Android 56
56
51 — 56
Disabled
Disabled From version 51 until version 56 (exclusive): this feature is behind the #web-payments preference (needs to be set to Enabled ). To change preferences in Chrome, visit chrome://flags.
Firefox Android 55
注意事项 Disabled
55
注意事项 Disabled
Available only in nightly builds.
Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true ) and the dom.payments.request.supportedRegions preference (needs to be set to A comma-delineated list of one or more 2-character ISO country codes indicating the countries in which to support payments (for example, US,CA . ). To change preferences in Firefox, visit about:config.
Opera Android 不支持 No Safari iOS Yes Samsung Internet Android 6.0
complete() Chrome 61 Edge 15 Firefox 56
注意事项 Disabled
56
注意事项 Disabled
Available only in nightly builds.
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.
IE 不支持 No Opera 不支持 No Safari Yes WebView Android 不支持 No Chrome Android 56
56
53 — 56
Disabled
Disabled From version 53 until version 56 (exclusive): this feature is behind the #web-payments preference (needs to be set to Enabled ). To change preferences in Chrome, visit chrome://flags.
Firefox Android 56
注意事项 Disabled
56
注意事项 Disabled
Available only in nightly builds.
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.
Opera Android 不支持 No Safari iOS Yes Samsung Internet Android 6.0
details Chrome 61 Edge 15 Firefox 56
注意事项 Disabled
56
注意事项 Disabled
Available only in nightly builds.
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.
IE 不支持 No Opera 不支持 No Safari Yes WebView Android 不支持 No Chrome Android 56
56
53 — 56
Disabled
Disabled From version 53 until version 56 (exclusive): this feature is behind the #web-payments preference (needs to be set to Enabled ). To change preferences in Chrome, visit chrome://flags.
Firefox Android 56
注意事项 Disabled
56
注意事项 Disabled
Available only in nightly builds.
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.
Opera Android 不支持 No Safari iOS Yes Samsung Internet Android 6.0
methodName Chrome 61 Edge 15 Firefox 56
注意事项 Disabled
56
注意事项 Disabled
Available only in nightly builds.
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.
IE 不支持 No Opera 不支持 No Safari Yes WebView Android 不支持 No Chrome Android 56
56
53 — 56
Disabled
Disabled From version 53 until version 56 (exclusive): this feature is behind the #web-payments preference (needs to be set to Enabled ). To change preferences in Chrome, visit chrome://flags.
Firefox Android 56
注意事项 Disabled
56
注意事项 Disabled
Available only in nightly builds.
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.
Opera Android 不支持 No Safari iOS Yes Samsung Internet Android 6.0
onpayerdetailchange Chrome 不支持 No Edge 不支持 No Firefox 64
注意事项
64
注意事项
Available only in nightly builds.
IE 不支持 No Opera 不支持 No Safari ? WebView Android 不支持 No Chrome Android 不支持 No Firefox Android 64
注意事项
64
注意事项
Available only in nightly builds.
Opera Android 不支持 No Safari iOS ? Samsung Internet Android 不支持 No
payerdetailchange event Chrome 不支持 No Edge 不支持 No Firefox 64
注意事项
64
注意事项
Available only in nightly builds.
IE 不支持 No Opera 不支持 No Safari ? WebView Android 不支持 No Chrome Android 不支持 No Firefox Android 64
注意事项
64
注意事项
Available only in nightly builds.
Opera Android 不支持 No Safari iOS ? Samsung Internet Android 不支持 No
payerEmail Chrome 61 Edge 15 Firefox 56
注意事项 Disabled
56
注意事项 Disabled
Available only in nightly builds.
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.
IE 不支持 No Opera 不支持 No Safari Yes WebView Android 不支持 No Chrome Android 56
56
53 — 56
Disabled
Disabled From version 53 until version 56 (exclusive): this feature is behind the #web-payments preference (needs to be set to Enabled ). To change preferences in Chrome, visit chrome://flags.
Firefox Android 56
注意事项 Disabled
56
注意事项 Disabled
Available only in nightly builds.
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.
Opera Android 不支持 No Safari iOS Yes Samsung Internet Android 6.0
payerName Chrome 61 Edge 15 Firefox 56
注意事项 Disabled
56
注意事项 Disabled
Available only in nightly builds.
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.
IE 不支持 No Opera 不支持 No Safari Yes WebView Android 不支持 No Chrome Android 58 Firefox Android 56
注意事项 Disabled
56
注意事项 Disabled
Available only in nightly builds.
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.
Opera Android 不支持 No Safari iOS Yes Samsung Internet Android 7.0
payerPhone Chrome 61 Edge 15 Firefox 56
注意事项 Disabled
56
注意事项 Disabled
Available only in nightly builds.
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.
IE 不支持 No Opera 不支持 No Safari Yes WebView Android 不支持 No Chrome Android 56
56
53 — 56
Disabled
Disabled From version 53 until version 56 (exclusive): this feature is behind the #web-payments preference (needs to be set to Enabled ). To change preferences in Chrome, visit chrome://flags.
Firefox Android 56
注意事项 Disabled
56
注意事项 Disabled
Available only in nightly builds.
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.
Opera Android 不支持 No Safari iOS Yes Samsung Internet Android 6.0
requestId Chrome 61 Edge 16 Firefox 56
注意事项 Disabled
56
注意事项 Disabled
Available only in nightly builds.
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.
IE 不支持 No Opera 不支持 No Safari Yes WebView Android 不支持 No Chrome Android 60 Firefox Android 56
注意事项 Disabled
56
注意事项 Disabled
Available only in nightly builds.
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.
Opera Android 不支持 No Safari iOS Yes Samsung Internet Android 8.0
retry Chrome 78 Edge ≤79 Firefox 64
注意事项
64
注意事项
Available only in nightly builds.
IE 不支持 No Opera 不支持 No Safari ? WebView Android 不支持 No Chrome Android 78 Firefox Android 64
注意事项
64
注意事项
Available only in nightly builds.
Opera Android 不支持 No Safari iOS ? Samsung Internet Android 10.0
shippingAddress Chrome 61 Edge 15 Firefox 56
注意事项 Disabled
56
注意事项 Disabled
Available only in nightly builds.
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.
IE 不支持 No Opera 不支持 No Safari Yes WebView Android 不支持 No Chrome Android 56
56
53 — 56
Disabled
Disabled From version 53 until version 56 (exclusive): this feature is behind the #web-payments preference (needs to be set to Enabled ). To change preferences in Chrome, visit chrome://flags.
Firefox Android 56
注意事项 Disabled
56
注意事项 Disabled
Available only in nightly builds.
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.
Opera Android 不支持 No Safari iOS Yes Samsung Internet Android 6.0
shippingOption Chrome 61 Edge 15 Firefox 56
注意事项 Disabled
56
注意事项 Disabled
Available only in nightly builds.
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.
IE 不支持 No Opera 不支持 No Safari Yes WebView Android 不支持 No Chrome Android 56
56
53 — 56
Disabled
Disabled From version 53 until version 56 (exclusive): this feature is behind the #web-payments preference (needs to be set to Enabled ). To change preferences in Chrome, visit chrome://flags.
Firefox Android 56
注意事项 Disabled
56
注意事项 Disabled
Available only in nightly builds.
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.
Opera Android 不支持 No Safari iOS Yes Samsung Internet Android 6.0
toJSON() Chrome 61 Edge 15 Firefox 62
注意事项
62
注意事项
Available only in nightly builds.
IE 不支持 No Opera 不支持 No Safari Yes WebView Android 不支持 No Chrome Android 56
56
55 — 56
Disabled
Disabled From version 55 until version 56 (exclusive): this feature is behind the #web-payments preference (needs to be set to Enabled ). To change preferences in Chrome, visit chrome://flags.
Firefox Android 62
注意事项
62
注意事项
Available only in nightly builds.
Opera Android 不支持 No Safari iOS Yes Samsung Internet Android 6.0

图例

完整支持
完整支持
不支持
不支持
兼容性未知
兼容性未知
见实现注意事项。
用户必须明确启用此特征。
用户必须明确启用此特征。