【问题标题】:CI_Merchant is not displaying anythingCI_Merchant 没有显示任何内容
【发布时间】:2014-07-21 15:47:30
【问题描述】:

对于在线支付,我正在尝试使用 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;
        } 
}

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

【问题讨论】:

  • 尝试在顶部添加类似echo "this point achieved"; 的内容,以确保执行此功能
  • 我检查了,该功能正在运行。
  • 在 if 语句之前尝试 echo $this->merchant->purchase($params)->success();echo $this->merchant->purchase($params)->message();

标签: codeigniter paypal ci-merchant


【解决方案1】:

我认为你错过了下面代码 sn-p 中的 $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;
        } 

【讨论】:

  • 同样的问题没有输出。
猜你喜欢
  • 2020-03-24
  • 2016-02-19
  • 2020-06-16
  • 2021-02-05
  • 2018-10-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多