In-App Purchase fails and every time I get “Cannot connect to iTunes Store” with transaction status returns failed

We have been using IAP auto-renewable subscriptions. We have properly followed integration guideline and able to successfully test IAP subscriptions through Sandbox testers for some devices and get failure for some devices. It’s kind of 50/50 scenario for IAP success/failure.


Its not like Sandbox test users fail for IAP, in production build also IAP fails for many times.


We have debugged the code and found out that when

Code Block
SKPaymentQueue.default().add(payment)

is called, transaction.transactionState is returned as SKPaymentTransactionStatePurchasing and in some time it turns to SKPaymentTransactionStateFailed.


We are getting error -> “Cannot connect to iTunes Store”. Below are some log statements.


Code Block
2020-10-19 18:06:40.663777+0530 Strong Consumer[37652:7035479] [Purchases] - DEBUG: removedTransaction: monthly_5.99 AB64AECB-94AD-45CA-B836-65D0D6EC6D0C ((null) Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store}) {
2020-10-19 18:06:40.664062+0530 Strong Consumer[37652:7035479] [Purchases] - INFO: Subscriber attributes synced successfully