Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
paypal按钮/IPN发票名称_Paypal_Paypal Ipn - Fatal编程技术网

paypal按钮/IPN发票名称

paypal按钮/IPN发票名称,paypal,paypal-ipn,Paypal,Paypal Ipn,我目前接受付款的设置如下: // post to third party software // $header .= "POST /script.php HTTP/1.0\r\n"; $header .= "Host: www.thirdpartysoftwaresite.com\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strl

我目前接受付款的设置如下:

// post to third party software //
$header .= "POST /script.php HTTP/1.0\r\n";
$header .= "Host: www.thirdpartysoftwaresite.com\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";

$port = 123; //replace this with actual port on server

// Open a socket for the 3rd party software
$fp = fsockopen('http://www.thirdpartysoftwaresite.com/', $port, $errno, $errstr, 30);

// Send the HTTP POST request
fputs($fp, $header . $req);
我使用定制的paypal按钮代码,在这里我设置了我的通知url IPN,并返回带有我想要传递的参数的url,例如UTM_SOURCE,这样我就可以知道哪个活动产生了销售

我有一个IPN的监听器,可以获取这些信息,并在我的系统中为买家创建一个新用户

我将带有多个IPN php脚本的IPN转发给第三方开票软件,该软件生成发票并将其发送给买方

问题是:

发票软件从他们的paypal帐户中获取用户名,而且似乎很多人需要发票的名称不同

有没有办法操纵买家的名字,这样当我将IPN信息转发给发票软件时,它会包括我记录中的名字,而不是paypal Pass的名字

注意:我宁愿不使用paypal的API来实现这一点


谢谢:

下面是一个PHP示例,说明如何实现这一点。从本质上讲,您可以遍历IPN值,然后将它们添加回您自己的名称/值对字符串中。但在将每个值添加到字符串之前,请检查它是否是名或姓,如果是,请将其设置为已设置的某个变量

$modified_first_name = "Bob";
$modified_last_name = "Smith";

foreach ($_POST as $key => $value) {         // Loop through the notification NV pairs
    //Check if is first or last name, and modify the name
    switch ($key) {
        case 'first_name':
            $value = $modified_first_name;
            break;
        case 'last_name':
            $value = $modified_last_name;
            break;
    } //end switch $key

    //Add to NV pairs
    $value = urlencode(stripslashes($value));  // Encode these values
    $req  .= "&$key=$value";                   // Add the NV pairs to the acknowledgement
}
编辑:至于问题的第二部分,向第三方软件发送通知,您根本不应该向第三方软件发送IPN。相反,使用从我上面粘贴的脚本派生的数据,使用POST将数据发送到第三方软件。您可以这样做:

// post to third party software //
$header .= "POST /script.php HTTP/1.0\r\n";
$header .= "Host: www.thirdpartysoftwaresite.com\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";

$port = 123; //replace this with actual port on server

// Open a socket for the 3rd party software
$fp = fsockopen('http://www.thirdpartysoftwaresite.com/', $port, $errno, $errstr, 30);

// Send the HTTP POST request
fputs($fp, $header . $req);