razorpay / razorpay-php-testapp

Sample App for Razorpay PHP Integration
MIT License
32 stars 45 forks source link

shows as The api key provided is invalid - But its valid test key #8

Closed abkiran closed 5 years ago

abkiran commented 6 years ago
Fatal error: Uncaught exception 'Razorpay\Api\Errors\BadRequestError' with message 'The api key provided is invalid' in /var/www/REPO/rtest/razorpay-php/src/Request.php:123 Stack trace: #0 /var/www/REPO/rtest/razorpay-php/src/Request.php(90): Razorpay\Api\Request->processError(Array, 401, Object(Requests_Response)) #1 /var/www/REPO/rtest/razorpay-php/src/Request.php(44): Razorpay\Api\Request->checkErrors(Object(Requests_Response)) #2 /var/www/REPO/rtest/razorpay-php/src/Entity.php(59): Razorpay\Api\Request->request('POST', 'orders/', Array) #3 /var/www/REPO/rtest/razorpay-php/src/Entity.php(15): Razorpay\Api\Entity->request('POST', 'orders/', Array) #4 /var/www/REPO/rtest/razorpay-php/src/Order.php(12): Razorpay\Api\Entity->create(Array) #5 /var/www/REPO/rtest/pay.php(24): Razorpay\Api\Order->create(Array) #6 {main} thrown in /var/www/REPO/rtest/razorpay-php/src/Request.php on line 123
max1204 commented 5 years ago

I had the same issue with mine as well. I had a space in the string for keyID that being passed in API. Make Sure you check for spaces and if the issue is still there try generating a new test credentials from your dashboard. $keyId= 'Sample_key'; $keySecret = 'sample_key_secret';

captn3m0 commented 5 years ago

Thanks for the suggestion @max1204.

Marking this issue as closed.

gmanikandan-dev commented 2 years ago

I have same issue .I clear the config cache using following command .Please try this .... php artisan optimize:clear It's working fine