PHPackages                             blackspot/stripe-multiple-accounts - 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. blackspot/stripe-multiple-accounts

ActiveLibrary

blackspot/stripe-multiple-accounts
==================================

Allow manages many stripe accounts (Customers, PaymentMethods, etc..)

v1.6.1(2y ago)3651MITPHPPHP &gt;=7.3

Since Feb 1Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Guillermo-Blackspot/stripe-multiple-accounts)[ Packagist](https://packagist.org/packages/blackspot/stripe-multiple-accounts)[ RSS](/packages/blackspot-stripe-multiple-accounts/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (23)Used By (0)

Stripe Multiple Accounts
========================

[](#stripe-multiple-accounts)

Support multiple stripe accounts

One user can have many "customers\_id"

Tables
------

[](#tables)

*ServiceIntegrations*
---------------------

[](#serviceintegrations)

morph relation that contains the

- stripe key
- stripe secret
- webhook secret

That means that the one model can manage one or more stripe accounts

In this case we have a "stub" files to create a implementation with Company Subsidiaries

*UserServiceIntegrationAccount*
-------------------------------

[](#userserviceintegrationaccount)

one to many relationship.

In this table we relate the user\_id with the service\_integration\_id (Stripe or Another..) and with a extra column that contains the "real relation" or the "multiplicity" (account\_id)

Methods
-------

[](#methods)

the model needs use the `\BlackSpot\StripeMultipleAccounts\Billable` Trait

...

```
    use \Blackspot\StripeMultipleAccounts\Billable;

    class User extends Model {
        use Billable;
    }
```

...

All available methods

...

```
    $serviceIntegrationId = 1; // sucursal merida con cuenta de stripe 1;

    // Siempre se pasa como primer parametro la sucursal o cuenta de stripe el service_integration_id que tiene el payload de stripe
    // Puede ser nulo y tomara la sucursal que este definida por metodos magicos
    // Estos metodos magicos deben definirse en el modelo Que use el trait "ManagesAuthCredentials.php"
    /*
        if (isset($this->id) && self::class == config('stripe-multiple-accounts.relationship_models.stripe_accounts')) {
            // Si el modelo es ServiceIntegration definido en el config, tomara el id
        }else if (isset($this->service_integration_id)){
            // Sel el modelo tiene un "service_integration_id" relacionado tomara ese atributo
        }else if (method_exists($this, 'getStripeServiceIntegrationId')){
            // Si el modelo tiene un metodo llamado "getStripeServiceIntegrationId" tomara el valor de esa funcion
        }else if (method_exists($this, 'getStripeServiceIntegrationOwnerId') && method_exists($this,'getStripeServiceIntegrationOwnerType')){
            // Si el modelo tiene un metodo llamado "getStripeServiceIntegrationOwnerId" y "getStripeServiceIntegrationOwnerType" tomara el valor de esas funciones
            // y las aplicara en un where
            // Esto se usa cuando a los usuarios no se les asigna un servicio de stripe directamente si no por otro modelo
            // entonces si el usuario cuenta con una sucursal y la sucursal tiene un servicio de stripe
            // se puede determinar que la cuenta de stripe es la primera que encuentre en asociada a la sucursal del usuario dado la columna "owner" de service_integrations

            function getStripeServiceIntegrationOwnerId(){
                return $this->subsidiary->id;
            }
            function getStripeServiceIntegrationOwnerId(){
                return '\App\Models\Subsidiary';
            }
        }
    */
    // stripe_key
    // stripe_secret, etc..

    $user = \Auth::user();

    // ManagesAuthCredentials.php

    $user->getStripeClientConnection($serviceIntegrationId);            // nullable
    $user->getStripeServiceIntegration($serviceIntegrationId);          // nullable
    $user->assertStripeServiceIntegrationExists($serviceIntegrationId); // terminal
    $user->getStripeSecretKey($serviceIntegrationId);            // nullable
    $user->getStripePublicKey($serviceIntegrationId);            // nullable

    // ManagesCustomer.php
    $user->stripeCustomerExists($serviceIntegrationId);                        // bool
    $user->getStripeCustomer($serviceIntegrationId, $opts = []);               // nullable
    $user->getStripeCustomerId($serviceIntegrationId);                         // nullable
    $user->createStripeCustomerIfNotExists($serviceIntegrationId, $opts = []); // nullable
    $user->createOrGetStripeCustomer($serviceIntegrationId, $opts = []);       // nullable
    $user->updateStripeCustomer($serviceIntegrationId, $opts = []);            // nullable
    $user->setStripeCustomerToCache(new \Stripe\Customer);                     // void
    $user->setStripeCustomerIdToCache($customerId);                            // void

    // ManagesPaymentMethods.php
    $user->createStripeSetupIntent($serviceIntegrationId, $opts = []);                           // nullable
    $user->getStripePaymentMethods($serviceIntegrationId, $type = 'card');                       // \Stripe\Collection
    $user->addStripePaymentMethod($serviceIntegrationId, $paymentMethodId);                      // nullable
    $user->deleteStripePaymentMethod($serviceIntegrationId, $paymentMethodId);                   // nullable
    $user->getOrAddStripePaymentMethod($serviceIntegrationId, $paymentMethodId, $type = 'card'); // nullable
    $user->setDefaultStripePaymentMethod($serviceIntegrationId, $paymentMethodId);               // nullable alias of updateDefaultStripePaymentMethod
    $user->updateDefaultStripePaymentMethod($serviceIntegrationId, $paymentMethodId);            // nullable
    $user->getDefaultStripePaymentMethod($serviceIntegrationId, $paymentMethodId);               // nullable

    // ManagesPaymentMethodSources.php
    $user->addStripePaymentMethodSource($serviceIntegrationId = null, $tokenId, $opts = [])      // nullable - LEGACY
    $user->deleteStripePaymentMethodSource($serviceIntegrationId = null, $sourceId, $opts = [])  // nullable - LEGACY

    // PerformsCharges.php
    $user->makeStripeCharge($serviceIntegrationId, $amount, $paymentMethodId, $opts = []);                               // nullable
    $user->stripePay($serviceIntegrationId, $amount, $opts = []);                                                        // nullable
    $user->createStripePaymentIntentWith($serviceIntegrationId, $amount, $paymentMethods = ['card','oxxo'], $opts = []); // nullable
    $user->createStripePaymentIntent($serviceIntegrationId, $amount, $opts = []);                                        // nullable
    $user->refundStripePaymentIntent($serviceIntegrationId, $paymentIntentId, $opts = []);                               // nullable
    $user->findStripePaymentIntent($serviceIntegrationId, $paymentIntentId);                                             // nullable

    // ManagesSubscriptions.php

    $identifier = "usr_{$userId}_prod_{$productId}";
    $name       = 'Plan anual';
    $items      = \BlackSpot\StripeMultipleAccounts\Models\StripeProducts::get(['id','allow_recurring','default_price_id','service_integration_id']);

    $user->newStripeSubscription($serviceIntegrationId, $identifier, $name, $items); // nullable

    /** @var \BlackSpot\StripeMultipleAccounts\Models\StripeUser */
    $stripeUser = user()->stripe_customers()->where('service_integration_id', $serviceIntegrationId)->first();
```

...

*Publishables*
--------------

[](#publishables)

*Config*

```
php artisan vendor:publish --tag=stripe-multiple-accounts:config

```

*Migrations*

```
php artisan vendor:publish --tag=stripe-multiple-accounts:migrations

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

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.

###  Release Activity

Cadence

Every ~15 days

Recently: every ~76 days

Total

22

Last Release

887d ago

Major Versions

v1.6.1 → v2.x-dev2023-12-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/cb0c3a841bb1d97e67b777754fc32c6fa71e01308016b9c812f3442dc3d4cebf?d=identicon)[Guillermo-Rod](/maintainers/Guillermo-Rod)

![](https://www.gravatar.com/avatar/d8dd9d5fbe0e062db075ad5f4f881e9208230e31d8ae451471a98fc2de9f757c?d=identicon)[Guillermo-Blackspot](/maintainers/Guillermo-Blackspot)

---

Top Contributors

[![Guillermo-Blackspot](https://avatars.githubusercontent.com/u/63753595?v=4)](https://github.com/Guillermo-Blackspot "Guillermo-Blackspot (127 commits)")

### Embed Badge

![Health badge](/badges/blackspot-stripe-multiple-accounts/health.svg)

```
[![Health](https://phpackages.com/badges/blackspot-stripe-multiple-accounts/health.svg)](https://phpackages.com/packages/blackspot-stripe-multiple-accounts)
```

###  Alternatives

[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k25.9M107](/packages/laravel-cashier)[verbb/formie

The most user-friendly forms plugin for Craft.

101372.9k40](/packages/verbb-formie)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

52664.9k12](/packages/solspace-craft-freeform)[duncanmcclean/simple-commerce

A simple, yet powerful e-commerce addon for Statamic.

16313.2k2](/packages/duncanmcclean-simple-commerce)[flux-se/sylius-stripe-plugin

Sylius Stripe plugin using Payment Request

1029.3k](/packages/flux-se-sylius-stripe-plugin)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

322.8k](/packages/duncanmcclean-statamic-cargo)

PHPackages © 2026

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