【发布时间】:2016-01-14 01:28:46
【问题描述】:
我正在使用以下类来处理 IPN 数据: https://github.com/WadeShuler/PHP-PayPal-IPN(多年来一直运行良好)
最后一次成功处理的付款是在 9 月 28 日,但在 10 月 5 日收到的下一次 IPN 付款返回了 INVALID 响应,此后的所有付款都是如此。
如果我在 IPN 模拟器中测试,则消息处理成功。 Sandbox 或 Live,响应无效。我原以为沙盒会有一个工具,我可以在其中查看为什么消息被拒绝为无效,但似乎不是这样?肯定是查看拒绝原因的简单方法,我错过了什么吗?
将您从我的网站带到 Paypal 的链接是:
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_ext-enter&redirect_cmd=_xclick&business=sales-facilitator@fydentry.com&item_name=QLD++%28Pacific+pines+secondary+Sat+25th+July+%29&item_number=FYD15000003&custom=0001000003&currency_code=AUD&amount=0.01&no_shipping=1&image_url=http://www.fydentry.com/img/follow-your-dreams-100.jpg&return=http://www.fydentry.com/entry-test.php&cancel_return=http://www.fydentry.com/entry-test.php&notify_url=http://www.fydentry.com/payback-test.php
从 Paypal 传回的数据是:
transaction_subject=0001000003&txn_type=web_accept&payment_date=07%3A05%3A07+Oct+15%2C+2015+PDT&last_name=buyer&residence_country=AU&pending_reason=multi_currency&item_name=QLD++%28Pacific+pines+secondary+Sat+25thbusiness+July+%29&payment=AUDgro =销售调解人%40fydentry.com&payment_type =即时与protection_eligibility =不合格的&verify_sign = Acssfl2b2v1gxOK33TD2StcDhf-OAZxwix74kxFlSgpWMku6myuy.WFL&payer_status =验证的&的test_ipn = 1&税= 0.00&PAYER_EMAIL =销售额 - 购买%40fydentry.com&txn_id = 9BV63134E20871700和数量= 1&RECEIVER_EMAIL =销售调解人%40fydentry.com&FIRST_NAME =测试&payer_id = FY3RYW98GNMXG&receiver_id = 95FC3QCK53MHC&item_number=FYD15000003&handling_amount=0.00&payment_status=Pending&shipping=0.00&mc_gross=0.01&custom=0001000003&charset=windows-1252¬ify_version=3.8&ipn_track_id=cfbd422d97d69
我发回 Paypal 的回复是:
cmd=_notify-validate&transaction_subject=0001000003&txn_type=web_accept&payment_date=07%3A05%3A07+Oct+15%2C+2015+PDT&last_name=buyer&residence_country=AU&pending_reason=multi_currency&item_name=QLD++%28Pacific+pines+secondary+Sat+25th+July%9&payment = mc_currency = AUD&商务=销售调解人%40fydentry.com&payment_type =即时与protection_eligibility =不合格的&verify_sign = Acssfl2b2v1gxOK33TD2StcDhf-OAZxwix74kxFlSgpWMku6myuy.WFL&payer_status =验证的&的test_ipn = 1&税= 0.00&PAYER_EMAIL =销售额 - 购买%40fydentry.com&txn_id = 9BV63134E20871700和数量= 1&RECEIVER_EMAIL =销售调解人%40fydentry.com&FIRST_NAME = test&payer_id = fy3ryw98gnmxg&receiver_id = 95fc3qck53mhc&item_number = fyd15000003&handling_amount = 0.00&payment_status = pending&shipping&shipping&shipping&0.01&mc_gross = 0.01和custom = 0001000003&charset = windows-1252&notify_version = 3.8&Ipn_track_id = CFBD422D97D69 P>
而payback-test.php中的代码是:
<?php
include_once("f_common.php");
include_once("IpnListener.php");
use wadeshuler\paypalipn\IpnListener;
$listener = new IpnListener();
$listener->use_sandbox = true;
$dbh = open_db();
$res = 'UNKNOWN';
try {
$listener->requirePostMethod();
$verified = $listener->processIpn();
} catch (Exception $e) {
error_log($e->getMessage());
exit(0);
}
if ($verified) {
$res = "VERIFIED";
} else {
$res = "INVALID";
}
$stmt_debug = $dbh->prepare('INSERT INTO fyd_paypal_ipn (post_data, response_data, status, message_time) VALUES (:post_data, :response_data, :status, UTC_TIMESTAMP())');
$stmt_debug->execute(array(':post_data' => $listener->rawPostData, ':response_data' => $listener->debug_response, ':status' => $res));
?>
请注意,出于本练习的目的,我还修改了 IpnListener 类,以便我可以获取响应的副本以进行调试。
在文件顶部的变量声明中,我公开了 $rawPostData,并添加了这个变量:
public $debug_response;
并在我们使用它之前存储该值:
$this->debug_response = $req;
if ($this->use_curl) {
$res = $this->curlPost($req);
} else {
$res = $this->fsockPost($req);
}
我假设 Paypal 方面发生了一些变化,一开始就停止了这项工作,但我看不出它是什么,特别是因为我的回答似乎是正确的(相同的),而我不能在沙盒方面找到任何可以帮助我确定为什么它被视为无效的东西?不幸的是,我跟踪 IPN 发布数据和响应的底部的调试代码是新的,所以我没有旧的(工作!)消息集来比较内容。
【问题讨论】:
-
该死的你的网站需要一些严肃的 CSS 工作。
-
CSS 值得我妻子为它付出的每一分钱:) 是的,这在某处的“待办事项”清单上。
-
祝你好运,这是个好主意
标签: php paypal paypal-ipn paypal-sandbox