I am using Shopify headless and opening a new tab to complete payment through the Shopify Checkout flow. My app being wrapped with CapacitorJS to make it available on mobile platforms. The checkout flow is opened with the in-app browsers for the native platforms.
I would like to close the Thank You page after checkout is complete so that the customer is immediately directed back to my application. I have attempted to customize the checkout.liquid file and I manage to close the page with window.close() when I use the normal web browser. This method does not work when I make use of the in-app browser on mobile platforms and I am getting the warning
Scripts may close only the windows that were opened by them
Is there a way to get around the above error or is there a better approach to close the checkout flow?