Xcode 12 iOS 14 error purchase

When try buy product:

<SKPaymentQueue: 0x280569730>: Payment completed with error: Error Domain=ASDErrorDomain Code=500 "Unhandled exception" UserInfo={NSUnderlyingError=0x2809cb300 {Error Domain=AMSErrorDomain Code=301 "Invalid Status Code" UserInfo={NSLocalizedDescription=Invalid Status Code, NSLocalizedFailureReason=The response has an invalid status code}}, NSLocalizedFailureReason=An unknown error occurred, NSLocalizedDescription=Unhandled exception}

Same Problem here,

This is my SKErrorCode:
_nsError: Error Domain=SKErrorDomain Code=0 "An unknown error occurred" UserInfo={NSLocalizedDescription=An unknown error occurred, NSUnderlyingError=0x281341a40 {Error Domain=ASDErrorDomain Code=500 "Unhandled exception" UserInfo={NSUnderlyingError=0x281341f20 {Error Domain=AMSErrorDomain Code=301 "Invalid Status Code" UserInfo={NSLocalizedDescription=Invalid Status Code, NSLocalizedFailureReason=The response has an invalid status code}}, NSLocalizedFailureReason=An unknown error occurred, NSLocalizedDescription=Unhandled exception}}}

I tried in TestFlight App with sandbox

Does anyone know how to handle this?
Or does in app payment work in production not in sandbox?
Have same problem

AMSPurchaseProtocolHandler: [8E2D2E26] Updating buy params from any action
default 12:59:29.078598+0300 appstored AMSPurchaseRequestEncoder: [8E2D2E26] Adding a fraud score to the request. fraudScore =<…>
default 12:59:39.554413+0300 appstored AMSPurchaseProtocolHandler: [8E2D2E26] StatusCode: 502; <private>; Environment: (null)
default 12:59:39.654372+0300 appstored AMSPurchaseTask: [8E2D2E26] Recording engagement event. success: 0
default 12:59:39.654608+0300 appstored AMSEngagement: [ABFD42FB] Enqueueing event for type: purchase, dest: [<AMSEngagementDestination: journeys>] (prev: 8E2D2E26)
error 12:59:39.834878+0300 appstored AMSPurchaseTask: [8E2D2E26] Purchase completed with error: Error Domain=AMSErrorDomain Code=301 “Invalid Status Code” UserInfo={NSLocalizedFailureReason=The response has an invalid status code, AMSURL=hided url, AMSStatusCode=502, NSLocalizedDescription=Invalid Status Code}
error 12:59:39.835083+0300 appstored AMSPurchaseTask: [8E2D2E26] == Failed === -> error = Error Domain=AMSErrorDomain Code=301 “Invalid Status Code” UserInfo={NSLocalizedFailureReason=The response has an invalid status code, AMSURL=hided url, AMSStatusCode=502, NSLocalizedDescription=Invalid Status Code}
default 12:59:39.835356+0300 appstored AMSPurchaseQueue: [8E2D2E26] Finished purchase with error: Error Domain=AMSErrorDomain Code=301 “Invalid Status Code” UserInfo={NSLocalizedFailureReason=The response has an invalid status code, AMSURL=hided url, AMSStatusCode=502, NSLocalizedDescription=Invalid Status Code}
default 12:59:39.835453+0300 appstored AMSPurchaseQueue: [8E2D2E26] Finished batch item purchase with error: Error Domain=AMSErrorDomain Code=301 “Invalid Status Code” UserInfo={NSLocalizedFailureReason=The response has an invalid status code, AMSURL=hided url, AMSStatusCode=502, NSLocalizedDescription=Invalid Status Code}
default 12:59:39.835598+0300 appstored AMSPurchaseQueue: Queue empty
Same here, app rejected by App Review twice in 3 days. Unable to reproduce error until today:

Error Domain=SKErrorDomain Code=0 "An unknown error occurred" UserInfo={NSLocalizedDescription=An unknown error occurred, NSUnderlyingError=0x2812264f0 {Error Domain=ASDErrorDomain Code=500 "Unhandled exception" UserInfo={NSUnderlyingError=0x2812252f0 {Error Domain=AMSErrorDomain Code=100 "Authentication Failed" UserInfo={NSLocalizedFailureReason=The verify credentials call failed., NSLocalizedDescription=Authentication Failed, NSUnderlyingError=0x281225590 {Error Domain=AMSErrorDomain Code=301 "Invalid Status Code" UserInfo=0x2809d01c0 (not displayed)}}}, NSLocalizedFailureReason=An unknown error occurred, NSLocalizedDescription=Unhandled exception}}}

Happened in Sandbox and TestFlight (Release build) with new user without any prior purchases.


NOTE: Upon re-launching the app, the error did not occur. Seems a call to SKReceiptRefreshRequest is causing the error, although only on first launch and input of Apple Id credentials. Also, anytime Apple ID credentials are required the console prints:

[BackgroundTask] Background Task 8 ("SKReceiptRefreshRequest"), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. Remember to call UIApplication.endBackgroundTask(_:) for your task in a timely manner to avoid this.

Which makes sense seeing as app goes in background to give way to Apple Id credentials pop-up. But, even while calling refresh receipt as a named background task and ending it upon completion, another background task for SKReceiptRefreshRequest is created automatically and cannot be ended properly. Not sure if this has anything to do with the original error, perhaps a submission for another thread.

Anyhow, any help on this would be greatly appreciated.


Same issue here. :( anyone found a solution?
Same error here. Is there any solution for this? Is it a problem in apple servers?
I'm with you guys. I have one month subscription in-app purchase, initial purchase works OK, auto-renewals works OK, but when all automatic renewals are proceeded, so it becomes actually "expired" subscription, then when I try to renew this subscription manually it sometimes gives me this error (and sometimes doesn't!) in SKPaymentTransactionObserver .

Code Block
func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction])

Code Block
(lldb) po transactions[0].error
▿ Optional<Error>
- some : Error Domain=SKErrorDomain Code=0 "An unknown error occurred" UserInfo={NSLocalizedDescription=An unknown error occurred, NSUnderlyingError=0x28216fed0 {Error Domain=ASDErrorDomain Code=500 "Unhandled exception" UserInfo={NSUnderlyingError=0x28216e460 {Error Domain=AMSErrorDomain Code=301 "Invalid Status Code" UserInfo={NSLocalizedDescription=Invalid Status Code, NSLocalizedFailureReason=The response has an invalid status code}}, NSLocalizedFailureReason=An unknown error occurred, NSLocalizedDescription=Unhandled exception}}}


Same problem here,

<SKPaymentQueue: 0x2823f06a0>: Payment completed with error: Error Domain=ASDErrorDomain Code=500 "Unhandled exception" UserInfo={NSUnderlyingError=0x282d01290 {Error Domain=AMSErrorDomain Code=301 "Invalid Status Code" UserInfo={NSLocalizedDescription=Invalid Status Code, NSLocalizedFailureReason=The response has an invalid status code}}, NSLocalizedFailureReason=An unknown error occurred, NSLocalizedDescription=Unhandled exception}
Same issue here. Purchases in production seem to still be working fortunately. But it still makes it very hard to do quality assurance.
This is probably a problem with their sandbox servers. I tested it just now, first few purchases failed and then they start working, after some time they stop working again. It is like their servers are working for 5min and then they stop working next 5min.

I think this problem existed before but now we get more detailed error message.
Got the error code reported by Apple

_nsError: Error Domain=SKErrorDomain Code=0 "An unknown error occurred" UserInfo={NSLocalizedDescription=An unknown error occurred, NSUnderlyingError=0x28098eee0 {Error Domain=ASDErrorDomain Code=500305 "Unhandled exception" UserInfo={NSLocalizedDescription=Unhandled exception, NSLocalizedFailureReason=An unknown error occurred}}}


Any idea how to solve this error?
Thanks
I had the same problem with In-App Purchase on iOS 14 and sandbox environment:

Error Domain=SKErrorDomain Code=0 "An unknown error occurred" UserInfo={NSLocalizedDescription=An unknown error occurred, NSUnderlyingError=0x28385e520 {Error Domain=ASDErrorDomain Code=500 "Unhandled exception" UserInfo={NSUnderlyingError=0x28385c510 {Error Domain=AMSErrorDomain Code=100 "Authentication Failed" UserInfo={NSLocalizedFailureReason=The verify credentials call failed., NSLocalizedDescription=Authentication Failed, NSUnderlyingError=0x28385c3c0 {Error Domain=AMSErrorDomain Code=0 "Authentication Failed" UserInfo=0x282361940 (not displayed)}}}, NSLocalizedFailureReason=An unknown error occurred, NSLocalizedDescription=Unhandled exception}}}

Workaround:
Use Apple account with disabled two factor authentication.

P.S. If you cannot sign out because 'Sign out is not available due to restrictions' first turn off 'Screen Time'

My app was rejected when review. Please help me if you known how to handle it.
I test in TestFlight App with sandbox, it is working well. But failed when reviewing by Apple with error : "An unknown error occurred"

My app was rejected when review. Please help me if you known how to handle it.
I test in TestFlight App with sandbox, it is working well. But failed when reviewing by Apple with error : "An unknown error occurred"

Sandbox server is not working sometimes, just write to Apple's Testers to test it again or send a new build (only with increased build number).

same here!
Happens to me also in iOS 14 (Xcode 12). The error occurs for iOS 12 as well, but cannot see the console error this time.
Xcode 12 iOS 14 error purchase
 
 
Q