Not using RevenueCat? No problem! Superwall works out of the box without any additional SDKs.

Integrate RevenueCat with Superwall in one of two ways:

  1. Using a purchase controller: Use this route if you want to maintain control over purchasing logic and code.
  2. Using PurchasesAreCompletedBy: Here, you don’t use a purchase controller and you tell RevenueCat that purchases are completed by your app using StoreKit 1. In this mode, RevenueCat will observe the purchases that the Superwall SDK makes. For more info see here.

1. Create a PurchaseController

Create a new file called RCPurchaseController.swift or RCPurchaseController.kt, then copy and paste the following:

As discussed in Purchases and Subscription Status, this PurchaseController is responsible for handling the subscription-related logic. Take a few moments to look through the code to understand how it does this.

2. Configure Superwall

Initialize an instance of RCPurchaseController and pass it in to Superwall.configure(apiKey:purchaseController):

3. Sync the subscription status

Then, call purchaseController.syncSubscriptionStatus() to keep Superwall’s subscription status up to date with RevenueCat.

That’s it! Check out our RevenueCat iOS example app for a working example of this integration.

Using PurchasesAreCompletedBy

If you’re using RevenueCat’s PurchasesAreCompletedBy, you don’t need to create a purchase controller. Register your placements, present a paywall — and Superwall will take care of completing any purchase the user starts. However, there are a few things to note if you use this setup:

  1. Here, you aren’t using RevenueCat’s entitlements as a source of truth. If your app is multiplatform, you’ll need to consider how to link up pro features or purchased products for users.
  2. If you require custom logic when purchases occur, then you’ll want to add a purchase controller. In that case, Superwall handles purchasing flows and RevenueCat will still observe transactions to power their analytics and charts.
  3. Be sure that user identifiers are set the same way across Superwall and RevenueCat.
  4. Finally, make sure that RevenueCat is using StoreKit 1.

Example:

Superwall.configure(apiKey: "superwall_public_key")
Superwall.shared.identify(userId: user.identifier)
Purchases.configure(with:
  .builder(withAPIKey: "revcat_public_key")
  .with(purchasesAreCompletedBy: .myApp, storeKitVersion: .storeKit1)
  .with(appUserID: user.identifier)
  .build()
)

For more information on observer mode, visit RevenueCat’s docs.