【问题标题】:PayPal notify_url not being called after extensive sandbox testing广泛的沙盒测试后未调用 PayPal notify_url
【发布时间】:2013-01-28 17:33:14
【问题描述】:

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

【问题讨论】:

  • 发布你目前拥有的代码。
  • 抱歉,按了提交有点快:/

标签: php paypal paypal-ipn paypal-sandbox


【解决方案1】:

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

关于 IPN 问题,我们昨晚遇到了中断。它是固定的 大约凌晨 1 点到 2 点,IPN 延迟,因为我们有一个备用队列 大约 250 万个未发送的 IPN。我们正在 通过这些 IPN 工作。我希望很快就能正常使用。

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

【讨论】:

    【解决方案2】:

    我们遇到了同样的问题。

    几个月来它运行得非常好,脚本保持不变。 PayPal IPN 也已在 PayPal 帐户中启用,而我们的 IPN 今天早上刚刚停止。

    PayPal 可能存在问题,我们仍在努力解决。

    【讨论】:

      猜你喜欢
      • 2011-06-05
      • 2013-03-23
      • 2015-07-11
      • 2011-02-20
      • 2011-11-01
      • 2013-02-28
      • 2011-01-15
      • 2017-05-02
      • 2013-03-12
      相关资源
      最近更新 更多