I 'm trying to implement paypal payment with laravel into my website.
I used omnipay
laravel package and now I'm working with sandbox for testing.
I verified
I configured my request like this:
$gateway = Omnipay::create('PayPal_Express');
$gateway->setUsername('my_user_name_from_sandbox');
$gateway->setPassword('my_passwrd_from_sandbox');
$gateway->setSignature('my_signature_from_sandbox');
$gateway->setTestMode(true);
$response = $gateway->purchase(
array(
'cancelUrl' => 'http://localhost/payment_cancel',
'returnUrl' => 'http://localhost/payment_success',
'name' => 'item11',
'description' => 'description',
'amount' => '50.00',
'currency' => 'USD'
)
)->send();
and in the success function I copied the above code :
$response = $gateway->completePurchase(
array(
'cancelUrl' => 'http://localhost/payment_cancel',
'returnUrl' => 'http://localhost/payment_success',
'amount' => '50.00',
'currency' => 'USD'
)
)->send();
$data = $response->getData(); // this is the raw response object
echo '<pre>';
print_r($data);
as a result I get failure transaction:
Array
(
[TIMESTAMP] => 2014-10-29T20:55:40Z
[CORRELATIONID] => 34f24e6e8194c
[ACK] => Failure
[VERSION] => 85.0
[BUILD] => 13565888
[L_ERRORCODE0] => 10002
[L_SHORTMESSAGE0] => Security error
[L_LONGMESSAGE0] => Security header is not valid
[L_SEVERITYCODE0] => Error
)
I verified that the username,password and signature are the same as the sandbox parameters, and I verified that the returned url seperate parameters with &
.
--edit--
I have read thisso that I checked the mentioned parameters in the omnipay package and I found this :
protected $liveEndpoint = 'https://api-3t.paypal.com/nvp';
protected $testEndpoint = 'https://api-3t.sandbox.paypal.com/nvp';
the error is : production.ERROR: exception 'Guzzle\Http\Exception\CurlException' with message '[curl] 6: Could not resolve host: api-3t.paypal.com
Could you please help me to resolve this problem?