Sandbox IAP Alternates Between Success and [ Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store" ]

I have been implementing IAP in my app, and have been trying to test purchases over the last few days. I have tried from scratch following Apple's guidelines, and online tutorials, all the way to using Swifty Storekit and IAPManager.


Here's what happens: I press buy for my consumeable IAP, then there is a sucessful purchase. If I try to buy it again, there failed purchase with the following error:


Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store" 
UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store}


If I buy it a third time, it works fine. And so on in that pattern.


Observations/testing:

  • Pattern follows between launches
  • Pattern follows across devices
  • Reproduceable in iOS9 & iOS10
  • Using xcode8 and swift3
  • Deleted my previous sandbox testers and created a new one and problem persists
  • Tried vasious waits between purchases, up to 10 minutes, problem persists.


Any ideas on what could cause this? I am suspecting when live it will be fine, but it is really realy odd.

Accepted Reply

After numerous reports of this issue to DTS, I managed to replicate the problem myself. So far as I can tell, the issue occurs only with new test user accounts. If you go to your iTunesConnect account and enter "User and Roles" -> "Sandbox Testers" page, you will see a list of your sandbox test accounts. If you create a new test user account, notice that there is a check mark in the rightmost column, "Apple Pay". Using such a test account appears to trigger this problem. Developers who have older test user accounts (defined prior to June 13. 2016) won't see this problem.


I've submitted a bug report on this matter, but what I need is a TestFlight submission along with a developer test user account. I think I have such a build coming and will forward the issue to iTunes Production Support for investigation by tomorrow. My suspicion is that this will not affect application submissions - App Reivew tests with mostly established production accounts. This problem will get a lot more (and quicker attention) if it happens in the production environment.


I'll see if I can update this posting when I learn that the problem is fixed.


rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI

Replies

We were seeing this issue last week, and then was fixed.


But today the sandbox transactions in one of our apps are failing (with the same "cannot connect to iTunes store"); while in another one of our apps, they seem to be working fine.

For anyone who can still preproduce this issue, I suggest filing a new bug report. I suspect that for any bug reports for this issue filed since Monday, were likely considered duplicates of the issue fixed this weekend. In the bug report, Please follow the instructions described above AND include the date when you last reproduced the issue. Please send me the bug report numbers and indicate that you are still seeing this issue in the month of April,


rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI

Hi Rich,

I filed a new bug report 31422927 for IAP issue in production.Please do needful , We are getting complaints from our clients.

Thanks!

Deepthi

Hi Apple Developers,


We are having issues with IAP sandbox testing again. We got this error "Skipping authentication request due to 401 error for sandbox-only account" from the console log and got the "Cannot connect to iTunes Store" popup. Can you confirm if this is an sandbox server issue? Since we didn't change anything on our side and it started to happen since last Friday (5/5/17).


Thanks,

Wendy

I'm having the same problem with the sandbox environment.


It happens when I want to change my subscription to another one. I then get the following error:


SKError(_nsError: Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store})


Right after if I try again, I get the same error but with Code=2 this time:


SKError(_nsError: Error Domain=SKErrorDomain Code=2 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store})

I realized that the error message was changed recently.

They occured when I change subscription duration in develop and production environment.


some days ago


Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store}


today.


Error Domain=SSServerErrorDomain Code=0 "Completed." UserInfo={NSLocalizedDescription=Completed.}


※ In fact I translated Japanese message to "Completed." because I cannot save this comment with Japanese characters.


While this message means that In-App purchase completed correctly, we receive it as a error from SDK.

It must be a bug.

I'm getting same problem on Sandbox:


state: failed, date: nil Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store}

Product Id it is correct, made 2 different test users, same problem.😢

I have the same issue. Have you found an answer?

Hello Samuel,

I've come across your post from Dec 7, 2016 about your error received when user tries to modify an active in-app purchase (IAP):

[ Unfortunately I get this error every time I receive the "Do you want to modify your subscription to..." dialogue and then top continue. I receive a failed transaction immediately at that point. If the dialogue starts with "Do you want to upgrade to...", then it succeeds. ]

I am experiencing the same thing with implementing auto-renewing monthly subscriptions in my app, and I am wondering if you were able to resolve your issues.

In my situation... When my sandbox user tries to modify (i.e. DOWNGRADE) a currently-active in-app purchase -- where they receive the "Do you want to modify your subscription to..." dialogue -- the store returns the following error info:

SKError(_nsError: Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store})

At this point, if I just wait until current IAP purchase renews, the new renewal receipt that comes back from the store actually DOES modify the user's IAP according to what the user chose when downgrading the IAP. So the user's downgrade appears to work.

However -- as best I can tell, this appears to create an unwanted side effect. Because my app received this store error, I am guessing that the downgrade transaction never finished (i.e. needsFinishTransaction), which results in repeated future prompts from the device to sign into the Apple ID account (i.e. the sandbox user) I was using for that test purchase. (I presume these prompts are happening because the store is trying to finish any pending transactions (which are pending because it resulted in an error as described).)

Conversely -- if user tries to change their IAP (e.g. UPGRADE) a currently-active in-app purchase -- where they receive the "Do you want to upgrade to..." dialogue -- the purchase succeeds just like you would expect it to, the store immediately returns a new receipt with the new IAP user just upgraded to, and all is fine.

Were you able to find a cause or successful solution to this "user downgrades IAP" error issue?

Thanks!

Hello Rich,


Since this is an old thread, I am hoping you've seen my reply in this thread (dated Aug 25, 2017 3:23 AM) to Samuel about the store error he mentions that he received when attempting to modify (i.e. downgrade) a currently-active auto-renewing in-app purchase.


I am hoping you might have some input on this particular "downgrade" store error, as I've described in my reply to Samuel.


Thanks!

Hi Everyone,


my app just got rejected because of the same SKErrorDomain Code=0 error. Do you have any advice for me? Should I just wait out the problems and then ask the reviewer to look at the app what the purchases are working? Everytime I had encountered this issue it just resolved by itself...

This is a real probblem. We're getting user complaints from Production environment that they receive errors from iTunes Store when they are switching subscriptions. There are also cases where receipt is not delivered to the application and the user has purchased the subscription.

Similar thing happens to us right now. I am getting notifications with `purchasing` state and then immediately with `failed` state and code 0 for any/all auto-renewable subscriptions purchases.

I have created a new sandbox user today. The last time I was checking (around 1 month ago) everything was working smoothly. The IAP code was not changed since then.

same here

Same here.


Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store


Any help or advice?