DEV Community

Discussion on: Laravel Cashier: Multiple Stripe accounts based on Billable's property

Collapse
 
maneeshmk profile image
Maneesh MK

Minor correction. It should be "stripeOptions" instead of "stripe"

public function stripeOptions(array $options = [])
{
if (!is_null($this->country)) {
// Get country specific cashier key
$config = config('billing.stripe');
if (array_key_exists($this->country->code, $config)) {
// Update cashier's config
config(['cashier.key' => $config[$this->country->code]['key']]);
config(['cashier.secret' => $config[$this->country->code]['secret']]);
config(['cashier.currency' => $config[$this->country->code]['currency']]);
}
}
// use default config
return Cashier::stripeOptions($options);
}

Collapse
 
fakeheal profile image
Ivanka Todorova • Edited

Thank you for your comment!

Laravel's Cashier latest version (as of writing of this comment) is 13 and I am setting config() variables before calling the following method: Cashier::stripe().