Migrate existing subscriptions
If your app has already active subscriptions (or non-consumables), you’ll probably want to migrate everything to IAPHUB.
When the user opens his app with the IAPHUB SDK for the first time, his active subscriptions (and non-consumables) should be automatically synchronized with IAPHUB.
In case it doesn't happen automatically, the user can synchronize its purchases with IAPHUB by doing a restore (using the restore
method of the IAPHUB SDK).
If you're having an authentication system (you should have a user id for each subscription), you can also migrate all your active subscriptions using our API (recommended).
It makes things easier since your users won't have to open their apps and you can be sure the subscription has been migrated successfully.
If you’ve implemented a system on your server to validate and check the status of your subscriptions, you should already have all the informations required to perform a fast and simple migration.
For each active subscription you’re going to need:
- The receipt platform (“ios” or “android”)
- The receipt token
- The product sku of the subscription (Required for android only)
And simply iterate over your active subscriptions using the Post user receipt API call with the required parameters (using the Server API KEY, available on the settings page of your app).
Do not forget to enable the "upsert" property of the Post user receipt API call to allow creating the user if it hasn't been created on IAPHUB yet.
Before running your script, to avoid any error be sure to check that:
- Your ios platform is configured properly on IAPHUB: Bundle id, Shared secret.
- Your android platform is configured properly on IAPHUB: Bundle id, Google Play API.
- Your products are configured properly.
- Your webhooks are disabled, otherwise you’ll receive a webhook for each subscription you're migrating which is probably unnecessary.
You can process up to 5 receipts concurrently.
If you need any help or have any question, please contact us, we’ll be happy to help!