See the source code of https://bobpay.xyz/pay/
```html
<button onclick="pay()">Pay</button>
<script>
let paymentRequestClient;
navigator.serviceWorker.addEventListener('message', e => {
paymentRequestClient = e.source;
console.log(JSON.stringify(e.data, undefined, 2));
});
navigator.serviceWorker.controller.postMessage('payment_app_window_ready');
function pay() {
if(!paymentRequestClient) return;
var paymentAppResponse = {
methodName: "https://majaybabu.github.io/payment-handler-pay/",
details: {
id: "123456"
}
};
paymentRequestClient.postMessage(paymentAppResponse);
// Chrome will close this window at this point.
}
</script>
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/payment-handler/issues/280#issuecomment-378807710