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}

My app was also rejected because of SKError.Code.unknown during the app review. The deepest internal error had code 500305 with message "Unhandled exception". With the help of Code-Level Support I was able to rewrite IAP-related code, to make it successfully pass the app review. In my case the unknown error occurred, because the app tried to refresh receipt when it was missing and review team always canceled authentication dialog that appeared after SKReceiptRefreshRequest. The correct way to handle a missing appStoreReceipt is to ask whether the user wants to refresh it. Eventually, I just made app to ignore receipt if it is missing. If user purchased something on another device then there is always a "Restore" button available in my app. Moreover, in production the appStoreReceipt is almost always available.
Same issue , did anyone found a solution ?

remove payment.applicationUsername = @"";

We have the same problem (iOS 14.6, using TestFlight accounts). What is the solution?

Xcode 13, tvOS simulator same. Both on sandbox account and not.

<SKPaymentQueue: 0x60000171af30>: Payment completed with error: Error Domain=ASDErrorDomain Code=500 "Unhandled exception" UserInfo={NSUnderlyingError=0x600001bbaca0 {Error Domain=AMSErrorDomain Code=100 "Authentication Failed" UserInfo={NSLocalizedFailureReason=The verify credentials call failed., NSLocalizedDescription=Authentication Failed, NSUnderlyingError=0x600001b89b60 {Error Domain=AMSErrorDomain Code=15 "An unknown error occurred. Please try again." UserInfo={NSLocalizedDescription=An unknown error occurred. Please try again.}}}}, NSLocalizedFailureReason=An unknown error occurred, NSLocalizedDescription=Unhandled exception}

This solved it for me:

You must be signed in to the App Store with the same user as specified in:

Menu: Product > Scheme > Edit Scheme > Test > info > Debug Process as: appstoreusername

The same issue occurred in my App on Testflight. Sometimes It works well, and sometimes It doesn't work. I don't know that is Apple maintaining something?

Xcode 12 iOS 14 error purchase
 
 
Q