If you already have an existing app that is using subscriptions, it's easy to migrate them over to RevenueCat. You can use the Purchases SDK to replace all of your in-app-purchase code, or you can just use it along side your current stack to track in-app-purchases and benefit from our charting, webhooks, and other integrations.
Client Side Migration
This section assumes you've followed our Quickstart section of our Getting Started guide to install and configure our SDK.
The Purchases SDK automatically detects new transactions and sends them to RevenueCat. However, when migrating from an older system, you need to tell Purchases to sync to ensure we are tracking your subscribers correctly.
The way to do this is: if your existing subscription code knows you have a subscription, but RevenueCat does not, then restore transactions.
See the following pseudo example.
const isSubscribedInOldSystem = oldTracking.isSubscribed();
const isSubscribedInRevenueCat = purchaserInfo.hasActiveEntitlement("my_entitlement_identifier");
// If the old system says we have a subscription, but RevenueCat does not
if (isSubscribedInOldSystem && !isSubscribedInRevenueCat)
{
// Tell Purchases to restoreTransactions.
// This will sync the user's receipt with RevenueCat.
Purchases.shared.restoreTransactions { (purchaserInfo, error) in }
}
When a subscriber launches with the first version containing Purchases it will trigger a restore. Once the restore is complete, it won't be triggered again.
Use RevenueCat Backend Only (Observer Mode)
In some cases, if you have already built a functioning subscription system, it may not be possible or feasible to use the Purchases SDK to make purchases. However, you can still use the SDK to get access to the advanced charting, webhooks, and attribution that RevenueCat can provide.
By simply setting up and instantiating an instance of Purchases in "Observer Mode", receipts can be recorded and stored in the RevenueCat backend without interfering with any of your existing code. On iOS, receipts can be recorded automatically, on Android, use syncPurchases
after purchases and restores to record receipts in RevenueCat.
1. Configure Purchases SDK in Observer Mode
Purchases.configure(
withAPIKey: "my_api_key",
appUserID: "my_app_user_id",
observerMode: true)
[RCPurchases
configureWithAPIKey:@"my_api_key"
appUserID:@"my_app_user_id"
observerMode: YES];
Purchases.configure(this, "my_api_key", "my_app_user_id", true)
Purchases.configure(this, "my_api_key", "my_app_user_id", true);
Purchases.setup("my_api_key", "my_app_user_id", true);
Purchases.setup("my_api_key", "my_app_user_id", true);
// Set the observer mode on in the Unity editor as shown below
await Purchases.setup("my_api_key", "my_app_user_id", true);
Unity Only
Make sure Observer Mode is enabled in Unity


2. Sync transactions with RevenueCat (Android only)
On Android (or cross-platform SDKs), any time a purchase or restore occurs in your app you should call the syncPurchases
method to record it in RevenueCat.
// Called any time a purchase or restore
// is successful in your existing code
Purchases.sharedInstance.syncPurchases()
// Called any time a purchase or restore
// is successful in your existing code
Purchases.getSharedInstance().syncPurchases();
// Called any time a purchase or restore
// is successful in your existing code
Purchases.syncPurchases();
// Called any time a purchase or restore
// is successful in your existing code
Purchases.syncPurchases();
purchases.SyncPurchases();
// Called any time a purchase or restore
// is successful in your existing code
Purchases.syncPurchases();
Important
Failing to call
syncPurchases
after purchases and restores in Observer Mode will prevent any transactions from being recorded.
Capturing Old Data
If you wish import historical data from users who no longer use your app you can send us a bulk receipt file for import. Email us for details.
Next Steps
- If you want to use your own user identifiers, read about setting app user ids
- Once you're ready to test your integration, you can follow our guides on testing and debugging
Updated about a year ago