Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CodeIgniter、CI商家和Paypal沙箱_Codeigniter_Paypal Sandbox_Ci Merchant - Fatal编程技术网

CodeIgniter、CI商家和Paypal沙箱

CodeIgniter、CI商家和Paypal沙箱,codeigniter,paypal-sandbox,ci-merchant,Codeigniter,Paypal Sandbox,Ci Merchant,我正在尝试使用CodeIgniter制作一个小购物车,我发现CI Merchant可以使用本指南使用支付网关,但我真的不知道如何使用Paypal Sandbox $this->load->library('merchant'); $this->merchant->load('paypal_express'); $settings = array( 'username' => 'test@test.com', 'password' => '***

我正在尝试使用CodeIgniter制作一个小购物车,我发现CI Merchant可以使用本指南使用支付网关,但我真的不知道如何使用Paypal Sandbox

$this->load->library('merchant');
$this->merchant->load('paypal_express');
$settings = array(
    'username' => 'test@test.com',
    'password' => '********',
    'signature' => 'Test Store',
    'test_mode' => true);

$this->merchant->initialize($settings);
$params = array(
    'amount' => 12.00,
    'currency' => 'CAD',
    'return_url' => 'http://payment.test.com',
    'cancel_url' => 'http://payment.test.com/cancel');

$response = $this->merchant->purchase($params);
$this->load->view('welcome_message');

我知道这段代码做不了什么,但它什么也做不了。只是加载视图,什么也没发生,我不明白。所以,我的问题是,你们知道教程吗,或者只是知道如何让CI Merchant与Paypal Sandbox一起工作?谢谢你的帮助。

Ace的评论很到位。代码没有问题,但需要检查
$response
对象以查看结果(或错误消息)

您也可以简单地尝试以下方法来检查对象:

$response = $this->merchant->purchase($params);
echo '<pre>';
print_r($response);
exit;
$response=$this->merchant->purchase($params);
回声';
打印(回复);
出口

试着像这样打印
$response
;var_dump($response);打印“”在
$this>加载视图之前('welcome\u message)
查看结果。因此我添加了
print”“;var_dump($response);打印“”
$this>加载视图之前('welcome\u message)我得到了
对象(商户响应)[17]受保护的“\u状态”=>字符串“失败”(长度=6)受保护的“\u消息”=>字符串”安全头无效(长度=28).
然后我意识到我们需要使用“API和支付卡凭据”而不是卖家帐户的凭据。所以现在它工作了,我可以继续编码了!谢谢,我找到问题了!我使用了贝宝的错误凭证,所以,这只是一个代码18啊哈!我已经把我的证书从它是错误的还是正确的链接?
$response = $this->merchant->purchase($params);
echo '<pre>';
print_r($response);
exit;