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

# App Store Connect Setup

> Connect your Apple Developer account and automate App Store Connect configuration

## Prerequisites

To create subscriptions and submit your app to the App Store, you need an [Apple Developer Program](https://developer.apple.com/programs/) membership.

<Warning>
  The Apple Developer Program costs **\$99 USD/year**. This is separate from a free Apple ID — you must be enrolled in the paid developer program. [Enroll here](https://developer.apple.com/programs/enroll/).
</Warning>

## Connecting your Apple account

1. Open the **Deploy modal** in the Newly dashboard (click "Deploy" on your project)
2. Click **Build & Deploy** and select **iOS**
3. The Apple Credentials section will appear

You have two options:

### Automatic setup (recommended)

1. Enter your **Apple ID** email and password
2. Complete **two-factor authentication** if prompted (code sent to your trusted device or phone)
3. **Select your team** from the list of teams associated with your Apple account
4. Newly **auto-provisions all required keys** — you'll see checkmarks as each one is created
5. **Select or create your app** — Newly pre-fills the name and bundle ID from your project

### Manual setup

If you prefer to manage your own keys, you can upload them individually:

* **ASC API Key** — Key ID + .p8 private key file
* **IAP Key** — Key ID + .p8 private key file
* **APNs Key** — Key ID + .p8 private key file
* **Team ID** and **Bundle ID**

You can find or create these in the [Apple Developer portal](https://developer.apple.com/account/resources/authkeys/list) under Keys.

<Tip>
  Credentials are stored encrypted and shared across all your Newly projects — you only need to connect your Apple account once.
</Tip>

## What gets auto-provisioned

During automatic setup, Newly creates three API keys in your Apple Developer account:

| Key                   | Purpose                                                               |
| --------------------- | --------------------------------------------------------------------- |
| **ASC API Key** (.p8) | Manage products and subscriptions in App Store Connect                |
| **IAP Key** (.p8)     | Allow RevenueCat to validate subscription receipts from the App Store |
| **APNs Key** (.p8)    | Enable push notifications (e.g., subscription renewal reminders)      |

These keys are visible in your [Apple Developer account](https://developer.apple.com/account/resources/authkeys/list) under Keys.

## How products get created in App Store Connect

Once your Apple credentials and RevenueCat catalog both exist, Newly automatically creates matching products in App Store Connect:

* A **subscription group** called "NSubscriptions"
* **Subscription products** with the same product IDs as your RevenueCat catalog
* **English localizations** for each product

These products appear in your App Store Connect account ready for App Review — no manual product creation needed.

<Info>
  **Setup order doesn't matter.** You can connect Apple first and RevenueCat later, or the other way around. Newly detects which pieces are already in place and fills in the gaps automatically.
</Info>

## Production SDK keys

After the store setup completes, Newly:

1. Creates **App Store** and **Play Store** app entries in your RevenueCat project
2. Attaches your Apple credentials (ASC + IAP keys) to the RevenueCat app
3. Fetches **production SDK keys** (`appl_*` for iOS, `goog_*` for Android)
4. Writes the keys to your app's `app.json` automatically

See [Technical Details](/subscriptions/technical-details) for the full list of keys and generated files.

***

## Under the hood

You don't need to know this to use Newly, but it may help if you're debugging or curious about how the automation works.

### Idempotent operations

All automated operations are safe to run multiple times:

* **Catalog creation** skips products that already exist in RevenueCat
* **ASC product creation** skips subscriptions that already exist in App Store Connect
* **Store setup** updates credentials on existing RevenueCat apps rather than creating duplicates

This means retrying a failed setup or re-running the flow won't create duplicate products or break your configuration.

### Token management

RevenueCat OAuth tokens expire after approximately 1 hour. Newly handles this automatically:

* Tokens are **auto-refreshed** before API calls when expired
* **Concurrent requests** are handled safely — if multiple operations detect an expired token at the same time, only one refresh happens and the others pick up the new token
* If auto-refresh fails (e.g., the token was revoked), you'll see a "Reconnect RevenueCat" prompt

### Retrigger mechanism

When you upload Apple credentials after RevenueCat is already connected, a background task automatically:

1. Re-runs store setup (attaches credentials to your RevenueCat apps)
2. Creates ASC subscription products (if your catalog already exists)
3. Fetches updated production keys

This runs in the background — you can continue working while it completes. The retrigger fires from any Apple credential action: auto-provisioning, manual key upload, or app selection.

### Product ID uniqueness

Product identifiers in App Store Connect are **globally unique and can never be reused** — even after deletion. To prevent collisions, Newly appends a project-scoped hash to each product ID:

```
pro_monthly_9_99_a1b2c3
└── price ──────┘ └─ project hash
```

This ensures your products never conflict with other apps or previously deleted products.

### Credential reference

| Credential        | Purpose                           | How it's obtained                 |
| ----------------- | --------------------------------- | --------------------------------- |
| ASC API Key (.p8) | Manage App Store Connect products | Auto-provisioned or manual upload |
| IAP Key (.p8)     | RevenueCat receipt validation     | Auto-provisioned or manual upload |
| APNs Key          | Push notifications                | Auto-provisioned                  |
| RC Access Token   | RevenueCat API calls              | OAuth flow, auto-refreshed hourly |
| RC Refresh Token  | Refresh the access token          | OAuth flow, rotated on each use   |
