Probleme bei der EInbindung von Paypal

  • Hallo liebe Community,



    ich bin blutige Anfänger auf dem Gebiet und versuche gerade Paypal in meine Website (läuft über xampp auf meinem localhost) einzubinden.


    Ich habe versucht mich dabei an die Anleitung von Paypal zu halten (https://developer.paypal.com/docs/api/quickstart/payments/).


    Doch als ich das ganze ausführen wollte bekam ich folgenden Fehlermeldung, deren Bedeutung, ich trotz bemühen leider nicht verstehe.


    Bitte helft mir.



    LG:)


    Fehlermeldung:



    401{"error":"invalid_client","error_description":"Client Authentication failed"}PayPal\Exception\PayPalConnectionException: Got Http response code 401 when accessing https://api.sandbox.paypal.com/v1/oauth2/token. in C:\xampp\htdocs\test\vendor\paypal\rest-api-sdk-php\lib\PayPal\Core\PayPalHttpConnection.php:202 Stack trace: #0 C:\xampp\htdocs\test\vendor\paypal\rest-api-sdk-php\lib\PayPal\Auth\OAuthTokenCredential.php(241): PayPal\Core\PayPalHttpConnection->execute('grant_type=clie...') #1 C:\xampp\htdocs\test\vendor\paypal\rest-api-sdk-php\lib\PayPal\Auth\OAuthTokenCredential.php(266): PayPal\Auth\OAuthTokenCredential->getToken(Array, 'ID: ARdm2094wUO...', 'EPvlzKP7_S7vjjm...', 'grant_type=clie...') #2 C:\xampp\htdocs\test\vendor\paypal\rest-api-sdk-php\lib\PayPal\Auth\OAuthTokenCredential.php(210): PayPal\Auth\OAuthTokenCredential->generateAccessToken(Array, NULL) #3 C:\xampp\htdocs\test\vendor\paypal\rest-api-sdk-php\lib\PayPal\Auth\OAuthTokenCredential.php(160): PayPal\Auth\OAuthTokenCredential->updateAccessToken(Array) #4 C:\xampp\htdocs\test\vendor\paypal\rest-api-sdk-php\lib\PayPal\Handler\RestHandler.php(82): PayPal\Auth\OAuthTokenCredential->getAccessToken(Array) #5 C:\xampp\htdocs\test\vendor\paypal\rest-api-sdk-php\lib\PayPal\Transport\PayPalRestCall.php(70): PayPal\Handler\RestHandler->handle(Object(PayPal\Core\PayPalHttpConfig), '{"intent":"sale...', Array) #6 C:\xampp\htdocs\test\vendor\paypal\rest-api-sdk-php\lib\PayPal\Common\PayPalResourceModel.php(104): PayPal\Transport\PayPalRestCall->execute(Array, '/v1/payments/pa...', 'POST', '{"intent":"sale...', Array) #7 C:\xampp\htdocs\test\vendor\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 C:\xampp\htdocs\test\paypal1.php(52): PayPal\Api\Payment->create(Object(PayPal\Rest\ApiContext)) #9 {main}

  • Ok, ich habe eine Vermutung, kann allerdings auch komplett falsch liegen:


    Und zwar hast du ja jetzt beides auf einer Seite, wodurch immer beides ausgeführt wird.


    So könntest du das lösen:

    Du hast deine Seite, wo du vom User die Zahlung entgegennimmst und erstellst. Das ist im Prinzip der Code bis Zeile 64. Die andere Seite (z.B. payment.php) ist dann die Seite, wohin PayPal redirected und du die Zahlung ausführst. Das wäre dann der Rest ab Zeile 68.


    Ansonsten ist nicht ersichtlich, was die Bootstrap-Datei in Zeile 65 soll und du musst das natürlich alles noch absichern, validieren usw., aber erstmal muss es funktionieren...

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!