Code
12
SDK error · code 12
What it means
unexpectedBackendResponseError (code 12) means the SDK received a response it could not use: malformed JSON, a missing field, a non-JSON page from a proxy, or on Android a backend error such as 7110 or 7226. Fetch the same path with curl and compare. Check any proxy between the app and the server, and never grant access from the error.
Code
12
iOS (Swift)
ErrorCode.unexpected
Android (Kotlin)
PurchasesErrorCode.Unexpected
Causes
| Backend code | Meaning |
|---|---|
| 7104 | Invalid App Store shared secret. Android maps it to unexpectedBackendResponseError; iOS maps it to invalidCredentialsError. |
| 7110 | Internal server error. Android maps it here; iOS maps it to unknownBackendError. |
| 7226 | Bad request. Android maps it here; iOS maps it to unknownBackendError. |
| 7234 | Invalid Apple subscription key. Android maps it here; iOS maps it to invalidAppleSubscriptionKeyError. |
Fix
Call the path from the log with curl and the same key. If the answer is not the JSON the SDK expects, the problem is on the server side or in between.
A captive portal, a corporate proxy or a CDN rule that rewrites errors into HTML breaks decoding. Test on another network.
On iOS, userInfo carries extra_context and the response description. They show what the SDK saw.
Run a current server build and a current SDK, so the response shapes match.
In your app
// Swift
do {
let result = try await Purchases.shared.purchase(package: package)
} catch let error as ErrorCode where error == .unexpectedBackendResponseError {
// handle unexpected backend response
}
// Kotlin
if (error.code == PurchasesErrorCode.UnexpectedBackendResponseError) { /* ... */ } On RevenueDot: RevenueDot answers every error with a JSON body and application/json, because iOS ignores bodies otherwise and Android fails on empty ones. Its own unexpected failures are HTTP 500 with code 7110, which the Android SDK shows as this error and the iOS SDK shows as unknownBackendError.
FAQ
The SDK could not decode what the server sent: invalid JSON, a missing field, or a page that is not JSON. Fetch the same path with curl and check for a proxy that rewrites responses.
The Android mapping sends backend codes 7110 (internal server error), 7226 (bad request), 7104 and 7234 to this error. The iOS SDK reports 7110 and 7226 as unknownBackendError.
In React Native, compare error.code with PURCHASES_ERROR_CODE.UNEXPECTED_BACKEND_RESPONSE_ERROR. In Flutter, convert the PlatformException with PurchasesErrorHelper.getErrorCode(e) and compare the result with PurchasesErrorCode.unexpectedBackendResponseError.
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