Hello,
I have this error message :
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 [email protected] if you have any questions.
This is my code:
public function createStandardPlan(User $user, Request $request)
{
Stripe::setApiKey(env('STRIPE_SECRET'));
return with($request->user(), function($user) use ($request) {
return with(CheckoutSession::create(array_merge($user->stripe_id ? ['customer' => $user->stripe_id] : ['customer_email' => $user->email], [
'payment_method_types' => ['card'],
'subscription_data' => [
'items' => [['plan' => 'price_id']],
],
'mode' => 'subscription',
'client_reference_id' => $user->id,
'success_url' => url('/dashboard'),
'cancel_url' => URL::previous(url('/dashboard/create-subscription')),
])), fn ($session) => $session->id);
});
}
The setApiKey is good no ? I make php artisan config:cache and route:cache but it's same.
Thank you