PayPal IPN帖子变量''txn_id“没有设置
问题描述:
当一个IPN验证为完成时,我的代码将txn_id放入数据库中,但没有设置,我正在使用的所有其他PayPal变量都设置了, 。不是我需要一种方法来唯一标识所以这就是为什么我使用的变量,这里的交易是我的代码,我用抢ID:PayPal IPN帖子变量''txn_id“没有设置
$txn_id = $_POST['txn_id'];
我检查的变量PayPal的列表,并txn_id被列入但我没有收到任何东西/它没有设置。
付款不是订阅付款,这只是一个正常的一次性购买付款。
答
您如何/您在哪里接收数据?向我们展示您的HTML。
我最近无法从PayPal接收POST数据。但是,IPN.php仍然有效。您可以在IPN /返回页面上进行一些调试。
将此信息添加到您的PayPal文件中,确切了解您收到的内容。如果POST部分为空,那将是您的问题,您可能需要使用GET数据。
选项1)转储一切success.php接收到文件
function test_file_dump2($msg) {
$filename = dirname(__FILE__).'-IPN-dump.log';
$f = fopen($filename, 'a');
fwrite($f, var_export($msg, true) . "\n");
fclose($f);
}
test_file_dump2($_POST);
test_file_dump2($_GET);
选项2)登录该目录中的所有错误
ini_set('error_reporting', E_ALL); // everything. Change to E_ALL & ~E_NOTICE); to remove notices
error_reporting(E_ALL);
ini_set('html_errors',TRUE);
ini_set('log_errors', TRUE);
ini_set('display_errors',TRUE);
ini_set('error_log', dirname(__FILE__) . '/-errors-ipn.log');
选项3)如果或页面,您可以见
echo "<pre> GET contents<br><br>"; print_r($_GET); echo "</pre>";
echo "<pre> POST contents<br><br>"; print_r($_POST); echo "</pre>";