Migrating In-App Subscriptions

How to migrate subscriptions from other platforms

You can migrate your subscription data to Qonversion if you have your in-app subscription implementation or use some other 3-rd party service. There are two modes available at Qonversion:

  • Analytics Mode
  • Subscription Management Mode

The migration process depends on what mode you are planning to use. You can read more about the modes here.

1. Analytics Mode Migration

Import your subscription data to have historical data when using Analytics Mode.

📘

Please note that data import is available only on the Starter plan and higher.

The migration will allow:

  • to see historical data in Qonversion analytics;
  • Qonversion to validate user receipts to check subscription status changes like subscription renewal or cancellation;
  • New subscription events of your existing users to be sent to active integrations (the events that happened before the migration won't be sent);

Prepare the data

Make sure you have the following data:

iOS

FieldRequiredDescription
user_idyesUser Identifier in your backend
receiptyesThe Base64 encoded receipt data.
product_idyesThe unique identifier of the product purchased.
original_idyesThe transaction identifier of the original purchase. See the details here: original_transaction_id
priceyesexample: 12.99
introductory_priceyesfor apple promo offers
currencyyes

Android

FieldRequiredDescription
user_idyesUser Identifier in your backend
purchase_tokenyesThe Base64 encoded receipt data.
product_idyesThe unique identifier of the product purchased.
original_idyesThe original transaction ID, see the details here: orderId for Google

Additional Data for Analytics Enrichment

You can provide the following data to enhance analytics options in Qonversion:

FieldRequiredDescription
idfvnoiOS Only
idfanoiOS Only
gaidnoAndroid Only
aaidnoAndroid Only
localno
countryno
modelno
os_versionno

Migrate with export-data

Contact us via email, and provide two csv files: iOS and Android.

Migrate from client-side

You need to trigger restore for iOS and syncPurchases for Android only once. So Qonversion can sync the subscriber data with the first launch when Qonversion is implemented.

🚧

IOS Only

Triggering restore will prompt a user to sign in to their Apple ID if they are not signed in already.

Here is the code sample showing how to check and save that a purchase has been restored for a user on the device.

let keyForRestored = "isRestored"
let isRestored = UserDefaults.standard.bool(forKey: keyForRestored)

if isRestored == false {
  Qonversion.shared().restore { (_, _) in }
  UserDefaults.standard.setValue(true, forKey: keyForRestored)
}
NSString *keyForRestoredFlag = @"isRestored";
BOOL isRestored = [[NSUserDefaults standardUserDefaults] boolForKey:keyForRestoredFlag];

if (isRestored == false) {
    [[Qonversion sharedInstance] restore:^(NSDictionary<NSString *,QONEntitlement *> * _Nonnull result, NSError * _Nullable error) {}];
  [[NSUserDefaults standardUserDefaults] setBool:YES forKey:keyForRestoredFlag];
}
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
String keyForRestored = "isRestored";
boolean isRestored = preferences.getBoolean(keyForRestored, false);
if (!isRestored) {
    Qonversion.getSharedInstance().syncPurchases();
    preferences.edit().putBoolean(keyForRestored, true).apply();
}
val preferences = PreferenceManager.getDefaultSharedPreferences(this)
val keyForRestored = "isRestored"
val isRestored = preferences.getBoolean(keyForRestored, false)
if(!isRestored){
    Qonversion.shared.syncPurchases()
    preferences.edit().putBoolean(keyForRestored, true).apply()
}
// shared_preferences plugin is used for async storage in this example.
// You may use any other implementation instead.
SharedPreferences prefs = await SharedPreferences.getInstance();
final keyForRestored = 'isRestored';
final isRestored = prefs.getBool(keyForRestored) ?? false;
if (!isRestored) {
    Qonversion.getSharedInstance().restore();
    await prefs.setBool(keyForRestored, true);
}
const keyForRestored = 'isRestored';
// @react-native-async-storage/async-storage is used for async storage in this example.
// You may use any other implementation instead.
const isRestored = await AsyncStorage.getItem(keyForRestored);
if (!isRestored) {
    Qonversion.getSharedInstance().restore();
    AsyncStorage.setItem(keyForRestored, true);
}
const string KeyForRestored = "isRestored";
int IsRestored = PlayerPrefs.GetInt(KeyForRestored, 0);
if (IsRestored != 1) {
  Qonversion.GetSharedInstance().Restore(null);
  PlayerPrefs.SetInt(KeyForRestored, 1);
}

2. Subscription Management Mode Migration

Use Qonversion SDK methods to create and restore in-app purchases, and to manage user access to the premium features. Qonversion validates user receipts and provides your app with an accurate subscription status. You can quickly implement in-app subscriptions and purchases, no headaches with StoreKit, no need to build your own server for validating subscriptions.

To manage user access to the premium content of your app, you need to configure Products and Permissions in Qonversion.

Discover Product-Center Concept
Create Permissions
Create Products
Check User Permissions