We’ve migrated our documentation to a new site, which means some URLs have changed.
Subscriptions

How to redirect a user when they try to close the login screen

Usually, when a user closes the login screen, they are effectively exiting the checkout flow, and therefore the checkoutClose callbacks no longer apply to them and can't be used.

However, you can add custom handling for Identity Management events. For example, you can add the following piece of code to your Piano integration script:

window.onmessage = (event) => {
          let event_data = JSON.parse(event.data); 
          if (event_data.sender.startsWith("piano-id") && event_data.event=="closed"){
      window.location.replace("https://example.com/redirectURL/");
        }
 };

In this example, once a user closes the Identity Management login screen, they will be redirected to a landing page with the URL https://example.com/redirectURL/.

Last updated: