草案
此页面不完整。

名称 property is included in a PayerErrors object if the payerName returned in the response couldn't be validated. The value is a string explaining the problem. If the payer's name validated successfully, the 名称 property is omitted from the PayerErrors 对象。

句法

payerName = payerErrors.name;
					

If this property is present in the PayerErrors object, the payer's name couldn't be successfully validated, and the 名称 property's value is a DOMString explaining the error. This string will be displayed to the user by the user agent's payment handling user interface.

If the payer's name is valid, this property is left out of the PayerErrors 对象。

范例

function validatePayment(response) {
  const correctionPromises
  let paymentErrors = {};
  let payerErrors = {};
  // Check payer details
  if (!validEmail(response.payerEmail)) {
    payerErrors.email = "Please make sure you enter a valid email address."
  }
  if (!validName(response.payerName)) {
    payerErrors.email = "Please enter a valid name, using only <appropriate characters>."
  }
  if (!validPhone(response.payerPhone)) {
    payerErrors.phone = "Please enter a valid phone number in the form ###-###-####."
  }
  // Check everything else too...
  //
}
					

规范

规范 状态 注释
支付请求 API
The definition of 'PayerErrors.name' 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
名称 Chrome 71 Disabled
71 Disabled
Disabled From version 71: this feature is behind the #web-payments preference (needs to be set to 启用 ). To change preferences in Chrome, visit chrome://flags.
69 — 71 Alternate Name Disabled
Alternate Name Uses the non-standard name: payerNameError
Disabled ). To change preferences in Chrome, visit
Edge ≤79 Disabled
≤79 Disabled
Disabled From version ≤79: this feature is behind the #web-payments preference (needs to be set to 启用 ).
Firefox 64 注意事项
64 注意事项
Enabled by default in nightly US English builds of Firefox 64 and later, and on other localizations when geolocation indicates the user is in the United States or Canada.
56 Disabled
Disabled From version 56: 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 comma-delineated 2-character country code list ). To change preferences in Firefox, visit about:config.
IE 不支持 No Opera 不支持 No Safari ? WebView Android 不支持 No Chrome Android 71 Disabled
71 Disabled
Disabled From version 71: this feature is behind the #web-payments preference (needs to be set to 启用 ). To change preferences in Chrome, visit chrome://flags.
69 — 71 Alternate Name Disabled
Alternate Name Uses the non-standard name: payerNameError
Disabled ). To change preferences in Chrome, visit
Firefox Android 64 注意事项
64 注意事项
Enabled by default in nightly US English builds of Firefox 64 and later, and on other localizations when geolocation indicates the user is in the United States or Canada.
56 Disabled
Disabled From version 56: 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 comma-delineated 2-character country code list ). To change preferences in Firefox, visit about:config.
Opera Android 不支持 No Safari iOS ? Samsung Internet Android 不支持 No

图例

完整支持

完整支持

不支持

不支持

兼容性未知 ?

兼容性未知

实验。期望将来行为有所改变。

实验。期望将来行为有所改变。

见实现注意事项。

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

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

使用非标名称。

使用非标名称。

元数据

  • 最后修改:
  1. 支付请求 API
  2. PayerErrors
  3. 特性
    1. 名称
    2. phone
  4. Related pages for Payment Request API
    1. HTMLIFrameElement.allowPaymentRequest
    2. MerchantValidationEvent
    3. PaymentAddress
    4. PaymentMethodChangeEvent
    5. PaymentRequest
    6. PaymentRequestUpdateEvent
    7. PaymentResponse

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

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