I've been reading through the documents and I feel like each particular doc jumps over the piece of info that I need. It explains how to create a Sandbox Test User and I've done that. I did plenty of IAP work many years ago, but things have changed enough that it's not working as I expect. When I read the docs, I feel like I can't find the missing piece.
When I test in a simulator with Xcode, it does my IAP transactions in the Xcode environment. That makes sense.
This page says:
To run your app using your Sandbox Apple ID, build and run your app from Xcode.
But when I test on a physical device installing directly from Xcode, it also does my IAP transactions in the Xcode environment. I thought this would put me in the Sandbox environment, but it didn't. The initial purchase view controller didn't reference the Sandbox at all and the "You're All Set" alert shows Environment: Xcode.
When I put a test build into TestFlight and test using that version, my IAP transactions are happening in production using my real Apple Id (but I'm not actually charged for any transactions).
I assumed that testing in TestFlight would give me the Sandbox environment, but it happens in the Production environment. (The purchase view controller doesn't show Sandbox and the "You're All Set" alert doesn't show Sandbox.)
So, how do I test in the Sandbox? Every way I try to test either puts me in the Xcode environment or the Production Environment.
What am I missing?
I've logged out of my real Apple id on my phone and then logged in with the Sandbox User credentials I created in AppStore Connect. But when I tried to test the app, by installing from Xcode it still says I'm in the Xcode test environment. When I create transactions, those transactions show up in the Xcode Transaction Manager.
How do I test in the Sandbox environment?