SDK

iOS in-app subscriptions with StoreKit 2 and the RevenueDot SDK

To add iOS in-app subscriptions, install the RevenueDot Swift SDK with Swift Package Manager or CocoaPods and call Purchases.configure with your app's appl_ key. RevenueDot verifies each StoreKit 2 transaction with Apple and keeps each customer's access in sync. It covers iOS, iPadOS, macOS, tvOS, watchOS and visionOS. RevenueDot Cloud is free until your app makes $10,000 a month.

Free until your app makes $10,000 a month. Switching from RevenueCat? Change one line.

A RevenueDot paywall rendered by the RevenueDot SDK on an iPhone simulator
A RevenueDot paywall rendered on an iPhone simulator.

One package

Add github.com/revenuedot/purchases-ios at 5.91.0-revenuedot, or the RevenueDotPurchases pod.

StoreKit 2 checked by the server

RevenueDot verifies signed transactions against Apple's root certificate, and the App Store Server API supplies history.

Test Store first

Buy with a test_ key in a Debug build before you have an App Store account.

Paywalls and web purchases

RevenueCatUI shows paywalls you design in the dashboard, and redeemWebPurchase gives buyers from a web purchase link access.

Steps

How to add subscriptions to an iOS app with RevenueDot

  1. 01

    Create a free Cloud project and an App Store app

    Start for free on RevenueDot Cloud and add an App Store app with your bundle ID. Copy its appl_ public key.

  2. 02

    Connect Apple

    Add an In-App Purchase key and paste the notification URL into App Store Connect as a Version 2 server notification URL. See App Store setup.

  3. 03

    Create your catalog

    Add your products, an entitlement such as pro (the access your app checks) and an offering named default (the products your paywall shows).

  4. 04

    Install the RevenueDot SDK and configure it with your key

    Add the package with Swift Package Manager or CocoaPods, then call Purchases.configure(withAPIKey:) once at launch, as in the code below. On Cloud the SDK already points at RevenueDot, so your key is the only setting.

  5. 05

    Buy and check the entitlement

    Call purchase(package:) and read customerInfo.entitlements["pro"]?.isActive. RevenueDot verifies the purchase with Apple and updates the customer's access.

  6. 06

    Test with the Test Store, then the sandbox

    Use a test_ key in a Debug build to buy with no App Store account. Before release, buy with a sandbox tester. See the Test Store.

Install

Install the RevenueDot iOS SDK and configure it with your key

The RevenueDot SDK is built from RevenueCat's open-source SDK (MIT license), so your code imports RevenueCat and calls Purchases. It sends every request to RevenueDot and needs no RevenueCat account.

For paywalls, add the RevenueCatUI product or the RevenueDotPurchasesUI pod. It shows the paywalls you design in the dashboard.

Self-hosting? Set Purchases.proxyURL to your server's HTTPS URL before configure, and set entitlement verification to .disabled (the default is .informational). Your server signs responses with its own key, which the SDK does not trust unless you build it with your public key. See Trusted Entitlements.

Install, then configure at launchSwift
// Swift Package Manager: Xcode > File > Add Package Dependencies
.package(url: "https://github.com/revenuedot/purchases-ios", exact: "5.91.0-revenuedot")
// Products: RevenueCat, plus RevenueCatUI for paywalls

// Or CocoaPods
pod "RevenueDotPurchases", "5.91.0"   // RevenueDotPurchasesUI for paywalls

// At launch, in your App initializer or app delegate
import RevenueCat

Purchases.configure(withAPIKey: "appl_...")

Swift

Check the entitlement, then buy a package

Check access and buySwift
let customerInfo = try await Purchases.shared.customerInfo()
let isPro = customerInfo.entitlements["pro"]?.isActive == true

let offerings = try await Purchases.shared.offerings()
if let package = offerings.current?.availablePackages.first {
    let result = try await Purchases.shared.purchase(package: package)
    if !result.userCancelled, result.customerInfo.entitlements["pro"]?.isActive == true {
        // Show pro features.
    }
}

Notes

Check these iOS details before you ship

  • Test Store keys work in Debug builds only. A Release build shows a Wrong API Key alert and stops on purpose. Ship with your appl_ key.
  • Web checkout: a RevenueCatUI paywall's web checkout button opens Stripe Checkout on your own Stripe account for the current user. See web to app.
  • Before you ship: run a purchase with a sandbox tester and check it on the customer page.

Switch

Switching from RevenueCat? Keep your Swift SDK and change one line

If your app already ships the RevenueCat Swift SDK, you can keep it. Set Purchases.proxyURL to RevenueDot before configure and turn entitlement verification off. Then call syncPurchases() once on the first launch of the update, so current subscribers keep access. The full plan is in Migrate from RevenueCat.

  • Verification: the stock SDK checks responses against RevenueCat's key, so set .disabled. Never use .enforced with the stock SDK: RevenueDot cannot sign with RevenueCat's key, so every request would fail.
  • Keys: the importer keeps your RevenueCat appl_ key working, so builds you already shipped keep their key.
  • Tested: the unmodified RevenueCat iOS SDK 5.92 passes configure, offerings, a Test Store purchase and logIn against RevenueDot on an iPhone simulator.
Point the RevenueCat SDK at RevenueDotSwift
import RevenueCat

// Before Purchases.configure
Purchases.proxyURL = URL(string: "https://api.revenuedot.app")!
Purchases.configure(
    with: Configuration.Builder(withAPIKey: "appl_...")
        // Default is .informational, which logs every RevenueDot response as a failed check.
        .with(entitlementVerificationMode: .disabled)
        .build()
)

// Once, on the first launch of this update
_ = try? await Purchases.shared.syncPurchases()

FAQ

iOS: questions people ask

Do I need a RevenueCat account to use the RevenueDot iOS SDK?

No. The RevenueDot SDK is built from RevenueCat's open-source Swift SDK under the MIT license, but every request goes to RevenueDot. Create a free RevenueDot Cloud project, copy your app's appl_ key and pass it to Purchases.configure.

How do I add in-app subscriptions to an iOS app with StoreKit 2?

Install the RevenueDot Swift SDK, configure it with your appl_ key, fetch offerings and call purchase(package:). RevenueDot verifies each StoreKit 2 transaction with Apple, using the In-App Purchase key and notification URL you add to the app.

Why does the RevenueDot SDK use import RevenueCat?

It keeps the module names of the open-source SDK it is built from, RevenueCat and RevenueCatUI. Only the package changes. The RevenueDot package points at RevenueDot Cloud and trusts RevenueDot's signing key.

Does RevenueDot support StoreKit 2?

Yes. It verifies signed transactions against Apple's root certificate and, with an In-App Purchase key, reads history and renewal state from the App Store Server API. StoreKit 1 receipts also work once the key is added.

How do I test iOS purchases without an App Store account?

Create a Test Store app in RevenueDot, pass its test_ key to configure in a Debug build and buy through the SDK's alert. For real sandbox purchases, use a sandbox tester or an Xcode StoreKit file with its test certificate saved on the app.

I already ship the RevenueCat iOS SDK. Do I have to replace it?

No. Set Purchases.proxyURL to https://api.revenuedot.app before configure, set entitlement verification to disabled and call syncPurchases() once after the update. You can move to the RevenueDot package later without changing your purchase code.

Get started

Start selling subscriptions in your app today.

Building and testing are free, and you can test your first purchase before you have a store account. Pro costs $0 until your apps make $10,000 a month.

Already have an account? Sign in · Switching from RevenueCat? Change one line