PHPackages                             loduis/stripe-migrate - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. loduis/stripe-migrate

ActiveLibrary

loduis/stripe-migrate
=====================

Migrate your stripe subscription to new account, this is only on clone

03PHP

Since Apr 27Pushed 8y ago1 watchersCompare

[ Source](https://github.com/loduis/stripe-migrate)[ Packagist](https://packagist.org/packages/loduis/stripe-migrate)[ RSS](/packages/loduis-stripe-migrate/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Stripe migrate subscription tool
--------------------------------

[](#stripe-migrate-subscription-tool)

> **Note**: This source only work for one subscription, for customer

This is an simple tool for migrate stripe subscription, for run this process you need:

- Write email to stripe team for create a copy of customer in new account
- Stop your webhooks in the accounts
- Run the migration

### That makes ?

[](#that-makes-)

- When method all is invoke this create the plan, or you can create plan invoice method plan
- Copy the current subscription of customer in the new account
- Set the **trial\_end** the new account to the **current\_period\_end** the old account
- Mark subscription for cancel at end period

### Usage Instructions

[](#usage-instructions)

Migrate the subscription the one customer

```
use Stripe\Tools\Migrate\Subscription as Migrate;

require './vendor/autoload.php';

$migrate = new Migrate(
    'stripe from account api key',
    'stripe to account api key'
    //, true // force to live
);

$callback = function ($err, $to, $from, $customer) {
    if ($err) {
        throw $err;
    }
    echo 'Customer: -> ', $customer, PHP_EOL;
    echo 'Old subscription: -> ', $from, PHP_EOL;
    echo 'New subscription: -> ', $to, PHP_EOL;
    // in this callback youn can update you database ids
    // if the callback return false the old subscription is not cancelled
    // you can no return any o return true for cancel subscription
};

if ($migrate->run('stripe customer id', $callback) === false) {
    echo 'It was not possible to find an active subscription in',
    ' the old account or he already has a subscription in the new account';
}
```

Migrate the subscription the all customers

```
use Stripe\Tools\Migrate;

require './vendor/autoload.php';

$migrate = new Migrate(
    'stripe from account api key',
    'stripe to account api key'
);

$migrate->run(function ($err, $to, $from, $customer) {
    if ($err) {
        throw $err;
    }
    echo 'Customer: -> ', $customer, PHP_EOL;
    echo 'Old subscription: -> ', $from, PHP_EOL;
    echo 'New subscription: -> ', $to, PHP_EOL; // you need store in database
    echo '---------------------------------', PHP_EOL;
})
```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/add48fa4c34a8becb790d1907a00eb376e30fb07a851f1c0e2ca054657333826?d=identicon)[loduis](/maintainers/loduis)

---

Top Contributors

[![loduis](https://avatars.githubusercontent.com/u/451862?v=4)](https://github.com/loduis "loduis (5 commits)")

### Embed Badge

![Health badge](/badges/loduis-stripe-migrate/health.svg)

```
[![Health](https://phpackages.com/badges/loduis-stripe-migrate/health.svg)](https://phpackages.com/packages/loduis-stripe-migrate)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
