blob: e359207b9573a397dc4ee929c1b0c59e2537f2af [file] [log] [blame]
<!DOCTYPE html>
<body>
<script src="apple-pay.js"></script>
<script>
const eventListener = async () => {
internals.mockPaymentCoordinator.supportsUnrestrictedApplePay = false;
const applePaySessionAvailable = !!window.ApplePaySession;
const paymentRequestAvailable = !!window.PaymentRequest;
const supportsVersion = ApplePaySession.supportsVersion(1);
if (!window.wkPaymentRequest) {
wkPaymentRequest = new PaymentRequest([applePayMethod()], applePayDetails);
window.webkit.messageHandlers.testApplePay.postMessage({
applePaySessionAvailable,
paymentRequestAvailable,
supportsVersion,
});
return;
}
const canMakePayment = await wkPaymentRequest.canMakePayment();
window.webkit.messageHandlers.testApplePay.postMessage({
applePaySessionAvailable,
paymentRequestAvailable,
supportsVersion,
canMakePayment,
});
};
window.addEventListener('hashchange', eventListener);
window.addEventListener('load', eventListener);
</script>