Я работаю над песочницей SDK SDK Paypal на моем WAMP
Я загрузил https://github.com/paypal/PayPal-PHP-SDK и настроил на моем WAMP, используя
https://github.com/paypal/PayPal-PHP-SDK/wiki
Запустив ниже один API на моем WAMP
https://github.com/paypal/PayPal-PHP-SDK/blob/master/sample/payments/CreatePaymentUsingPayPal.php
URL WAMP: http: // localhost: 5000 / payments / CreatePaymentUsingPayPal.php
После выполнения платежа я получил идентификатор авторизации.
"authorization": { "id": "94C27714AC6435104", "state": "authorized", "amount": { "total": "21.00", "currency": "USD", "details": { "subtotal": "17.50", "tax": "1.30", "shipping": "2.20" } },
Когда я запускаю http: // localhost: 5000 / payments / AuthorizationCapture.php
http://paypal.github.io/PayPal-PHP-SDK/sample/doc/payments/AuthorizationCapture.html
Я также пробовал передать мой идентификатор авторизации
$authId = '94C27714AC6435104';
Или
curl -v https://api.sandbox.paypal.com/v1/payments/authorization/94C27714AC6435104/capture \ -H "Content-Type:application/json" \ -H "Authorization: Bearer access_token$production$zsbtcmcqvdtgbfns$587003782e332bc0bbf00abc9cd89833" \ -d '{ "amount": { "currency": "USD", "total": "4.54" }, "is_final_capture": true }'
Но все же он не работает
400{"name":"UNKNOWN_ERROR","message":"An unknown error occurred.","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#UNKNOWN_ERROR","debug_id":"c82898421e4ba"}exception 'PayPal\Exception\PayPalConnectionException' with message 'Got Http response code 400 when accessing https://api.sandbox.paypal.com/v1/payments/payment.' in D:\wamp\www\PayPal-PHP-SDK-master\lib\PayPal\Core\PayPalHttpConnection.php:183 Stack trace: #0 D:\wamp\www\PayPal-PHP-SDK-master\lib\PayPal\Transport\PayPalRestCall.php(73): PayPal\Core\PayPalHttpConnection->execute('{"intent":"auth...') #1 D:\wamp\www\PayPal-PHP-SDK-master\lib\PayPal\Common\PayPalResourceModel.php(102): PayPal\Transport\PayPalRestCall->execute(Array, '/v1/payments/pa...', 'POST', '{"intent":"auth...', NULL) #2 D:\wamp\www\PayPal-PHP-SDK-master\lib\PayPal\Api\Payment.php(579): PayPal\Common\PayPalResourceModel::executeCall('/v1/payments/pa...', 'POST', '{"intent":"auth...', NULL, Object(PayPal\Rest\ApiContext), NULL) #3 D:\wamp\www\PayPal-PHP-SDK-master\sample\payments\AuthorizePayment.php(70): PayPal\Api\Payment->create(Object(PayPal\Rest\ApiContext)) #4 D:\wamp\www\PayPal-PHP-SDK-master\sample\capture.php(4): require('D:\\wamp\\www\\Pay...') #5 {main}