# Migrate subscriptions from another platform

This guide describes how to migrate existing subscriptions from another platform to Rebilly.

Use this guide if your organization is moving from another payment platform to Rebilly and you have active subscriptions that must continue without interruption.

The `/orders` operations used in this guide are experimental. 
[Contact Rebilly](/contact) to enable this functionality for your organization.

## Migration process

Use the following steps to migrate your subscriptions.

- Test in the sandbox before migrating in the live environment.
Complete the full migration process in the sandbox using test customers and test payment instruments to confirm the results are correct.
- When migrating in the live environment, migrate subscriptions in batches and check that the results are correct before migrating the next batch.


### Step 1: Set up your Rebilly integration

Set up your Rebilly integration and begin collecting new subscriptions through Rebilly.
This ensures that your Rebilly environment functions as expected before you migrate existing data.

To set up your Rebilly integration, see [Get started](/docs/dev-docs#get-started).

### Step 2: Import customer payment data

Request an export of your customer and payment data from your previous payment processor.
Rebilly imports this data and creates the associated customers and payment instruments in your Rebilly organization.

To keep your existing customer IDs for mapping during the migration, include them in the export.

For more information, see [Migrate sensitive payment data](/docs/tutorials/migrate-sensitive-payment-data).

### Step 3: Export your subscription data

Export your active subscription data from your previous platform.
Include all details required to recreate the subscriptions in Rebilly, such as:

- Customer ID (matching the ID imported in [step 2](#step-2-import-customer-payment-data))
- Product or plan details
- Billing interval and amount
- Currency
- Current renewal period start and end dates
- Details of the payment instrument


### Step 4: Write a migration script

Write a script that processes your exported subscription data, transforms each record to match the Rebilly API format, and creates a subscription in Rebilly using the [Create an order](/catalog/all/orders-experimental/postorder) operation on `/orders`.

Set the `startTime` of each subscription in Rebilly to the beginning of the current renewal period.
For example, if the renewal period is March 1st to March 31st, set the `startTime` to March 1st.
This date can be in the past.

Set `autopay` to `false` on all new subscriptions to avoid unintentional double charges during the migration.

### Step 5: Verify subscriptions in Rebilly and cancel the previous subscriptions

After you create the subscriptions in Rebilly, review them to verify that the data is correct.
After verification, cancel the subscriptions in your previous platform.

### Step 6: Update `autopay` settings

For subscriptions that must use `autopay`, use the [Upsert an order](/catalog/all/orders-experimental/putorder) operation to set `autopay` to `true`.

## Related topics

- [Migrate sensitive payment data](/docs/tutorials/migrate-sensitive-payment-data)
- [Orders - conceptual overview](/docs/dev-docs/orders)
- [Subscriptions - conceptual overview](/docs/dev-docs/subscriptions)
- [Orders API reference](/catalog/all/orders-experimental/)