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

methodName 只读特性在 PaymentResponse interface returns a string uniquely identifying the payment handler selected by the user. This string may be either one of the standardized payment method identifiers or a URL used by the payment handler to process payments.

句法

var methodName = PaymentResponse.methodName;
					

A DOMString uniquely identifying the payment handler being used to process the payment. This may be either a standardized identifier, or a URL used by the payment processor to handle payments. See Merchant validation in Payment processing concepts 了解更多信息。

范例

The following example extracts the method name from the PaymentResponse object to the promise returned from PaymentRequest.show() . In a real-world implementation this data would then be sent to a payment server.

payment.show().then(paymentResponse => {
  var paymentData = {
    // payment method string
    method: paymentResponse.methodName,
    // payment details as you requested
    details: paymentResponse.details,
    // shipping address information
    address: toDict(paymentResponse.shippingAddress)
  };
  // Send information to the server
});
					

规范

规范 状态 注释
支付请求 API 候选推荐 初始定义。

浏览器兼容性

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

图例

完整支持

完整支持

不支持

不支持

见实现注意事项。

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

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

元数据

  • 最后修改: