SDK error · code 17

invalidAppleSubscriptionKeyError (error code 17): Invalid Apple subscription key

What it means

invalidAppleSubscriptionKeyError (code 17) means the backend has no valid App Store In-App Purchase key for your app, reported as backend code 7234. Without the key, it cannot verify StoreKit 1 receipts or sign promotional offers. Create the key in App Store Connect, add it to the app's settings on the server, and the SDK will retry on its own.

Code

17

iOS (Swift)

ErrorCode.invalidAppleSubscriptionKeyError

Android (Kotlin)

PurchasesErrorCode.InvalidAppleSubscriptionKeyError

Causes

Why the SDK returns invalidAppleSubscriptionKeyError

  • The backend answered 7234 (invalid Apple subscription key). The iOS SDK maps it to this error; the Android SDK maps it to unexpectedBackendResponseError (BackendErrorCode.swift, errors.kt).
  • No In-App Purchase key is saved on the app, or only part of it is (key ID, issuer ID and private key).
  • The private key is not a valid .p8 file, or Apple rejected it with an authorization error.
  • A promotional offer was requested, and offer signing needs the key.
  • When customer info fails with this error, a debug build with the SDK's failIfInvalidSubscriptionKeyDetectedInDebug flag fails loudly, and any other build falls back to offline entitlements computed on the device (CustomerInfoResponseHandler.swift).
Backend codeMeaning
7234Invalid Apple subscription key: the In-App Purchase key is missing, incomplete or rejected.

Fix

How to fix invalidAppleSubscriptionKeyError

  1. 01

    Create the key in App Store Connect

    Create an In-App Purchase key under App Store Connect's Integrations. Apple explains how API keys are created in Creating API keys to authorize API requests. Download the .p8 file once; Apple does not show it again.

  2. 02

    Add all three values to the app

    Enter the key ID, the issuer ID and the private key on the app in your server's settings. See Connect the App Store.

  3. 03

    Check the app's bundle ID

    The app's bundle_id on the server must equal your app's bundle ID.

  4. 04

    For local development only

    You can set the allow_unsigned_receipts credential on a development server to skip the key. Never use it in production.

In your app

How to handle it in code

  • The SDK retries the purchase by itself once the key is right, because the server answers 5xx for a missing or broken key. Do not build a retry yourself.
  • Do not show this error to customers. It is your setup problem. Alert yourself, and let customers keep using the app.
  • Do not grant access from the error. Customers who paid keep access through the SDK's cached and offline entitlements.
Match the errorSwift · Kotlin
// Swift
do {
  let result = try await Purchases.shared.purchase(package: package)
} catch let error as ErrorCode where error == .invalidAppleSubscriptionKeyError {
  // handle invalid apple subscription key
}

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

On RevenueDot: RevenueDot answers POST /v1/receipts with HTTP 500 and code 7234 when a StoreKit 1 receipt arrives and the app has no In-App Purchase key, when the key is incomplete or not a valid .p8, and when Apple rejects it. It uses 500 on purpose, so the SDK keeps the purchase and retries once you add the key. POST /v1/offers answers 400 with 7234 when the key is missing, which fails only that offer. See 4xx or 5xx on a receipt.

FAQ

invalidAppleSubscriptionKeyError: questions people ask

What is RevenueCat error 7234?

Backend code 7234 means the App Store In-App Purchase key is missing or invalid. The iOS SDK reports it as invalidAppleSubscriptionKeyError (code 17).

Do I need an In-App Purchase key with StoreKit 2?

Yes for the default setup. The SDK's own documentation warns that StoreKit 2 mode needs an In-App Purchase key configured for the app. On RevenueDot the key is required for StoreKit 1 receipts and promotional offer signing.

Will customers lose their purchase because of 7234?

No. RevenueDot answers 7234 with a 5xx status, so the SDK keeps the transaction and posts it again after you add the key.

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

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

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