Headless app, need to get back to app after chekcout

I’m writing a headless app as PWA that will be wrapped for iOS and Android. Written in React with Typescript.

My problem is checkout, I need to stay in the app after checkout is complete.

Currently, we navigate to cart.checkoutUrl (thus leaving the app, not ideal. But haven’t found other options)

After checkout on cart.checkoutUrl, the user is sent to url of open store, ie. not in app anymore.

After much googling, no solution has arrived. I’ve can think of two ways to fix this:

  • find a way to pass a redirectUrl to cart.checkoutUrl
  • build the whole check-out in headless.

Any help would be appreciated