安全上下文
此特征只可用于
安全上下文
(HTTPS),在某些或所有
支持浏览器
.
PaymentRequest
event handler
onmerchantvalidation
is invoked when the
merchantvalidation
is fired, indicating that the payment handler (e.g., Apple Pay) requires the merchant to validate themselves. This is usually the first event to be fired, and the user won't be able to proceed with a payment until the merchant validate themselves.
This event is not be fired by all payment handlers. In particular, it's used by Apple Pay.
paymentRequest.onmerchantvalidation = eventHandlerFunction;
An event handler function which is to be called whenever the
merchantvalidation
event is fired at the
PaymentRequest
, indicating that the payment handler requires the merchant to validate themselves as allowed to use this payment handler.
An example merchant validation handler for the
PaymentRequest
对象
request
looks like this:
request.onmerchantvalidation = ev => {
ev.complete(async () => {
const merchantServerUrl = window.location.origin +
'/validation?url=' + encodeURIComponent(ev.validationURL);
// get validation data, and complete validation;
return await fetch(merchantServerUrl).then(r => r.text());
})
};
const response = await request.show();
更多信息,见 Merchant Validation in Payment processing concepts .
| 规范 | 状态 | 注释 |
|---|---|---|
|
支付请求 API
The definition of 'onmerchantvalidation' in that specification. |
候选推荐 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
onmerchantvalidation
|
Chrome ? | Edge ? |
Firefox
64
注意事项
Disabled
|
IE 不支持 No | Opera 不支持 No | Safari ? | WebView Android 不支持 No | Chrome Android ? |
Firefox Android
64
注意事项
Disabled
|
Opera Android 不支持 No | Safari iOS ? | Samsung Internet Android ? |
完整支持
不支持
兼容性未知
见实现注意事项。
用户必须明确启用此特征。
PaymentRequest
onmerchantvalidation
onpaymentmethodchange
onshippingaddresschange
shippingAddress
shippingOption