2

Suddenly in-app purchases of already productive IAPs are failing in the sandbox with the error code:

<SKPaymentQueue: 0x283f14fd0>: Payment completed with error: 
Error Domain=ASDServerErrorDomain Code=5002 "An unknown error has occurred" 
UserInfo={NSLocalizedDescription=An unknown error has occurred}

Console.app logs show this:

UserInfo={AMSURL=https://sandbox.itunes.apple.com/WebObjects/MZFinance.woa/wa/inAppBuy?guid=1fd5f870740861ead0ea8c82542657a65d3aad90, AMSServerErrorCode=5002, NSLocalizedFailureReason=An unknown error has occurred, AMSServerAllowed=false, NSLocalizedDescription=Server Error, AMSStatusCode=200, AMSServerPayload={
    "cancel-purchase-batch" = 1;
    customerMessage = "An unknown error has occurred";
    failureType = 5002;
    "m-allowed" = 0;
    pings =     (
    );
}}

I'm using real devices (using iOS 12, iOS 14.4, iOS 14.5 (beta 7))...to answer this similar question.
I'm deploying with Xcode 12.4 / Xcode 12.5 (beta 3)...to answer this similar question.
I have no changes in my code nor changed the in-app purchases.
Same error appears also when testing via TestFlight The error does not happen, when I connect with a sandbox account with region "United States" and use a VPN trough the United States.

The error happens with the following combinations:

  • environment: sandbox
  • various Apple IDs with AppStore country United States and others, but logging in with a European IP
  • Xcode deploy and TestFlight
  • iOS 12, 14.4, 14.5
  • iPhone 6, 7, X
  • same build that is currently in production
  • same code that was working once
  • only with two auto-renewing subscriptions (that are in production since 9 months)

The error does NOT in each of the following cases:

  • environment: production
  • when using a new auto-renewing IAP just for testing purposes
  • when logging in with a Apple-ID with country United States and with a US IP

What does this error mean? Where can I find information about this? How can this be fixed?

Any help appreciated :)

UPDATE

The error is no longer happening. Again without any changes from my side. I was in contact with the Apple Support but they couldn't explain me what was happening - probably also because it was working when testing from the US.

Since neither of my questions have been answered I will leave this question open. Maybe it helps someone experiencing similar issues.

themenace
  • 2,601
  • 2
  • 20
  • 33

1 Answers1

1

I was facing the same error code in the Auto-renew subscription when I've added a new subscription in App Store Connect under In-App Purchase.

  • I've added a new subscription with proper product_id and it's working fine now.
  • Product ID must be added in this formate -- com.(appName).app.(subscriptionName).
  • I was used '_' in the Product ID. Maybe that's the issue.

Hope your issue will resolve with this solution.

  • I do use '_' ... but these are allowed. Since the problem arrises with existing products I do not have the possibility to change the product IDs. – themenace Apr 23 '21 at 07:18
  • You mentioned that The error does not happen when you connect with a sandbox account with the region "United States". In my case, all sandbox accounts are working fine in TestFlight and in local testing(Direct from Xcode). Surely, there is an issue with product IDs. Try to add a new In-App purchase for testing. It might solve your problem. – payal_makwana Apr 23 '21 at 11:13
  • Yes it must be an issue with certain product IDs. I already added a new product and this works fine. But again, since those IDs are already in production I cannot change them. I've updated the description again to give a clear overview of what's working and what's not. I truly appreciate your help, but sadly, none of my questions have been answered :/ – themenace Apr 24 '21 at 19:45