【问题标题】:How to pass data from textboxes to PayPal using CodeIgniter如何使用 CodeIgniter 将数据从文本框传递到 PayPal
【发布时间】:2014-10-21 14:41:34
【问题描述】:

我正在尝试在我的页面中进行 PayPal 交易。我定义了以下字段:

  • 名字
  • 姓氏
  • 地址
  • 电子邮件
  • 金额

当我点击继续付款时,它会将我的浏览器正确重定向到 PayPal。之后,我可以使用测试帐户登录并进行测试付款。问题是当我调用print_r 显示return_url 以检查已传递的数据时,我注意到我的输入文本框不存在。

这是发布到 PayPal 的代码:

$firstname = $this->input->post('firstname');
$lastname = $this->input->post('lastname');
$address = $this->input->post('address');
$email = $this->input->post('email');

$config['business'] = 'test@test.com';
$config['return'] = 'http://localhost/test/payment/return_details/';
$config['cancel_return'] = 'http://localhost/test/payment/create-job-listing/';
$config['production'] = FALSE; //Its false by default and will use sandbox
$config["first_name"] = 'asdasd';
$config["last_name"] = 'asasas';
$config['address1'] = 'new york';

$this->load->library('paypal',$config);

$this->paypal->add('Amount',0.1); 
$this->paypal->pay(); //Proccess the payment

有人可以帮我解决这个问题吗?

【问题讨论】:

    标签: php codeigniter paypal


    【解决方案1】:
    In your return_url put the code:
    
    <?php 
    
     echo "<pre>";
    
     $data = file_get_contents('php://input'); //this fetches the raw input stream
    
     $info = explode('&',$data);
    
     echo "<pre>";
    
     print_r($info); 
    

    ?>

    //paypal发送的信息在输入流中,这段代码获取输入!!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-08-31
      • 2017-08-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-28
      • 1970-01-01
      相关资源
      最近更新 更多