2017-05-05 3 views
1

Ich richte einfache paypal auschecken mit Rest Api (keine Kreditkartenzahlung).Paypal Zahlungsabwicklung mit REST api

Alles funktioniert perfekt im Sandbox-Modus, aber wenn ich in den Live-Modus wechseln und Live-Modus clientID mit Geheimschlüssel verwenden. Ich bekomme diese Fehlermeldung:

PHP Fatal error: Uncaught exception 'PayPal\Exception\PayPalConnectionException' with message 'Got Http response code 401 when accessing https://api.sandbox.paypal.com/v1/oauth2/token.' in /vendor/paypal/rest-api-sdk-php/lib/PayPal/Core/PayPalHttpConnection.php:154 
Stack trace: 
#0 /vendor/paypal/rest-api-sdk-php/lib/PayPal/Auth/OAuthTokenCredential.php(241): PayPal\Core\PayPalHttpConnection->execute('grant_type=clie...') 
#1 /vendor/paypal/rest-api-sdk-php/lib/PayPal/Auth/OAuthTokenCredential.php(266): PayPal\Auth\OAuthTokenCredential->getToken(Array, '***', '***...', 'grant_type=clie...') 
#2 /vendor/paypal/rest-api-sdk-php/lib/PayPal/Auth/OAuthTokenCredential.php(210): PayPal\Auth\OAuthTokenCredential->generateAccessToken(Array, NULL) 
#3 /vendor/paypal/rest-api-sdk-php/lib/PayPal/Auth/OAuthTokenCredential.php(160 in /vendor/paypal/rest-api-sdk-php/lib/PayPal/Core/PayPalHttpConnection.php on line 154 

Es geschieht nur im Live-Modus ... Ich habe alle Schlüssel und alles richtig eingerichtet ist, aus meiner Sicht. Bitte lassen Sie mich wissen, wie das behoben werden kann?

Antwort

1

Das Problem ist gelöst!

Ich brauchte den Folowing Code manuell hinzufügen Live-Modus zu konfigurieren:

$paypal->setConfig(
     array(
     'mode' => 'live', 
     'log.LogEnabled' => true, 
     'log.FileName' => 'PayPal.log', 
     'log.LogLevel' => 'FINE' 
    ) 
    ); 
+0

Für Laravel: $ apiContext-> setConfig müssen festgelegt werden. https://github.com/paypal/PayPal-PHP-SDK/wiki/Adding-Configurations –

Verwandte Themen