request.addEventListener("merchantvalidation", (event) => {
event.complete(async () => {
const merchantServerUrl = `${
window.location.origin
}/validate?url=${encodeURIComponent(event.validationURL)}`;
// get validation data, and complete validation;
return await fetch(merchantServerUrl).then((response) => response.text());
}, false);
});
const response = await request.show();PaymentRequest: merchantvalidation event / notebook
PaymentRequest: merchantvalidation event
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
request.onmerchantvalidation = (event) => {
event.complete(async () => {
const merchantServerUrl = `${
window.location.origin
}/validate?url=${encodeURIComponent(event.validationURL)}`;
// get validation data, and complete validation;
return await fetch(merchantServerUrl).then((response) => response.text());
});
};
const response = await request.show();