Search code examples
iossubscriptiontvosappstore-sandbox

Apple AppStore Sandbox renewable subscription purchase not succeeding


The issue is occurring in a setup where target Xcode scheme StoreKit configuration is set to None and on standalone ipa builds. Hence real remote AppStore sandbox is used. enter image description here Upon subscription attempt both on iOS & tvOS across vast version range we've identified following errors occuring:

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

and

Error Domain=SKErrorDomain Code=0 "An unknown error occurred" UserInfo={NSLocalizedDescription=An unknown error occurred, NSUnderlyingError=0x28039b6f0 {Error Domain=ASDServerErrorDomain Code=5008 "Sign in to view account information." UserInfo={NSLocalizedDescription=Sign in to view account information.}}}

and

<SKPaymentQueue: 0x280f1fa10>: Payment completed with error: Error Domain=ASDErrorDomain Code=500 "Unhandled exception" UserInfo={NSUnderlyingError=0x2803a4720 {Error Domain=AMSErrorDomain Code=301 "Invalid Status Code" UserInfo={NSLocalizedDescription=Invalid Status Code, AMSURL=https://sandbox.itunes.apple.com/WebObjects/MZBuy.woa/wa/inAppBuy?REDACTED, AMSStatusCode=500, NSLocalizedFailureReason=The response has an invalid status code}}, NSLocalizedFailureReason=An unknown error occurred, NSLocalizedDescription=Unhandled exception}

We have not identified any change in our code causing this. Old builds which used to work now experience this issue.


Solution

  • The culprit turned out be our Appstore Connect configuration of our subscriptions. In the subscription config, there was a warning issued that we do not have App Store Localization. enter image description here The bug(?)/requirement in Apple Sandbox must be a fairly recent change introduced around July/August 2022. The very same configuration was working flawlessly for us before.

    This is the App Store connect state BEFORE the Localization missing config fix was added: enter image description here and after it was added: enter image description here

    After adding this sandbox subscriptions started working normally immediately.

    Do not forget removing the app from the device before performing any further testing.