SDK error · code 5

productNotAvailableForPurchaseError (error code 5): Product not available for purchase

What it means

productNotAvailableForPurchaseError (code 5) means the store has no purchasable product for this customer: the product ID is missing or not approved, it is not sold in the customer's storefront, or Google Play reports the item as unavailable. Check the product in App Store Connect or Play Console and in your offering. Do not retry the same call.

Code

5

iOS (Swift)

ErrorCode.productNotAvailableForPurchaseError

Android (Kotlin)

PurchasesErrorCode.ProductNotAvailableForPurchaseError

Causes

Why the SDK returns productNotAvailableForPurchaseError

  • StoreKit 1: SKError.storeProductNotAvailable, the requested product is not available in the store.
  • StoreKit 2: StoreKitError.notAvailableInStorefront and Product.PurchaseError.productUnavailable (source).
  • Android: Play Billing ITEM_UNAVAILABLE. Google describes it as a product that is not available for purchase for this user and says to refresh product details and check the product's configuration (Google docs).
  • Android Test Store: the product has no purchase option or no base price. The SDK raises this error with "Base price is required for test subscription products".
  • Amazon Appstore: Amazon answered INVALID_SKU for the purchase request.

Fix

How to fix productNotAvailableForPurchaseError

  1. 01

    Check the product in the store

    In App Store Connect or Play Console, confirm the product exists, is not in a rejected or missing-metadata state, and is sold in the customer's country.

  2. 02

    Match the product ID exactly

    The ID in your offering must equal the store product ID. A Google subscription matches its subscription ID or <subscription id>:<base plan id>.

  3. 03

    Wait after creating a product

    A new product can take a while to reach the store. Test again later with a fresh install.

  4. 04

    Set a Test Store price

    For Test Store products, give the product a Test Store price on the dashboard. Without one the Android SDK reports it as unavailable.

In your app

How to handle it in code

  • Do not retry the same call. The product stays unavailable until you or the store fix it.
  • Hide the package or show "not available in your region" so the customer is not stuck on a dead button.
  • Do not grant access. Report the product ID to your own logging so you notice a broken product before customers do.
Match the errorSwift · Kotlin
// Swift
do {
  let result = try await Purchases.shared.purchase(package: package)
} catch let error as ErrorCode where error == .productNotAvailableForPurchaseError {
  // handle product not available for purchase
}

// Kotlin
if (error.code == PurchasesErrorCode.ProductNotAvailableForPurchaseError) { /* ... */ }

On RevenueDot: Your offering's packages point at products by their store identifier, and the SDK asks the store for exactly that ID. If a product's store_identifier in RevenueDot does not equal the store's ID, the store answers with no product. See why an entitlement is not active.

FAQ

productNotAvailableForPurchaseError: questions people ask

Why is my product not available for purchase?

The store has no purchasable product for this customer: the product ID does not match, the product is not approved or ready, or it is not sold in the customer's country. Compare the ID in your offering with the one in the store.

What is ITEM_UNAVAILABLE in Google Play Billing?

Google's code for a product that is not available for purchase for this user. Google says to refresh the product details and check the product configuration and eligibility (Google docs).

How do I check for productNotAvailableForPurchaseError in React Native and Flutter?

In React Native, compare error.code with PURCHASES_ERROR_CODE.PRODUCT_NOT_AVAILABLE_FOR_PURCHASE_ERROR. In Flutter, convert the PlatformException with PurchasesErrorHelper.getErrorCode(e) and compare the result with PurchasesErrorCode.productNotAvailableForPurchaseError.

Get started

Keep the RevenueCat SDK. Change the backend.

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