我试图用laravel实现paypal付款到我的网站。
我使用了omnipay
laravel包,现在我正在使用沙箱进行测试。
我验证了
我像这样配置了我的请求:
$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();
在成功函数中我复制了上面的代码:
$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);
因此我得到了失败的交易:
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
)
我确认用户名,密码和签名与沙盒参数相同,并且我验证了返回的网址单独的参数 {{1 }}
- 编辑 -
我已阅读this,以便检查omnipay包中提到的参数,我发现了这个:
&
错误是:protected $liveEndpoint = 'https://api-3t.paypal.com/nvp';
protected $testEndpoint = 'https://api-3t.sandbox.paypal.com/nvp';
你能帮我解决这个问题吗?