当验证IPN时,我的代码将TXN_ID放在数据库中,但没有设置它。我使用的所有其他PayPal变量都是设置的,但不是。我需要一种唯一身份交易的方法,所以这就是为什么我使用该变量,这是我用来获取ID的代码:
$txn_id = $_POST['txn_id'];
我检查了PayPal的变量列表,并在其中列出了TXN_ID列表,但我没有收到任何东西/没有设置。
付款不是订阅付款,这只是一个普通的一次购买付款。
您如何/在哪里接收数据?向我们展示您的html。
我最近在接收贝宝(PayPal)的帖子数据方面遇到了麻烦。但是,IPN.PHP仍然有效。您可以在IPN/返回页面上进行一些调试。
将其添加到您的PayPal文件中,以准确查看您要收到的内容。如果帖子部分为空,那将是您的问题,您可能需要使用获取数据。
选项1)将收到的所有内容都转储到文件
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)如果在Success.php或页面中,您可以看到
echo "<pre> GET contents<br><br>"; print_r($_GET); echo "</pre>";
echo "<pre> POST contents<br><br>"; print_r($_POST); echo "</pre>";