Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bertog's avatar

Laravel Cashier support for different Stripe Account.

Hi there,

My application must managed different companies with their own stripe accounts. For every company I have multiple users and this users are the stripe's customers.

I'm trying to stick with Cashier so I dig a little bit in the code, so I need to overwrite the Cashier::stripeOptions static function in order to grab the Stripe API Key from the database instead of the config / env file ...

Any idea of how overwrite this method and where to place the logic for do it?

Any advice?

Thanks Guido

0 likes
6 replies
thewebartisan7's avatar

Your requirements maybe is not allowed by Stripe terms.

You can have multiple accounts with your stripe account, but Stripe terms said:

"You must use separate Stripe accounts for projects, websites, or businesses that operate independently from one another. When you activate a new account, it is subject to Stripe’s standard policies and pricing—it does not inherit any special status or other similar considerations that may apply to your existing account."

Source: https://stripe.com/docs/multiple-accounts

Since you are talking about different "companies" most probably you can't do what want.

This terms applied by Stripe is caused since their fees change depending on volumes of transactions. Merging multiple business/companies can lower fees.

I have similar requirements years ago, and Stripe suggest me to check into https://stripe.com/docs/connect

This allow to split payments.

However Cashier doesn't support this, so you must use their api directly.

bertog's avatar

Hi zoroaster,

Our situation meet exactly the Stripe requirement. Different company have their separated Stripe Account. Is the application that is in common.

Back to my problem I've found the solution and it was pretty strait forward. My Cashier configuration is not link to the User model but to a Customer model and this model use the Billable trait

In the Customer model I've override the stripeOptions function grabbing the Stripe Secret from the database and it's working :)

BTW: I'm already using directly the Stripe API because I need to manage multiple products and plans.

Thanks :)

Guido

thewebartisan7's avatar

Different company have their separated Stripe Account. Is the application that is in common.

I think that this can be in conflict with this:

You must use separate Stripe accounts for projects, websites, or businesses that operate independently from one another.

You have 1 projects/websites for multiple separated stripe accounts.

If you are working in test mode, could work, but later could be blocked.

I would get in touch with Stripe, if you are not sure.

Because Stripe offer discount for volumes and you could create higher volumes merging multiple business.

But I don't know your case, so maybe I am wrong.

Good luck

Sti3bas's avatar
Sti3bas
Best Answer
Level 53

@bertog stripeOptions static method is only called in few places:

Billable trait: https://github.com/laravel/cashier/blob/10.0/src/Billable.php#L815 You can easily override this by adding stripeOptions method to your billable model. Or by creating your own Billable trait which uses Billable trait from the package and overrides stripeOptions method.

PaymentController: https://github.com/laravel/cashier/blob/10.0/src/Http/Controllers/PaymentController.php#L23 You can override this by copying the controller to \app\Http\Controllers directory and adding this line to register method in your AppServiceProvider:

$this->app->bind(\Laravel\Cashier\Http\Controllers\PaymentController::class, \App\Http\Controllers\PaymentController::class);
bertog's avatar

thanks we will be in touch with Stripe :)

G.

esanquer's avatar

hello, I face today the same matter you talked about here one year ago, My customers are different companies, each one have their own stripe account, and my project aims to allow them to manage their own subscriptions for their own customers.

how did it turn out with stripe in your case ?

Please or to participate in this conversation.