Interrupted in-app purchase (strong customer authentication)

Since the beginning of this year there's a change in the EEA where a payment requires "extra" authentication. This results in our users getting an "error" message before successfully subscribing. We're using the process from this doc:

https://developer.apple.com/documentation/storekit/in-app_purchase/testing_in-app_purchases_with_sandbox

As the docs explain, the transaction will end up in the .failed state when authentication is required. The problem being, is that there is no way of knowing whether something actually went "wrong" or there was just an additional step to take. The error from the transaction doesn't specify anything specific to this.

Result is that our users get an error message (while they were validating their transaction) thinking the payment failed, while in reality it did succeed.

Is there a way to differentiate between this?

Replies

The underlying error of the transaction error allows you to identify this specific use-case.
Code Block
if let error = transaction.error as? NSError,
let underlyingError = error.userInfo["NSUnderlyingError"] as? NSError,
underlyingError.code == 3038 {
// General conditions have changed, don't display an error for the interrupted transaction
}

I cannot find any documentation regarding the underlying error domain (ASDServerErrorDomain) but I've not found any other way to discriminate this error.

Hope it helps,
Aurélien.
Not sure if that error code catches all errors of that type. As a quick fix were now showing an activity indicator and are postponing any error messages for +- 20 secs. This gives us time to keep the error message away from the user, when in that time a purchase was successful after all. Still not the best solution.
Add a Comment