> ## 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.

# Testing Purchases

> How to test subscriptions in Expo Go, dev builds, web preview, and production

## Expo Go limitations

<Warning>
  **Purchases do not work in standard Expo Go.** The RevenueCat SDK and SecureStore (used for credential storage) are not available in Expo Go.
</Warning>

To test real purchases, you need either:

* A **custom dev build** (`npx expo prebuild` then build for your device)
* A **production build** (through app store or ad-hoc distribution)

## Test vs production API keys

Newly automatically manages two sets of API keys:

| Environment        | Key type                            | When used               |
| ------------------ | ----------------------------------- | ----------------------- |
| Dev/Preview builds | Test Store keys (`test_*`)          | When `__DEV__` is true  |
| Production builds  | iOS (`appl_*`) / Android (`goog_*`) | When `__DEV__` is false |

**You don't need to manage this manually.** The app automatically uses test keys in development and real keys in production. The switching happens at runtime based on React Native's `__DEV__` flag.

## Web preview

You can preview your paywall in the web browser. Here's how it works:

* **Pricing is real** — mock data is fetched from your RevenueCat dashboard so prices shown match your actual product configuration
* **Purchases are simulated** — no real charges occur in web preview
* **Purchases persist** — test purchases persist across page reloads so you can test the full flow

<Tip>
  Web preview is great for testing your paywall UI and flow. For testing actual purchase mechanics, use a dev build or production build on a real device.
</Tip>

## Testing checklist

<Steps>
  <Step title="Test in web preview first">
    Verify the paywall looks correct and the flow works end-to-end.
  </Step>

  <Step title="Build a dev build">
    Run `npx expo prebuild` and build for your device to test with Test Store keys.
  </Step>

  <Step title="Test on a real device">
    Use Apple's sandbox testing or Google Play's test tracks for real purchase flows.
  </Step>
</Steps>
