我正试图通过使用paypal express驱动程序将ci-merchant与codeigniter集成。我按照文件中给出的步骤进行。我能够让我的网站重定向到贝宝沙箱支付网站,总成本和一切都是可用的。但是当我登录paypal沙盒账户尝试支付时,即使我的账户中有足够的钱,也没有显示paypal的余额。当我现在点击支付时,它将我重定向到返回url, url中有令牌和付款人ID。但是没有资金转移。我不知道我哪里错了。
url: ../retSuccess?token= etc - 01m80248bn787213m&PayerID=9WLBBV9LM6TPA
$this->load->model('mainmodel');
$this->mainmodel->orderDetails();
$query = $this->mainmodel->retrieveOrder();
foreach ($query as $row){
$transaction_id = $row['transaction_id'];
}
$this->load->library('merchant');
$this->merchant->load('paypal_express');
$settings = array(
'username' => 'merchant_api1.canada.com',
'password' => '1369782104',
'signature' =>'AmTaSH3lkRIYxxjxUjB.1zqxD0cRA1hfMGBX2dV9h4DkcYQcjGtqDaYa',
'test_mode' => true);
$this->merchant->initialize($settings);
$params = array(
'amount' => $this->input->post('price'),
'currency' => 'CAD',
'description'=> $this->input->post('model_no'),
'return_url' => base_url('payment/transaction/'.$transaction_id),
'cancel_url'=> base_url('payment/cancel'));
$response = $this->merchant->purchase($params);
}
public function transaction(){
$transaction_id = $this->uri->segment(3);
$this->load->model('mainmodel');
$query = $this->mainmodel->loadTransaction($transaction_id);
foreach ($query as $row){
$price = $row['price'];
$desc = $row['model_no'];
$trans_id = $row['transaction_id'];
}
$this->load->library('merchant');
$this->merchant->load('paypal_express');
$params = array(
'amount' => '21.3',
'currency' => 'CAD',
'description' => 'SP66');
$response = $this->merchant->purchase_return($params);
if ($response->success())
{
$data['gateway_reference'] = $response->reference();
$data['model_no'] = $this->session->userdata('model_no');
$data['category'] = $this->session->userdata('category');
$data['specs'] = $this->session->userdata('specs');
$data['quantity'] = $this->session->userdata('quantity');
$newData = array('status'=>'complete',
'reference'=>$data['gateway_reference']);
$this->db->where('transaction_id',$trans_id);
$this->db->update('transactions',$newData);
$this->load->view('templates/success',$data);
}else{
$data['message'] = $response->message();
//$this->db->where('transaction_id',$trans_id);
//$this->db->delete('transactions');
$this->load->view('templates/failure',$data);
}
}
如果我理解正确的话,沙箱账户应该有一个买卖账户。您需要检查卖方账户才能看到从买方账户购买的东西。
我认为问题不是来自CI Merchant。
确保CI商家正在调用PayPal的DoExpressCheckout API。这是Express Checkout的最后一个API调用,这是实际完成支付和转账的API。
使用ci-merchant,您需要在返回页面上调用purchase_return来完成付款,看起来您只是将所有内容放在初始(pre-paypal)页面上,这不会做任何事情。