安全上下文
此特征只可用于 安全上下文 (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
An object containing the data needed to complete the merchant validation process, or a 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.
候选推荐 初始定义。

浏览器兼容性

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
complete() Chrome 不支持 No Edge 不支持 No Firefox 64 注意事项
64 注意事项
Available only in Nightly builds.
IE 不支持 No Opera 不支持 No Safari 不支持 No WebView Android 不支持 No Chrome Android 不支持 No Firefox Android 64 注意事项
64 注意事项
Available only in Nightly builds.
Opera Android 不支持 No Safari iOS ? Samsung Internet Android 不支持 No

图例

完整支持

完整支持

不支持

不支持

兼容性未知 ?

兼容性未知

见实现注意事项。

另请参阅

元数据

  • 最后修改: