安全上下文
此特征只可用于
安全上下文
(HTTPS),在某些或所有
支持浏览器
.
MerchantValidationEvent
方法
complete()
takes merchant-specific information previously received from the
validationURL
and uses it to validate the merchant.
All you have to do is call
complete()
from your handler for the
merchantvalidation
event, passing in the data fetched from the
validationURL
.
merchantValidationEvent.complete(validationData); merchantValidationEvent.complete(merchantSessionPromise);
validationData
or
merchantSessionPromise
Promise
which resolves to the validation data.
undefined
.
This exception may be passed into the rejection handler for the promise:
InvalidStateError
The event did not come directly from the user agent, but was instead dispatched by other code. another payment request is currently being processed, the current payment request is not currently being displayed to the user, or payment information is currently being updated.
In this example, we see the client-side code needed to support merchant validation for a payment request called
payRequest
:
payRequest.onmerchantvalidation = event => {
const validationDataPromise = getValidationData(event.validationURL);
event.complete(validationDataPromise);
}
function getValidationData(url) {
/* ...retrieve the validation data from the URL... */
}
This code sets up a handler for the
merchantvalidation
event. The event handler calls a function,
getValidationData()
, which retrieves the data from the validation URL, then passes that data (or a promise to deliver the data) into
complete()
.
| 规范 | 状态 | 注释 |
|---|---|---|
|
支付请求 API
The definition of 'MerchantValidationEvent.complete()' in that specification. |
候选推荐 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
complete()
|
Chrome 不支持 No | Edge 不支持 No |
Firefox
64
注意事项
|
IE 不支持 No | Opera 不支持 No | Safari 不支持 No | WebView Android 不支持 No | Chrome Android 不支持 No |
Firefox Android
64
注意事项
|
Opera Android 不支持 No | Safari iOS ? | Samsung Internet Android 不支持 No |
完整支持
不支持
兼容性未知
见实现注意事项。
MerchantValidationEvent
complete()