'$config must be a string or an array

I am having errors when trying to access the subscription section on my app . It's something with the stripe API, this error occurs mostly when server caches are being cleared. I checked to clear caches, check config.app.php, payment controller, and all of that but not really understanding the source of this error!

Therefore I need someone's help, maybe someone who had this issue before here is the code line for that on vendor/stripe/stripe-php/lib/BaseStripeClient.php. please suggest a solution for this error! I will be grateful

if (\is_string($config)) {

        $config = ['api_key' => $config];

    } elseif (!\is_array($config)) {

        throw new \Stripe\Exception\InvalidArgumentException('$config must be a string or an array');

    }


Solution 1:[1]

php artisan config:cache run this command

Solution 2:[2]

Your application is pulling a cached version of its config. Delete the bootstrap/cache/config.php file and refresh your browser and the error should go away.

I haven't had much luck with running php artisan cache:clear so I just remove the file manually or run the command below.

If you run the terminal command rm -rf bootstrap/cache/* in the root of the application it should remove all the files in the cache directory.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Satlok
Solution 2 Tim Strawbridge