SKPaymentQueue transaction fails with ASDServerErrorDomain Code=5002 in sandbox

1.9k Views Asked by At

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.

1

There are 1 best solutions below

3
payal_makwana On

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.