Code
0
SDK error · code 0
What it means
unknownError (code 0) is the SDK's catch-all: a failure it could not classify, such as a StoreKit or Play Billing error it has no mapping for, or an exception with no better match. The real cause sits in the underlying error and the debug log, so read those first. Do not grant access, and retry only when the customer starts the action again.
Code
0
iOS (Swift)
ErrorCode.unknown
Android (Kotlin)
PurchasesErrorCode.Unknown
Causes
SKError code the SDK does not map. The SKError mapping covers a fixed list, and anything else, including undocumented codes, falls through to unknownError.StoreKitError or Product.PurchaseError case that is newer than the SDK. The StoreKit mapping sends every unknown case here.PurchasesErrorHelper.getErrorCode returns unknownError when the platform error code is outside the enum's range.Fix
On iOS, read NSUnderlyingErrorKey and readable_error_code from userInfo. On Android, read error.underlyingErrorMessage. They name the StoreKit, Play or backend error that the SDK could not map.
Set Purchases.logLevel = .debug on iOS or Purchases.logLevel = LogLevel.DEBUG on Android, reproduce the failure, and read the lines before the error.
If rc_backend_error_code is in userInfo (iOS), the failure came from the server and the number says which. Look it up in the table on this site's error list.
A StoreKit or Play Billing error that is new to the OS can be unmapped in an old SDK. Update to the latest SDK release and test again.
In your app
// Swift
do {
let result = try await Purchases.shared.purchase(package: package)
} catch let error as ErrorCode where error == .unknownError {
// handle unknown error
}
// Kotlin
if (error.code == PurchasesErrorCode.UnknownError) { /* ... */ } On RevenueDot: RevenueDot always answers failures with a JSON body that has a numeric code, so a server failure reaches the SDK as a backend error (unknownBackendError at worst), not as unknownError. See what RevenueDot's API errors mean.
FAQ
It is the SDK's fallback for a failure it cannot classify. The cause is in the underlying error: read NSUnderlyingErrorKey on iOS or underlyingErrorMessage on Android, and turn on debug logs.
Usually not. Server problems arrive as backend errors with their own codes (unknownBackendError, storeProblemError, and so on). unknownError mostly comes from an unmapped StoreKit, Play Billing or system error on the device.
In React Native, compare error.code with PURCHASES_ERROR_CODE.UNKNOWN_ERROR. In Flutter, convert the PlatformException with PurchasesErrorHelper.getErrorCode(e) and compare the result with PurchasesErrorCode.unknownError.
Get started
RevenueDot answers the same SDK calls with the same error codes. Start free on RevenueDot Cloud, free up to $10,000 a month in tracked revenue.
Already have an account? Sign in · Prefer your own servers? Self-host free