gpt4 book ai didi

paypal - 为什么 sandbox paypal 不向我发送 IPN?

转载 作者:太空宇宙 更新时间:2023-11-03 16:12:25 25 4
gpt4 key购买 nike

几天前,我的处理人和paypal 进行了沟通,然后发生了一些事情,使后者不再发送IPN。我尝试通过我自己的脚本模拟 IPN 发送,但没有使用 cURL 进行验证的回发功能。我的处理程序工作正常。我还在回发到 paypal 的行之前放置了一行简单的代码(已经通过 cURL 测试过),这样我就可以检查 paypal 的响应。该行代码只是将 IPN 记录到数据库中。它也没有记录。应该对吧?因为paypal发送了两次IPN。我确保在我的商家帐户中打开了 IPN,并且链接指向我的处理程序。现在我开始怀疑 paypal 没有给我发送任何东西。这是我的处理程序:

<?php

require_once 'classes/Mysql.php';
require_once 'classes/Email.php';

$mysql = new Mysql();
$myemail = new Email();

// read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-validate';

foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}

// assign posted variables to local variables
$item_name = $_POST['item_name'];
$payment_status = $_POST['txn_type'];
$payment_amount = $_POST['mc_amount3'];
$payment_currency = $_POST['mc_currency'];
$subscr_id = $_POST['subscr_id'];
$receiver_email = urldecode($_POST['receiver_email']);
$payer_email = $_POST['payer_email'];
$subscr_type = $_POST['option_selection1'];
$username = $_POST['custom'];

//Save a copy of $req to the database. If paypal sends IPN, this should at least grab the first one before validation.
$memberID = $mysql->get_member_id($username);
$mysql->test_message($req.$payment_amount.$payment_currency, $memberID, $username, $payment_amount, $payment_currency);

// post back to PayPal system to validate
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);

if (!$fp) {
// HTTP ERROR
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0) {

//This if block does the payment processing. If I place this before the validation/post back occurs, it doesn't work either. But it works when testing using my cURL script--- before the validation.
if($memberID)
{
if($payment_status=='subscr_signup' && $payment_currency=='USD' && !$mysql->check_if_transactionID_exists($subscr_id))
{
$mysql->activate_subscription($memberID, $subscr_id, $subscr_type, $payment_amount);
}

}

}
else if (strcmp ($res, "INVALID") == 0) {
// log for manual investigation
}
}
fclose ($fp);
}

我听过很多故事,paypal 设置太令人沮丧了。可能是 Paypal 没有发送 IPN 还是我的处理程序有问题?

最佳答案

我遇到过类似的问题——如果您从 $res = fgets ($fp, 1024); 行转储 var $res,您您会看到 HTTP/1.1 200 OK,而不是您要查找的 VERIFIED/INVALID

尝试查看此答案以获取更多信息:Paypal IPN returning HTTP/1.1 200 OK

关于paypal - 为什么 sandbox paypal 不向我发送 IPN?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3561869/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com