You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the old version of Cashier v9 it allowed you to specify a different API key for each user. In v10, it doesn't seem this is easily possible because everything has switched to using Cashier::stripeOptions() function which always returns the cashier.secret config value and isn't specific to a particular user.
For our application, we actually split our stripe account into two - one for males and a seperate account for females. It doesn't seem easily possible to convert our codebase over to Cashier v10 for this reason.
Hmm I see how that can be a concern for you. Multiple Stripe accounts were never really supported in Cashier as the cashier secret on the billable trait was only meant for the only model it should be set on (usually the default user model in your Laravel app). But I can definitely see why you'd use it like this.
Basically what you're asking is support for multiple Stripe accounts. We could provide support for this. I'll take a look at this real soon.
Thanks Dries! The old version of Cashier did definitely support multiple different keys for users though, so the way v10 works now is a step backwards and makes it hard to have seperate keys.
This is how we used it in Cashier v9, you just override the getStripeKey method and Cashier will use it for all API calls.
<?phpclassMemberextendsEloquent {
/** * Get stripe key to use for the member. * Female and Male accounts use a different Stripe account * This is used by Laravel Cashier. */publicfunctiongetStripeKey()
{
return$this->isFemale() ?
config('services.stripe-female.secret') :
config('services.stripe-male.secret');
}
}
In the old version of Cashier v9 it allowed you to specify a different API key for each user. In v10, it doesn't seem this is easily possible because everything has switched to using
Cashier::stripeOptions()
function which always returns thecashier.secret
config value and isn't specific to a particular user.For our application, we actually split our stripe account into two - one for males and a seperate account for females. It doesn't seem easily possible to convert our codebase over to Cashier v10 for this reason.
Was there any design consideration for removing the functionality of having different stripe keys per-user model? https://github.com/laravel/cashier/blob/9.0/src/Billable.php#L624
The text was updated successfully, but these errors were encountered: