Nitesh Dhiman
Nitesh Dhiman

Reputation: 69

Paypal Integration, Error while live payment

An uncaught Exception was encountered Type: PayPal\Exception\PayPalConnectionException

Message: Got Http response code 401 when accessing https://api.sandbox.paypal.com/v1/payments/payment/PAYID-L6LQRCA096350664R714145G.

Filename: /home/masteai9/public_html/finder/application/libraries/PayPal-PHP-SDK/paypal/rest-api-sdk-php/lib/PayPal/Core/PayPalHttpConnection.php

Line Number: 207

Upvotes: 0

Views: 82

Answers (1)

Preston PHX
Preston PHX

Reputation: 30477

401 when accessing https://api.sandbox.paypal.com

That's not a live call. Note "sandbox." in the URL.

Seems PAYID-L6LQRCA096350664R714145G was created in the live environment, and you're trying to access it in the sandbox environment.

PAYID-L6LQRCA096350664R714145G doesn't exist in the sandbox environment. The two environments are completely separate.


As a side note, the PayPal-PHP-SDK is deprecated, so if this is a new integration you should be using the current v2 Checkout-PHP-SDK instead. See the documentation for 'Set Up Transaction' and 'Capture Transaction' at https://developer.paypal.com/docs/checkout/reference/server-integration/ and create a route for each.

Pair your two routes with this web approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server

Upvotes: 0

Related Questions