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

narwen's avatar

Where to keep stripe test api key in L5?

I have been following the laracast tutorial on using Cashier. They store their stripe test key in start.php but Laravel 5 doesnot have start.php. SO, where should I put my stripe test key in laravel 5

0 likes
2 replies
RachidLaasri's avatar
Level 41

In your Config/services.php file you can reference the key like this

env('stripe_key')

and add the stripe_key to your .env file.

narwen's avatar

@RachidLaasri Can you please guide me more. In my bootstrap/app.php file , I have

$env = $app->detectEnvironment(function()
{
        return getenv('APP_ENV')?:'local';
});

But when I try to return Config::get('services.stripe.secret'); it is still returning me live api key.

Please or to participate in this conversation.