我正在尝试使用paypal express驱动程序将ci-merchant与codeigniter集成。我按照文件中给出的步骤进行操作。我能够将我的网站重定向到paypal沙盒支付网站,其中总费用和一切都可用。但是,当我尝试通过登录使用paypal沙盒帐户进行支付时,即使我的帐户中有足够的费用,也不会向我显示paypal余额。当我点击立即付款时,它会使用网址中的令牌和付款人ID将我重定向到返回网址。但是没有资金被转移。不确定我哪里出错了。
url:../ retSuccess?token = EC-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);
}
}
答案 0 :(得分:0)
如果我理解正确,沙箱帐户应该有买家和卖家帐户。您需要检查卖家帐户,以便从买家帐户中查看购买。
我不认为这个问题来自CI商人。
答案 1 :(得分:0)
确保CI商家正在调用PayPal的DoExpressCheckout API。这是Express Checkout的最后一次API调用,这是实际完成付款并转账的API。
答案 2 :(得分:0)
使用ci-merchant,您需要在返回页面上调用purchase_return来完成付款,看起来您只需将所有内容放在首页(预付费用)页面上,该页面将无法执行任何操作。