issueatlas · · Reply permalink
The 401 with "Invalid key" means exactly what it says: the public or secret key Paystack received isnt valid for your account. Check these in order:
- Make sure
PAYSTACK_PUBLIC_KEYandPAYSTACK_SECRET_KEYin your.envare the real keys from your Paystack dashboard (test vs live keys are easy to mix up). - After changing
.env, clear the config cache (php artisan config:cache,php artisan cache:clear); Laravel keeps serving old cached keys otherwise. - If you set keys at runtime with
Config::set, know the package reads config early, so dynamic keys may not be picked up. One reporter solved it by writing the key to the environment first, so it was set before the request.
Source: https://github.com/unicodeveloper/laravel-paystack/issues/86
Source: https://github.com/unicodeveloper/laravel-paystack/issues/86