I am creating a small website on which I have implemented the PayPal REST API for processing credit card statements.
Now the problem is that it works fine using Sandbox credentials ... but when switching to Live Credentials it gives the following error:
Fatal error: "PayPal \ Exception \ PPConnectionException" exception with the message "Get an Http 401 response code when accessing https://api.paypal.com/v1/payments/payment . Resubmitted 0 times in C: \ xampp \ htdocs \ rest_api_sdk_php \ sample \ vendor \ paypal \ sdk-core-php \ lib \ PayPal \ Core \ PPHttpConnection.php: 99 Stack trace: # 0 C: \ xampp \ htdocs \ rest_api_sdk_php \ sample \ vendor \ paypal \ sdk-core php \ lib \ PayPal \ Transport \ PPRestCall.php (44): PayPal \ Core \ PPHttpConnection-> execute ('{"intent": "sale ...') # 1 C: \ xampp \ htdocs \ rest_api_sdk_php \ sample \ vendor \ paypal \ rest-api-sdk-php \ lib \ PayPal \ Api \ Payment.php (246): PayPal \ Transport \ PPRestCall-> execute (Array, '/ v1 / payments / pa ...', 'POST ',' {"intent": "sale ... ') # 2 C: \ xampp \ htdocs \ rest_api_sdk_php \ sample \ payments \ CreatePayment.php (89): PayPal \ Api \ Payment-> create (Object (PayPal \ Rest \ ApiContext)) # 3 {main} b Roshen in C: \ xampp \ htdocs \ rest_api_sdk_php \ sample \ vendor \ paypal \ sdk-core-php \ lib \ PayPal \ Core \ PPHttpConnection.php on line 99
Honestly, I have no idea what causes this error. When switching to PayPal Live, I made changes in two places. i.e.
1st in "bootstrap.php":
$apiContext = new ApiContext(new OAuthTokenCredential( '<Live Client ID>', '<Live Secret>'));
Give the identifier and secret identifier Live. And the other file in which I made the change is "sdk_config.ini":
;Service Configuration [Service] mode=live ; can be set to sandbox / live
Changed "mode" from "sandbox" to "live"
Is there any other file in which I have to make changes?
source share