PayPal Connection Exception: #401 when accessing https://api.paypal.com/v1/oauth2/token

Vijendran
New Community Member

Hi please excuse me if my issue is repeatedly asking here.

I am using paypal checkout for my website, where I have used php rest api sdk for it. when I tried to make api calls i am getting payment failed alert.

 

when i print the error, i got this

 

PayPal\Exception\PayPalConnectionException: Got Http response code 401 when accessing https://api.paypal.com/v1/oauth2/token. in /home/discovercamerons/public_html/application/libraries/paypal-php-sdk/paypal/rest-api-sdk-php/lib/PayPal/Core/PayPalHttpConnection.php:202 Stack trace: #0 /home/discovercamerons/public_html/application/libraries/paypal-php-sdk/paypal/rest-api-sdk-php/lib/PayPal/Auth/OAuthTokenCredential.php(246): PayPal\Core\PayPalHttpConnection->execute('grant_type=clie...') #1 /home/discovercamerons/public_html/application/libraries/paypal-php-sdk/paypal/rest-api-sdk-php/lib/PayPal/Auth/OAuthTokenCredential.php(271): PayPal\Auth\OAuthTokenCredential->getToken(Array, 'AbdxpMla6Q-X4JO...', 'EK8N9eobAnkY63T...', 'grant_type=clie...') #2 /home/discovercamerons/public_html/application/libraries/paypal-php-sdk/paypal/rest-api-sdk-php/lib/PayPal/Auth/OAuthTokenCredential.php(210): PayPal\Auth\OAuthTokenCredential->generateAccessToken(Array, NULL) #3 /home/discovercamerons/public_html/application/libraries/paypal-php-sdk/paypal/rest-api-sdk-php/lib/PayPal/Auth/OAuthTokenCredential.php(160): PayPal\Auth\OAuthTokenCredential->updateAccessToken(Array) #4 /home/discovercamerons/public_html/application/libraries/paypal-php-sdk/paypal/rest-api-sdk-php/lib/PayPal/Handler/RestHandler.php(82): PayPal\Auth\OAuthTokenCredential->getAccessToken(Array) #5 /home/discovercamerons/public_html/application/libraries/paypal-php-sdk/paypal/rest-api-sdk-php/lib/PayPal/Transport/PayPalRestCall.php(75): PayPal\Handler\RestHandler->handle(Object(PayPal\Core\PayPalHttpConfig), '{"intent":"sale...', Array) #6 /home/discovercamerons/public_html/application/libraries/paypal-php-sdk/paypal/rest-api-sdk-php/lib/PayPal/Common/PayPalResourceModel.php(104): PayPal\Transport\PayPalRestCall->execute(Array, '/v1/payments/pa...', 'POST', '{"intent":"sale...', Array) #7 /home/discovercamerons/public_html/application/libraries/paypal-php-sdk/paypal/rest-api-sdk-php/lib/PayPal/Api/Payment.php(576): PayPal\Common\PayPalResourceModel::executeCall('/v1/payments/pa...', 'POST', '{"intent":"sale...', NULL, Object(PayPal\Rest\ApiContext), Object(PayPal\Transport\PayPalRestCall)) #8 /home/discovercamerons/public_html/application/controllers/Booking.php(184): PayPal\Api\Payment->create(Object(PayPal\Rest\ApiContext)) #9 /home/discovercamerons/public_html/application/controllers/Booking.php(137): Booking->create_payment_with_paypal(Array) #10 /home/discovercamerons/public_html/system/core/CodeIgniter.php(532): Booking->confirm_book_tour() #11 /home/discovercamerons/public_html/index.php(316): require_once('/home/discoverc...') #12 {main}

 

Please anyone suggest me to get rid off this.

Thanks and Regards 

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.