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

mattplan8's avatar

cashier apikey error when config:cache used

I have an app that I'm using with Stripe and cashier 6.0 (laravel 5.2). When I use config:cache I get:

The second argument to Stripe API method calls is an optional per-request apiKey, which must be a string, or per-request options, which must be an array. (HINT: you can set a global apiKey by "Stripe::setApiKey()")

When I clear cache (config:clear), it works fine.

Here is my setup: .env file has:

STRIPE_KEY

STRIPE_SECRET

CACHE_DRIVER=file

app\config\services.php has:

'stripe' => [

    'model'  => \App\User::class,

    'secret' => env('STRIPE_SECRET'),

    'key' => env('STRIPE_KEY')

]

stripe.js has

Stripe.setPublishableKey

Any thoughts as to why config:cache breaks it? does config:cache help much? My test env on my laptop is IIS and I'll be deploying to Azure that has wincache, but none of the other fancy cache's available to me at the moment.

0 likes
3 replies
gilbitron's avatar

Just ran into the same issue using Laravel Spark. Would love to know why this happens.

3 likes
mattplan8's avatar

I ended up not using config:cache, I had been trying to use it due to poor performance with Azure Web Apps. If you want to use Azure the performance is terrible with their web apps saas system (not sure why). I moved to an A0 basic virtual machine running windows server core and am crushing the performance of even an A2 web app instance.

zer0pants's avatar

I'd also love to know why this happens. Similarly I'm choosing to not use the command php artisan config:cache at least until I can find a solution.

Please or to participate in this conversation.