> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encorekit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Add Subscription Product with RevenueCat

> Route the purchase Encore requests through RevenueCat, or let RevenueCat observe a StoreKit purchase.

## Overview

You still pick the product in App Store Connect and the Encore Dashboard exactly as in [Add Subscription Product](/publishers/ios/quickstart/add-subscription-product). What changes with RevenueCat is how the purchase completes and how RevenueCat learns about it.

***

## Route the purchase through RevenueCat

Register [`onPurchaseRequest()`](/publishers/ios/sdk-reference/on-purchase-request) at app launch. Encore hands your handler the configured product id and RevenueCat performs the purchase, so its entitlements update the way they do for any other RevenueCat sale:

```swift theme={null}
Encore.shared.onPurchaseRequest { purchaseRequest in
    let products = try await Purchases.shared.products([purchaseRequest.productId])
    guard let product = products.first else { return false }
    let result = try await Purchases.shared.purchase(product: product)
    return !result.userCancelled   // true → Encore dismisses the offer sheet
}
```

***

## Or let RevenueCat observe a StoreKit purchase

Without an `onPurchaseRequest` handler, Encore purchases through StoreKit 2 itself. Configure RevenueCat to observe purchases your app completes and it detects the transaction:

```swift theme={null}
Purchases.configure(
    with: .builder(withAPIKey: "YOUR_RC_KEY")
        .with(purchasesAreCompletedBy: .myApp, storeKitVersion: .storeKit2)
        .build()
)
```

<Note>
  No [`onPurchaseComplete()`](/publishers/ios/sdk-reference/on-purchase-complete) handler is needed. RevenueCat detects the StoreKit transaction itself.
</Note>

***

## Next

* [Configure Analytics](./configure-analytics) - forward RevenueCat's subscription events to Encore
