i'm trying to use the module speckpaypal for zf2 , but can't get the token , here is my code :
public function passTransactionAction(){
$config = $this->getServiceLocator()->get('Config');
$paypalConfig = new \SpeckPaypal\Element\Config($config);
//Then, set up http client using curl libraries provided by Zf2:
$client = new \Zend\Http\Client;
$client->setMethod('POST');
$client->setAdapter(new \Zend\Http\Client\Adapter\Curl);
$paypalRequest = new \SpeckPaypal\Service\Request;
$paypalRequest->setClient($client);
$paypalRequest->setConfig($paypalConfig);
$paymentDetails = new \SpeckPaypal\Element\PaymentDetails(array(
'amt' => '20.00'
));
$express = new \SpeckPaypal\Request\SetExpressCheckout(array('paymentDetails' => $paymentDetails));
$express->setReturnUrl('http://project.local/return');
$express->setCancelUrl('http://project.local/cancel');
$response = $paypalRequest->send($express);
echo $response->isSuccess();
$token = $response->getToken();
echo "---------------------- token : $token----------------------";
$this->redirect()->toUrl('https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token='.$token);
}
i had set the params in the config file ( a test account sandbox.paypal ), and when showing the $response value , i get this :
SpeckPaypal\Response\Response Object ( [_rawResponse:protected] => [_success:protected] => [_errors:protected] => Array ( [0] => ACK key not found in response. [1] => Configuration is not valid. ) [_response:protected] => [_multiFieldMap:protected] => Array ( [ERRORS] => Array ( [0] => LONGMESSAGE [1] => SEVERITYCODE [2] => SHORTMESSAGE [3] => ERRORCODE ) [FILTERS] => Array ( [0] => FMFfilterID [1] => FMFfilterNAME ) [ITEMS] => Array ( [0] => NAME [1] => DESC [2] => AMT [3] => NUMBER [4] => QTY [5] => TAXAMT [6] => ITEMWEIGHTVALUE [7] => ITEMWEIGHTUNIT [8] => ITEMLENGTHVALUE [9] => ITEMLENGTHUNIT [10] => ITEMWIDTHVALUE [11] => ITEMWIDTHUNIT [12] => ITEMHEIGHTVALUE [13] => ITEMHEIGHTUNIT [14] => ITEMCATEGORY ) ) )
Any idea from where comes the bug ? Thanks.