"Cannot connect to iTunes Store" in-app purchases

Solution 1:

Make sure you have signed out of any production iTunes accounts on the device.

I was getting this error on my test phone which was logged in with my actual iTunes account. You cannot test apps using your production iTunes account, hence the error. I just wish Apple provided a better error so as to avoid this guesswork...

Solution 2:

see In-App Purchase FAQ: Cannot connect to iTunes Store

Your app is running in the Simulator, which does not support In-App Purchase

For testing in app purchases always use real devices.

Solution 3:

For newcomers, make sure your in-app purchasing product's status is Ready to Submit, with no "missing metadata". In my case, what was missing was the localization of the subscription's group.

enter image description here