广泛的沙箱测试后没有调用PayPal notify_url

时间:2013-01-28 17:33:14

标签: php paypal paypal-ipn paypal-sandbox

我正在为慈善棋盘游戏活动设计一个网站,人们可以在这里观看活动,并可以捐款捐给慈善机构(儿童游戏),以迫使玩家连续玩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

2 个答案:

答案 0 :(得分:1)

我在PayPal直接联系我,并得到以下回复......

  

关于IPN问题,我们昨晚发生了停电事故。它是固定的   在大约1-2点,IPN被推迟,因为我们有一个备份队列   大约250万IPN没有发出。我们正在   通过这些IPN工作。我很快就会期待正常的功能。

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

答案 1 :(得分:0)

我们遇到了同样的问题。

现在几个月完美无缺,剧本仍然保持不变。 PayPal IPN也在PayPal帐户中启用,我们的IPN今天早上就停止了。

PayPal可能存在问题,我们仍在尝试解决这个问题。

相关问题