Search code examples
iosin-app-purchasestorekititunes-store

InApp Plan change always gives "Cannot connect to iTunes store" error


I have implemented IAP in my app. It consist of 3 plans(monthly, semi annual, yearly) in 1 group and same level. Its working fine in sandbox for first time purchase. But if am trying to change the plan it will show the confirmation alerts then the transaction will fail with "Cannot connect to iTunes store" error(But in store that purchase will be in success mode. If we try it again then we will get the receipt).

Noticed so many questions on the same error but ma case is plan switching. Can anyone confirm it occurs in only sandbox mode or not?.

I have removed the real accounts from settings, restarted the test device, rechecked with multiple test accounts. Couldn't find the solution.


Solution

  • Finally i have solved this case with a workaround. Even if we got the error or not the receipt will be available, try to validate the receipt. If the subscription plan changed it will get in receipt validation. Don't need to consider the "buyProduct" failed state. No need to display the error just we can try receipt validation if that also failed then the purchase is not done actually.