草案
此页面不完整。
名称
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. |
候选推荐 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
名称
|
Chrome
71
Disabled
|
Edge
≤79
Disabled
|
Firefox
64
注意事项
|
IE 不支持 No | Opera 不支持 No | Safari ? | WebView Android 不支持 No |
Chrome Android
71
Disabled
|
Firefox Android
64
注意事项
|
Opera Android 不支持 No | Safari iOS ? | Samsung Internet Android 不支持 No |
完整支持
不支持
兼容性未知
实验。期望将来行为有所改变。
见实现注意事项。
用户必须明确启用此特征。
使用非标名称。
PayerErrors
名称
phone