安全上下文
此特征只可用于 安全上下文 (HTTPS),在某些或所有 支持浏览器 .

PaymentResponse 接口在 支付请求 API is returned after a user selects a payment method and approves a payment request.

特性

PaymentResponse.details 只读 安全上下文
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 字典。
PaymentResponse.methodName 只读 安全上下文

Returns the payment method identifier for the payment method that the user selected, for example, Visa, Mastercard, Paypal, etc..

PaymentResponse.payerEmail 只读 安全上下文
Returns the email address supplied by the user. This option is only present when the requestPayerEmail option is set to true 选项 参数为 PaymentRequest() 构造函数。
PaymentResponse.payerName 只读 安全上下文
Returns the name supplied by the user. This option is only present when the requestPayerName option is set to true in the 选项 参数为 PaymentRequest() 构造函数。
PaymentResponse.payerPhone 只读 安全上下文
Returns the phone number supplied by the user. This option is only present when the requestPayerPhone option is set to true 选项 参数为 PaymentRequest() 构造函数。
PaymentResponse.requestId 只读 安全上下文
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 只读 安全上下文
Returns the shipping Address supplied by the user. This option is only present when the requestShipping option is set to true 选项 参数为 PaymentRequest() 构造函数。
PaymentResponse.shippingOption 只读 安全上下文
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 选项 参数为 PaymentRequest() 构造函数。

方法

PaymentResponse.retry() 安全上下文

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() 安全上下文
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() 方法。

事件

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

payerdetailchange 安全上下文
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.
也可用凭借 onpayerdetailchange 特性。

规范

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

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
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 ) 和 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 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 ) 和 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 ). To change preferences in Firefox, visit about:config.
IE 不支持 No Opera 不支持 No Safari Yes WebView Android 不支持 No Chrome Android 56 Firefox Android 56 注意事项 Disabled
56 注意事项 Disabled
Available only in nightly builds.
Disabled ). 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 ). To change preferences in Firefox, visit about:config.
IE 不支持 No Opera 不支持 No Safari Yes WebView Android 不支持 No Chrome Android 56 Firefox Android 56 注意事项 Disabled
56 注意事项 Disabled
Available only in nightly builds.
Disabled ). 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 ). To change preferences in Firefox, visit about:config.
IE 不支持 No Opera 不支持 No Safari Yes WebView Android 不支持 No Chrome Android 56 Firefox Android 56 注意事项 Disabled
56 注意事项 Disabled
Available only in nightly builds.
Disabled ). 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 ). To change preferences in Firefox, visit about:config.
IE 不支持 No Opera 不支持 No Safari Yes WebView Android 不支持 No Chrome Android 56 Firefox Android 56 注意事项 Disabled
56 注意事项 Disabled
Available only in nightly builds.
Disabled ). 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 ). 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 ). 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 ). To change preferences in Firefox, visit about:config.
IE 不支持 No Opera 不支持 No Safari Yes WebView Android 不支持 No Chrome Android 56 Firefox Android 56 注意事项 Disabled
56 注意事项 Disabled
Available only in nightly builds.
Disabled ). 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 ). 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 ). 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 ). To change preferences in Firefox, visit about:config.
IE 不支持 No Opera 不支持 No Safari Yes WebView Android 不支持 No Chrome Android 56 Firefox Android 56 注意事项 Disabled
56 注意事项 Disabled
Available only in nightly builds.
Disabled ). 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 ). To change preferences in Firefox, visit about:config.
IE 不支持 No Opera 不支持 No Safari Yes WebView Android 不支持 No Chrome Android 56 Firefox Android 56 注意事项 Disabled
56 注意事项 Disabled
Available only in nightly builds.
Disabled ). 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 Firefox Android 62 注意事项
62 注意事项
Available only in nightly builds.
Opera Android 不支持 No Safari iOS Yes Samsung Internet Android 6.0

图例

完整支持

完整支持

不支持

不支持

兼容性未知 ?

兼容性未知

见实现注意事项。

用户必须明确启用此特征。

用户必须明确启用此特征。

元数据

  • 最后修改:
  1. 支付请求 API
  2. PaymentResponse
  3. 特性
    1. details
    2. methodName
    3. onpayerdetailchange
    4. payerEmail
    5. payerName
    6. payerPhone
    7. requestId
    8. shippingAddress
    9. shippingOption
  4. 方法
    1. complete()
    2. retry()
  5. 继承:
    1. EventTarget
  6. Related pages for Payment Request API
    1. HTMLIFrameElement.allowPaymentRequest
    2. MerchantValidationEvent
    3. PaymentAddress
    4. PaymentMethodChangeEvent
    5. PaymentRequest
    6. PaymentRequestUpdateEvent

版权所有  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1