What does purchaseInvalidError (code 4) mean in the purchases SDK?
The purchases SDK raises purchaseInvalidError (code 4) when the store or the backend says an argument of the purchase is not valid.
Quick facts#
| Error | ErrorCode.purchaseInvalidError (iOS), PurchasesErrorCode.PurchaseInvalidError (Android), code 4 |
| Where | Purchases SDK (iOS, Android and the hybrid SDKs built on them) |
| What the vendor says | One or more of the arguments provided are invalid. |
Cause#
- Android: Play Billing
DEVELOPER_ERROR, the code Google uses for incorrect use of the API, maps here. - StoreKit 2:
StoreKitError.unsupportedmaps here when the SDK is built with Swift 6.1 or later. - The backend answered a code the SDK treats as an invalid purchase request, such as 7105 (invalid payment mode) or 7106 (missing Google product ID), or an invalid web redemption token.
Fix#
- Read the underlying error and the debug message; they name the invalid argument.
- Check the product, offer and options you pass against what is configured in the store and on the server.
- On Android, check for a signed build and a non-empty product list, as Google lists for
DEVELOPER_ERROR. - Do not retry with the same arguments; the result will not change.
Example#
Swift
// The purchases SDK throws `ErrorCode` values; match the one you handle and let the rest fall through.
func handle(_ error: Error) {
guard let code = error as? ErrorCode else {
print("Not a purchases SDK error: \(error)")
return
}
switch code {
case .purchaseInvalidError:
// A bug in the arguments: log the underlying error and fix the call, do not retry.
print("The purchase arguments are invalid")
default:
print("Other purchases error: \(code.description)")
}
}Compile-checked: npm run check:snippets type-checks this snippet with swiftc together with the ErrorCode.swift file of the RevenueDot purchases-ios fork (checked 2026-10-03).
How the RevenueDot SDK reports it#
Deep dive: revenuedot.app/errors/purchase-invalid-error.
Related#
- What does Play Billing DEVELOPER_ERROR (5) mean?
- What does StoreKitError.unsupported mean?
- What does configurationError (code 23) mean in the purchases SDK?
- What RevenueDot's API errors mean (server codes)
Source#
- RevenueDot purchases-ios: ErrorCode.swift (the iOS ErrorCode enum)
- RevenueDot purchases-android: PurchasesErrorCode.kt (the Android enum)
- RevenueDot purchases-ios: StoreKitError+Extensions.swift
- RevenueDot purchases-android: google/errors.kt (Play Billing mapping)
- RevenueDot purchases-ios: BackendErrorCode.swift (backend code mapping)
Checked: 2026-10-03