17
votes

I have in-app purchases working in my production app, and I'm adding a new item for sale.

However, I can not test a new in-app purchase in the sandbox environment. My purchases show up correctly. Restore works. However, if I buy the purchase, then I am prompted to login. I login using a test user account (I have 4 that worked about a month ago and are active). I'm then directed to the AppStore where I get a dialog box pop-up saying: [Environment: Sandbox] with cancel or continue. When I continue I am prompted for apple id password, which I use and press OK. It says "Loading..." for a few seconds and then the popup comes up again saying [Environment Sandbox] cancel/continue.

I have gone through about 5 times.
I have tried the account that I used to test previously I have created a new user I have tried to test on multiple devices that both worked about a month ago. I have reset my device.

In the meanwhile, I've been able to test out my functionality and it's OK - but I can't do the end-to-end purchase/test that I want to do before releasing the update.

Has anyone seen anything similar? I'm looking for any suggestions. Thanks.

2
A few things I've tried this week, but this is still not working. First, my version and build didn't align in the target build summary. Second, I created a new provisioning profile specifically for the app w/ the in-app purchase and installed it. I'm also using a new test user. However, I am getting transaction failed, error.code of 0 and message of "Cannot connect to iTunes Store".jpporterVA
Also, I have been logging into Settings->Store w/ my Test User. Apple docs say to just log out and not log in. When I do that, the in-app purchase prompts me to validate the login w/ my developer ID already populated, and won't let me enter the test user to perform the purchase.jpporterVA

2 Answers

12
votes

OK. I've figured this out. It was my test account. Since I was taking the account and logging in through Settings->App Store, I was registering each with credit card and email notification. I used an old account that created before but hadn't "activated", and it worked. So, the key was to not log in through the Settings->Store - stay logged out. And then log in with a test account that was only created on iTunes Connect, but never activated.

7
votes

I was having this problem for a while as well, but for me the solution was something else: I kept getting that prompt, but also all of my SKPaymentTransactions from previous test session kept re-apparing in this method:

paymentQueue:updatedTransactions:.

Some were completing (and messing up my local purchasing record) and some were failing over and over again. This was because in my code to receive those transitions in the method above, once I processed the completed or failed transaction I was not calling:

[[SKPaymentQueue defaultQueue] finishTransaction:transaction];.

Which removes them from the payment queue. The transactions were just trying to finish, and hence the prompt and my messed up local purchase record.

Hope this helps! :)