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

# Using Multiple Managers

> Route Encore purchase requests across several subscription managers and merge their entitlements into one flag.

## Overview

When more than one subscription manager is live in your app, two things need a decision that a single-manager setup makes for you: which manager performs a given purchase, and how you combine each manager's entitlement state with Encore's grants.

The rest of [Add Subscription Product](/publishers/ios/quickstart/add-subscription-product) is unchanged.

***

## Route the purchase

Branch inside your [`onPurchaseRequest()`](/publishers/ios/sdk-reference/on-purchase-request) handler on the product id Encore hands you:

```swift theme={null}
Encore.shared.onPurchaseRequest { purchaseRequest in
    if purchaseRequest.productId.hasPrefix("rc_") {
        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
    }

    guard let product = try await Product.products(for: [purchaseRequest.productId]).first else {
        return false
    }
    let result = try await product.purchase()
    guard case .success = result else { return false }
    return true
}
```

***

## Merge the entitlement state

Each manager publishes its own subscription state, and Encore publishes its grants through [`isActivePublisher()`](/publishers/ios/sdk-reference/is-active-publisher). Combine them into the single flag your UI gates on:

```swift theme={null}
import Combine
import Encore
import RevenueCat
import SuperwallKit

@MainActor
final class EntitlementManager: ObservableObject {
    @Published var hasProAccess = false

    private var cancellables = Set<AnyCancellable>()
    private let revenueCatActive = CurrentValueSubject<Bool, Never>(false)

    init() {
        Purchases.shared.delegate = self

        Publishers.CombineLatest3(
            revenueCatActive.eraseToAnyPublisher(),
            Superwall.shared.$subscriptionStatus,
            Encore.shared.isActivePublisher(for: .freeTrial())
        )
        .map { revenueCat, superwall, encore in
            revenueCat || superwall != .inactive || encore
        }
        .assign(to: \.hasProAccess, on: self)
        .store(in: &cancellables)
    }
}

extension EntitlementManager: PurchasesDelegate {
    nonisolated func purchases(_ purchases: Purchases, receivedUpdated customerInfo: CustomerInfo) {
        Task { @MainActor in
            revenueCatActive.send(!customerInfo.entitlements.active.isEmpty)
        }
    }
}
```

Full contracts: [`isActivePublisher()`](/publishers/ios/sdk-reference/is-active-publisher) · [`isActive()`](/publishers/ios/sdk-reference/is-active) · [`EntitlementScope`](/publishers/ios/sdk-reference/entitlement-scope).
