Do not try to watch the Razorpay modal's close button with your own click handlers: it lives in a sandboxed iframe your page cannot touch. Use the modal lifecycle callbacks in the Razorpay checkout options to detect dismissal, and run your cancel-order logic there. If your close detection silently never fires, the iframe boundary is the reason.

Context: Stack Overflow #45049438 (accepted answer): A developer trying to detect when a user closes the Razorpay checkout modal attached a jQuery click handler to the close button and it never fired. The accepted answer explains why: the checkout page runs in a sandboxed iframe, so no page-side JS can reach the close button. Razorpay exposes the modal lifecycle through its own checkout options instead.

## Matched source
Source: Published skill
Original query: "Razorpay modal close never detected: the checkout is a sandboxed iframe"
Key terms: checkout, close, detected, iframe, modal, never, razorpay, sandboxed
