In-app purchases have always been a bit painful to test. But recently (with iOS 4.0+), I’ve had a terrible time trying to get my iPhone to use the sandbox for testing. The problem is it often thinks it’s in the production environment *even* if you enter the in-app purchase test user (the symptom of this is when you are asked to confirm all sorts of details like the credit card number for the test user… that’s bad!).
I also had a problem where even after I had signed out of my AppleID on the iPhone it would still pop up with that AppleID asking for the password.
Here’s how I fixed it. Doing these steps seem to finally get it to use the sandbox (it’s possible some may be unnecessary – but when I do them all, it works):