0

对于在线支付,我正在尝试使用 ci_merchant。根据http://ci-merchant.org/ ,我做了一个 CodeIgniter 项目。但该功能仅显示空白页。

我的功能如下:

 function transaction(){
    $this->load->library('merchant');
    $this->merchant->load('paypal_express');
    $settings = $this->merchant->default_settings();

    $settings = array(
        'username' => 'AAAAAAAAAAA',
        'password' => '111111',
        'signature' => 'AAAAAAAAAAAARCpSSRl31AoJ0SIOUHEnDbhhEgANdZeAmMTkU',
        'test_mode' => true
    );
    $this->merchant->initialize($settings);

        $params = array(
            'amount' => 1.00,
            'currency' => 'USD',
            'return_url' => 'http://localhost/tcm/account/transaction_return',
            'cancel_url' => 'http://localhost/tcm/account/transaction_cancel'
        );
        //'return_url' => 'https://www.example.com/checkout/payment_return/123',
        //'cancel_url' => 'https://www.example.com/checkout');
        $response = $this->merchant->purchase($params);

        if ($response->success()){
            echo "Successfully complete transaction.";
        }
        else{
            $message = $response->message();
            echo('Error processing payment: ' . $message);
            exit;
        } 
}

我的代码或程序的问题在哪里?等待肯定的答复。

4

1 回答 1

0

我认为您错过了$this->以下代码片段中的部分:

if ($response->success()){
            echo "Successfully complete transaction.";
        }
        else{
            $message = $response->message();
            echo('Error processing payment: ' . $message);
            exit;
        } 

试试看:

if ($response->$this->success()){
            echo "Successfully complete transaction.";
        }
        else{
            $message = $response->$this->message();
            echo('Error processing payment: ' . $message);
            exit;
        } 
于 2014-06-02T05:29:28.487 回答