Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.newly.app/llms.txt

Use this file to discover all available pages before exploring further.

Keys in app.json

After setup, the following keys are added to your app.json (under the extra field):
KeyExampleDescription
revenueCatApiKeyIosappl_...Production iOS API key
revenueCatApiKeyAndroidgoog_...Production Android API key
revenueCatTestApiKeytest_...Test Store key for dev builds
revenueCatEntitlementIdproThe entitlement to check (always “pro”)
The app automatically selects test keys in development (__DEV__ is true) and production keys in release builds.

Generated files

The AI agent creates or modifies these files:
FilePurpose
SubscriptionContext.tsxReact context provider wrapping the RevenueCat SDK. Handles initialization, purchase state, and optionally syncs user ID if auth exists.
/paywall screenThe paywall UI where users can subscribe. Shows pricing, features, and purchase buttons.
_layout.tsxModified to wrap the app in SubscriptionProvider and add a SubscriptionRedirect for enforcing the paywall.
Onboarding integrationIf onboarding exists, the paywall is wired into the flow after onboarding completes.

Dependencies

The react-native-purchases package is installed automatically.
Do not add react-native-purchases to the plugins array in app.json. This causes build errors. The SDK is configured entirely through SubscriptionContext.tsx, not as an Expo plugin.

How API key switching works

The generated SubscriptionContext.tsx includes logic like:
const apiKey = __DEV__ && testApiKey ? testApiKey : platformApiKey;
  • In development builds, the Test Store key is used so you can simulate purchases safely
  • In production builds, the real iOS or Android key is used for actual App Store / Play Store purchases
  • This switching is automatic — you don’t need to change anything between environments

Storage key scoping

To prevent conflicts between multiple apps that might share the same Expo slug, the subscription context uses your Newly project ID in its storage key. This ensures subscription state is isolated per-app.