Paypal Notify URL使用CodeIgniter未返回任何内容



首先,我的沙盒商家帐户被配置为接收IPN。我将向您展示我发送到Paypal的前半部分代码:

function process() {
    $my_email = 'jaylimix-facilitator@hotmail.com';
    $item_name = $this->input->post('item_name');
    $amount = $this->input->post('amount');
    $function = $this->input->post('function');
    $return_url = base_url() . 'order/'.$function;
    $cancel_url = 'http://cancel.com';
    $notify_url = base_url() . 'test';
    $querystring .= "?business=" . urlencode($my_email) . "&";
    $querystring .= "item_name=" . urlencode($item_name) . "&";
    $querystring .= "amount=" . urlencode($amount) . "&";
    foreach ($_POST as $key => $value) {
        $value = urlencode(stripslashes($value));
        $querystring .= "$key=$value&";
    }
    $querystring .= "return=" . urlencode($return_url) . "&";
    $querystring .= "cancel_return=" . urlencode($cancel_url) . "&";
    $querystring .= "notify_url=" . urlencode($notify_url);
    header('location:https://www.sandbox.paypal.com/cgi-bin/webscr' . $querystring);
}

客户被重定向到PayPal以完成付款。当点击支付按钮时,我检查是否收到任何POST变量:

class Test extends CI_Controller{
function index(){
    foreach ($_POST as $key => $value) {
        echo $key . ' ' . $value . '<br/>';
    }
}

}

但是没有收到,我不知道问题出在哪里。请给出你的建议,谢谢!

当点击支付按钮时,我检查是否收到任何POST变量:

事实并非如此。PayPal稍后会单独调用notifyURL,而不是"单击支付按钮时"。当PayPal返回您的网站时,您所知道的只是他们去过PayPal。无论如何,在PayPal告诉你确实有钱之前,你不应该为客户做任何有价值的事情。

最新更新