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

# RevenueCat Integration

> Add in-app purchases and subscriptions to your app

# RevenueCat Integration

RevenueCat makes it easy to add in-app purchases and subscriptions to your Newly app. Handle payments, manage subscriptions, and track revenue without complex payment infrastructure.

## What is RevenueCat?

RevenueCat is a subscription management platform that:

* **Handles payments** - Process iOS and Android purchases
* **Manages subscriptions** - Track status, renewals, cancellations
* **Syncs across platforms** - One subscription works on both iOS and Android
* **Provides analytics** - Revenue, churn, and subscriber metrics

## Setting Up RevenueCat

<Steps>
  <Step title="Press on &#x22;More&#x22; in Newly and then RevenueCat">
    You will be prompted to create an account / sign in to your RevenueCat account and authorize permissions to Newly.
  </Step>

  <Step title="Create a Project & Press Connect">
    Create a new project in RevenueCat
  </Step>

  <Step title="Create a Project & Press Connect">
    Newly automatically creates a Paywall, product, entitlements and connects this to your app with 1 prompt.
  </Step>

  <Step title="Configure App Store Connect">
    Add your iOS app with App Store Connect credentials
  </Step>

  <Step title="Configure Play Console">
    Add your Android app with Google Play Console credentials
  </Step>

  <Step title="Market app & make money" />
</Steps>

## Modifying Purchases to Your App

Tell the AI what you want to sell:

```
Add a premium subscription with monthly ($9.99) and yearly ($79.99) options.
Show a paywall screen when users try to access premium features.
After purchase, unlock the premium features.
```

### Common Patterns

<Tabs>
  <Tab title="Paywall Screen">
    ```
    Create a paywall screen that shows:
    - List of premium features
    - Monthly and yearly pricing options
    - "Restore Purchases" button (required for App Store)
    - Terms and privacy links at bottom (required for App Store)
    ```
  </Tab>

  <Tab title="Feature Gating">
    ```
    Make the AI chat feature premium-only.
    When non-subscribers tap it, show the paywall.
    Subscribers should have unlimited access.
    ```
  </Tab>

  <Tab title="Consumable Purchase">
    ```
    Add a "credits" system where users can buy
    100 credits for $4.99. Deduct credits when
    they use premium features.
    ```
  </Tab>
</Tabs>

## Purchase Types

RevenueCat supports:

| Type               | Description                 | Example                |
| ------------------ | --------------------------- | ---------------------- |
| **Subscription**   | Recurring payment           | Monthly premium access |
| **Non-consumable** | One-time permanent purchase | Remove ads forever     |
| **Consumable**     | Single-use purchases        | Credits, tokens        |

## Entitlements

Entitlements are what users get access to after purchasing:

```
Create a "premium" entitlement that includes:
- Unlimited projects
- AI assistance
- Priority support
- Custom themes

Both monthly and yearly subscriptions grant "premium" entitlement.
```

## Checking Subscription Status

The AI will generate code to check if users have active subscriptions:

```tsx theme={null}
// Example generated code
const { customerInfo } = await Purchases.getCustomerInfo();
const isPremium = customerInfo.entitlements.active['premium'];

if (isPremium) {
  // Show premium features
} else {
  // Show paywall
}
```

## Restore Purchases

Always include a restore option for users who:

* Reinstall the app
* Switch devices
* Had billing issues

```
Add a "Restore Purchases" button in settings that
checks for previous purchases and restores access.
```

## Testing Purchases

### Sandbox Testing

Before going live:

1. Use Apple/Google sandbox accounts
2. Purchases are simulated (no real charges)
3. Subscription periods are shortened for testing

<Tabs>
  <Tab title="iOS">
    Use a Sandbox Apple ID created in App Store Connect
  </Tab>

  <Tab title="Android">
    Add license testers in Google Play Console
  </Tab>
</Tabs>

### RevenueCat Dashboard

Monitor purchases in the RevenueCat dashboard:

* Active subscriptions
* Revenue metrics
* Customer history
* Error logs

## Best Practices

<CardGroup cols={2}>
  <Card title="Clear Value Proposition" icon="star">
    Show what users get before asking them to pay
  </Card>

  <Card title="Multiple Options" icon="list">
    Offer monthly and yearly (with discount) options
  </Card>

  <Card title="Free Trial" icon="gift">
    Consider offering a free trial period
  </Card>

  <Card title="Restore Button" icon="rotate">
    Always include restore purchases option
  </Card>
</CardGroup>

## App Store Requirements

Both app stores have requirements for in-app purchases:

### Apple App Store

* Must use Apple's IAP for digital goods
* Clearly display pricing
* Terms of service required
* Auto-renewal disclosure

### Google Play Store

* Must use Google Play Billing for digital goods
* Clear subscription terms
* Easy cancellation access
* Price displayed before purchase

<Warning>
  Violating app store payment policies can result in app rejection or removal.
</Warning>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Purchases Not Working">
    * Verify RevenueCat is connected correctly
    * Check product IDs match in app and stores
    * Ensure app is properly configured in App Store Connect / Play Console
  </Accordion>

  <Accordion title="Restore Not Finding Purchases">
    * User must be signed into same App Store / Play Store account
    * Check sandbox vs production environment
    * Verify subscription hasn't expired
  </Accordion>

  <Accordion title="Entitlement Not Granted">
    * Check RevenueCat dashboard for the purchase
    * Verify entitlement is linked to product
    * Check for webhook configuration issues
  </Accordion>
</AccordionGroup>

## Resources

<CardGroup cols={2}>
  <Card title="RevenueCat Docs" icon="book" href="https://docs.revenuecat.com">
    Official RevenueCat documentation
  </Card>

  <Card title="Pricing Best Practices" icon="dollar-sign" href="https://www.revenuecat.com/blog/growth/subscription-pricing-guide/">
    Guide to subscription pricing
  </Card>
</CardGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Deployment" icon="rocket" href="/features/deployment">
    Deploy your app with payments
  </Card>

  <Card title="Backend Features" icon="server" href="/features/backend">
    Add backend functionality
  </Card>
</CardGroup>
