0

我正在尝试在我的网站中使用 laravel 实现贝宝付款。我使用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
)

我验证了用户名、密码和签名与沙箱参数相同,并且我验证了返回的url&.

- 编辑 -

我已经阅读了这个,所以我检查了omnipay包中提到的参数,我发现了这个:

protected $liveEndpoint = 'https://api-3t.paypal.com/nvp';
protected $testEndpoint = 'https://api-3t.sandbox.paypal.com/nvp';

错误是:production.ERROR: exception 'Guzzle\Http\Exception\CurlException' with message '[curl] 6: Could not resolve host: api-3t.paypal.com 你能帮我解决这个问题吗?

4

0 回答 0