php - 广泛的沙盒测试后未调用 PayPal notify_url

标签 php paypal paypal-ipn paypal-sandbox

我正在为一项慈善棋盘游戏事件设计一个网站,人们可以在其中现场观看事件,还可以向慈善机构(Child's Play)捐款,以迫使玩家连续玩 60 小时。因为捐款是直接捐给 Child's Play 的,所以我需要使用 notify_url 设置来传入我的 IPN 通知 URL;我们之前已经完成了两次马拉松比赛并且没有遇到任何问题,但我们最近将其移植到了 PHP。

现在,在过去的几个月里,我一直在使用沙箱对网站进行广泛的测试,一切都运行良好。离马拉松只有几个星期了,所以我切换到实际的 PayPal 系统,启动了测试捐赠,现在我遇到了一个问题:出于某种原因,PayPal 根本没有点击 notify_url。我已经通过暂时切换回沙盒验证了 URL,一切正常。我还在监听器代码中添加了一些对 error_log 的调用,以查看它是否只是在某处的代码中被捕获,但发现它根本没有被命中。

如果有人能在这里就我能做什么提出任何建议,我将不胜感激。显然,我的时间有点紧迫,所以如果您能尽快回复,我将不胜感激。

编辑:这是相关代码:

if (isset($_GET['paypalipn'])) {
  // tell PHP to log errors to ipn_errors.log in this directory
  ini_set('log_errors', true);
  ini_set('error_log', dirname(__FILE__).'/ipn_errors.log');

  // intantiate the IPN listener
  $listener = new IpnListener();

  // tell the IPN listener to use the PayPal test sandbox
  $listener->use_sandbox = false;

  error_log("here");

  // try to process the IPN POST
  try {
    $listener->requirePostMethod();
    $verified = $listener->processIpn();
  } catch (Exception $e) {
    error_log($e->getMessage());
    exit(0);
  }

  error_log("here2");

  // Process the IPN
  if ($verified) {

      error_log("here3");

      $errmsg = '';   // stores errors from fraud checks

      // Split the custom variable
      $split_custom = explode("&", $_POST['custom']);
      $custom_array = array();
      for ($i = 0; $i<count($split_custom); $i++) {
        $current_set = explode("=", $split_custom[$i]);
        $custom_array[$current_set[0]] = $current_set[1];
      } 

      error_log("here4");

      if (!isset($custom_array['game'])) {
        $custom_array['game'] = 0;
      }
      if (!isset($custom_array['player'])) {
        $custom_array['player'] = 0;
      }

      error_log("here5");

      if (!empty($errmsg)) {

          // manually investigate errors from the fraud checking
          $body = "IPN failed fraud checks: \n$errmsg\n\n";
          $body .= $listener->getTextReport();
          mail('jafawcett@gmail.com', 'IPN Fraud Warning', $body);

      } else {

          mail('jafawcett@gmail.com', 'Successful IPN', $listener->getTextReport());
      }

      error_log("donor_un: ".$custom_array['donor_un']);
      process_donation($_POST['mc_gross'], $custom_array['player'], $custom_array['game'],     $custom_array['donor_name'], $_POST['payer_email'], $custom_array['donor_un']);

  } else {
      // manually investigate the invalid IPN
      mail('jafawcett@gmail.com', 'Invalid IPN', $listener->getTextReport());
  }

}

对于 ipn 监听器类,我使用的是 Micah Carrick 创建的类,可在此处获取: https://github.com/Quixotix/PHP-PayPal-IPN

最佳答案

我就此事询问了我在 PayPal 的直接联系人并得到了以下回复...

In regards to the IPN issue, we had an outage last night. It was fixed at about 1-2am, the IPN’s are delayed because we had a backed up queue of about 2.5 million IPN’s which did not send out. We are currently working through these IPN’s. I’d expect normal functionality shortly.

您还可以看到很多人在谈论 this issue on Twitter .

关于php - 广泛的沙盒测试后未调用 PayPal notify_url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14567768/

相关文章:

javascript - 如何在数据表中显示数据库中的数据

paypal - PayFlow 定期付款

paypal - 我们如何使用paypal payflow来拆分金额

php - 如何将自定义数据发送到 Paypal 并接收回来

php - 在 PHP 中向 Mysql 表添加项目

php - 最简单的 Javascript If 语句不起作用

api - 如何格式化 SOAP 请求?

PHP Paypal IPN争议处理

c# - 无法通过Paypal测试工具测试IPN(HTTP错误代码500)_Asp.net

javascript - 提交表单时不使用 javascript 发送图像,不刷新页面