3

我正在尝试使用 paypal express 驱动程序将 ci-merchant 与 codeigniter 集成。我按照文档中给出的步骤进行操作。我能够将我的网站重定向到总成本和一切可用的贝宝沙盒支付网站。但是当我尝试通过登录使用贝宝沙盒帐户付款时,即使我的帐户中有足够的钱,它也不会显示贝宝余额。当我点击立即付款时,它会将我成功重定向到返回 url,并在 url 中包含令牌和付款人 ID。但是没有资金被转移。不确定我哪里出错了。

网址:../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);

    }

}
4

3 回答 3

0

确保 CI Merchant 正在调用 PayPal 的 DoExpressCheckout API。这是 Express Checkout 的最后一个 API 调用,也是真正完成支付和转账的 API。

于 2013-05-28T04:58:07.210 回答
0

如果我理解正确,沙盒账户应该有一个买卖账户。您需要检查卖家账户才能看到来自买家账户的购买。

我认为问题不在于 CI Merchant。

于 2013-05-27T20:45:49.953 回答
0

使用 ci-merchant,您需要在退货页面上调用 purchase_return 以完成付款,看起来您只是将所有内容放在初始(贝宝前)页面上,而不会做任何事情。

于 2013-05-28T22:45:48.973 回答