horse revenue Docs

Moving to Horse

Migrating from RevenueCat

The Horse iOS SDK was shaped after RevenueCat's, so most code changes its type names and gains await. The care goes into update day, so that everyone who already pays stays unlocked.

#1. Set Horse up first

  1. Use the same ids

    Follow tutorial steps 2 to 5, with the same entitlement id RevenueCat used (pro, premium…). Build the offerings with the same offering ids, the same package ids ($rc_monthly, $rc_annual, $rc_weekly, $rc_lifetime) and the same custom fields as your RevenueCat offering metadata. The app's code keeps looking things up by them.

  2. Send notifications to both

    Point App Store Server Notifications at Horse as in step 10. Then, on Horse's SDK & settings tab, put RevenueCat's App Store notification URL for the app in Forward notifications to. Horse passes every notification on, so RevenueCat keeps working for people still on old builds.

  3. Bring the history

    Horse fetches the last 179 days of notifications back from Apple, then everything older for the customers it knows. RevenueCat's data export fills in the rest. Write to us before you cut over, and we'll run the import with you.

#2. Port the app

RevenueCatHorse iOS SDK
import RevenueCatimport HorseKit
Purchases.configure(withAPIKey:appUserID:)Horse.configure(apiKey:appUserID:baseURL:)
Purchases.sharedHorse.shared
getOfferings { offerings, error in }try await offerings()
offering.getMetadataValue(for:default:)The same, or offering.string / bool / int / decode
package.storeProduct.localizedPriceStringpackage.storeProduct.displayPrice (a StoreKit 2 Product)
purchase(package:) { tx, info, error, cancelled in }let r = try await purchase(package:), then r.userCancelled
restorePurchasesrestorePurchases(), behind the Restore button only
syncPurchasessyncPurchases(), silent as before
customerInfo { info, error in }try await customerInfo(), or customerInfoStream
info.entitlements.all["pro"]?.isActiveinfo.isEntitled("pro")
logIn / logOuttry await logIn(id) / logOut()
PurchasesDelegateHorseDelegate, or customerInfoStream
Purchases.logLevel = .debugHorse.configure(with: .init(…, logLevel: .debug))
attribution.setEmail / setAttributessetEmail / setAttributes, with await
attribution.collectDeviceIdentifiers, setFBAnonymousID, setAppsflyerID…The same names on Horse.shared, with await, in HorseKitAttribution
attribution.enableAdServicesAttributionTokenCollection()collectAppleSearchAdsAttribution() in HorseKitSearchAds
RevenueCatUI PaywallViewPaywallView in HorseKitUI (designed in Paywalls)

RevenueCat's anonymous ids don't carry over, and that's fine. An app that set its own user id passes the same one to configure. An anonymous install becomes a new anonymous Horse customer, who claims their purchases on update day as shown below.

A typical purchase manager, rewritten:

PurchaseManager.swift
import HorseKit

@MainActor final class PurchaseManager: ObservableObject {
    static let shared = PurchaseManager()
    @Published private(set) var isSubscribed = false
    private static let entitlement = "pro"

    static func start(appUserID: String? = nil) {
        Horse.configure(apiKey: "pk_…", appUserID: appUserID,
                        baseURL: URL(string: "https://tally-api-755619271848.us-central1.run.app")!)
        shared.isSubscribed = Horse.shared.isEntitled(entitlement)          // cached, instant
        Task { for await info in Horse.shared.customerInfoStream {          // live updates
            shared.isSubscribed = info.isEntitled(entitlement)
        } }
    }

    func offerings() async throws -> Offerings { try await Horse.shared.offerings() }

    func purchase(_ package: Package) async -> Bool {
        do { return try await Horse.shared.purchase(package: package).customerInfo.isEntitled(Self.entitlement) }
        catch { return false }
    }

    func restore() async -> Bool {
        (try? await Horse.shared.restorePurchases())?.isEntitled(Self.entitlement) ?? false
    }
}

#3. Update day

The first launch of the new build is a new Horse customer who owns nothing yet. To keep subscribers unlocked:

// Only for an existing install (past onboarding, or the old build's saved "isPro" flag).
// Claiming on every first launch would unlock every reinstall and hide the paywall from testers.
if isExistingInstall && !didSyncWithHorse {
    _ = try? await Horse.shared.syncPurchases()      // silent: never prompts
    didSyncWithHorse = true
}
// Until that sync has succeeded, keep the old build's answer: don't let "not entitled" lock the app.
isPro = didSyncWithHorse ? Horse.shared.isEntitled("pro") : oldIsProFlag

#4. Ads and attribution

Give Horse what RevenueCat got: collectDeviceIdentifiers() and setFBAnonymousID at launch and after the tracking prompt. Switch RevenueCat's Meta integration off at the moment Horse's goes on, after the history import. While both run, each renewal reaches Meta twice. See Meta. Search Ads attribution is one call.

#5. Cut over

When most people are on the new build, remove the forward URL, delete RevenueCat's keys from the repository and cancel RevenueCat. If you use Firebase Remote Config, it can move to Horse's Remote config at the same time. While both exist, read Horse first, then Firebase, then the built-in default.

#Checking it worked

Follow Test with Sandbox on the new build. Then, after release, compare a week of Horse's revenue on the app's App Store tab with Apple's own sales reports and with RevenueCat's charts for the same days.