SKTestSession's failureError is not respected

I am trying to test paymentCanceled use case using SKTestSession. Here is the code I am using:

Code Block
var session = try? SKTestSession(configurationFileNamed: "PurchasesWithProducts")
session?.disableDialogs = true
session?.failTransactionsEnabled = true
session?.failureError = .paymentCancelled


The problem is whatever value I set to failureError the returned error is always:

Code Block
Error Domain=SKErrorDomain Code=0 "UNKNOWN_ERROR" UserInfo={NSLocalizedDescription=UNKNOWN_ERROR, NSUnderlyingError=0x60000138ee50 {Error Domain=ASDServerErrorDomain Code=9999 "The server encountered an error" UserInfo={NSLocalizedDescription=The server encountered an error}}})


To me it seems like failureError property is not respected.

Also the docs are a bit misleading:


You can force an error by setting failTransactionsEnabled to true and setting failureError value to one of these supported error codes: SKError.Code.unknown, SKError.Code.invalidOfferIdentifier, SKError.Code.invalidSignature, SKError.Code.missingOfferParams, SKError.Code.invalidOfferPrice.

At first I would think that I can only use those error codes but even by using those codes I am getting the same error.

  • Did you ever fix this? I'm running into the same issue.

Add a Comment