Stripe. No API key provided Hello. i'm using Laravel 5.1.45 and i tested stripe billing perfectly on my local. it is working until i deployed it on my staging server. it says
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.
i also tried to adding Stripe::setApiKey to AppServiceProvider but no luck
i'm only using test key
Have you added to keys to .env file?
@bugsysha yes. i added keys to my .env file
also i manually set the keys to config.services.stripe
Paste code where you create requests from backend.
Have you tried?
php artisan config:cache
this is my clientside script
var start = function() {
Stripe.card.createToken({
number: $form.find('[name="cc_number"]').val(),
cvc: $form.find('[name="cc_cid"]').val(),
exp_month: $form.find('[name="cc_exp"]').val().split('/')[0],
exp_year: $form.find('[name="cc_exp"]').val().split('/')[1]
}, stripeResponseHandler);
},
stripeResponseHandler = function(status, response) {
console.log(response);
if (response.error) {
$('.alert-container').append('<div class="alert alert-danger" role="alert">'+
'<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>'+
'<strong>'+response.error.code+'</strong>'+
'<span class="message">'+response.error.message+'</span>'+
'</div>');
}
else {
$form.find('[name=stripe_token]').val(response.id);
$form.submit();
}
};
and this is my server side code
$subscription = 'monthly_payment'
$premium->subscription($subscription)->create($token, [
'email' => $email,
]);
yes iv'e tried cache:clear also route:clear
Glad it works. Please select it as a correct answer so others can see that and try when they have the same problem.
Please sign in or create an account to participate in this conversation.