草案
此页面不完整。
phone
property is found in a
PayerErrors
object if the
payerName
returned in the response couldn't be validated as a valid phone number. The value of this property is a string explaining the problem. If the payer's phone number validated successfully, the
phone
property is omitted from the
PayerErrors
对象。
payerPhone = payerErrors.phone;
If this property is present in the
PayerErrors
object, the payer's phone number couldn't be successfully validated, and the
phone
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 as appropriate.
If the phone number is valid, this property is omitted from 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.phone' in that specification. |
候选推荐 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
phone
|
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