Weird.
I think you need to debug this a bit more yourself. Have you tried checking the value of the API key? For example:
public function __construct()
{
$key = \Config::get('stripe.secret_key');
dd($key);
Stripe::setApiKey($key);
}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am looking at Stripe payment tutorial and follow as in video but got error :
No API key provided. (HINT: set your API key using "Stripe::setApiKey(<API-KEY>)". You can generate API keys from the Stripe web interface. See https://stripe.com/api for details, or email support@stripe.com if you have any questions.
with Laravel 5.1
If i use this code in charge function :
Stripe::setApiKey($this->app['config']['services.stripe']['key']);
also tried this :
Stripe::setApiKey(\Config::get('stripe.secret_key'));
Working fine but when use in __construct()
Got error above - can anyone tell me why ? also using namespace for Stripe\Stripe
Please or to participate in this conversation.