Code
42
SDK error · code 42
What it means
testStoreSimulatedPurchaseError (code 42) is raised on purpose when you tap "Test failed purchase" in the Test Store purchase dialog. It lets you test your failure handling without a real store. It is not a bug and it cannot happen in production. Tap "Test valid purchase" to complete a test purchase instead.
Code
42
iOS (Swift)
ErrorCode.test
Android (Kotlin)
PurchasesErrorCode.Test
Causes
test_), and the Test Store dialog's failure button was tapped (SimulatedStorePurchaseHandler.swift).Fix
Tap the failure button to check that your app shows a sensible message and leaves the paywall usable.
Tap "Test valid purchase" to run the success path. The SDK then posts a test_ token to the server.
Ship store keys (appl_, goog_) in release builds, and use test_ keys only in development builds.
Your code does not need a special case. Treat it as a failed purchase.
In your app
// Swift
do {
let result = try await Purchases.shared.purchase(package: package)
} catch let error as ErrorCode where error == .testStoreSimulatedPurchaseError {
// handle test store simulated purchase error
}
// Kotlin
if (error.code == PurchasesErrorCode.TestStoreSimulatedPurchaseError) { /* ... */ } On RevenueDot: RevenueDot never sees this error: no receipt is posted for a failed Test Store purchase. A successful Test Store purchase posts a test_<ms>_<id> token to POST /v1/receipts, and the purchase is always stored as sandbox. See Test Store and how to test purchases without real money.
FAQ
A built-in store for development. Its dialog lets you complete a test purchase or simulate a failure without a store account. RevenueDot supports it with test_ keys.
No. It appears only when the SDK uses a Test Store key and you tap the failure button in the dialog.
In React Native, compare error.code with PURCHASES_ERROR_CODE.TEST_STORE_SIMULATED_PURCHASE_ERROR. In Flutter, convert the PlatformException with PurchasesErrorHelper.getErrorCode(e) and compare the result with PurchasesErrorCode.testStoreSimulatedPurchaseError.
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