我看到PayPal命中了ipn.php,但是我无法通过$ _REQUEST或$ _POST查看/捕获任何数据。从这篇帖子{Not receiving any IPN post for sandbox account}中,我看到我需要启用IPN,但是找不到它。
这是我的PHP代码
mysqli_query($con,"INSERT INTO dumped (dumped)
VALUES (".$_REQUEST.")");
但是,当我输入以下代码时,我看到数据已插入到DB表中。
mysqli_query($con,"INSERT INTO dumped (dumped)
VALUES ('blablabla')");
下面是提交的表格:
define( 'SSL_URL', 'https://www.paypal.com/cgi-bin/webscr' );
define( 'SSL_SAND_URL', 'https://www.sandbox.paypal.com/cgi-bin/webscr' );
$action = '';
//Is this a test transaction?
$action = ($data['paypal_mode']) ? SSL_SAND_URL : SSL_URL;
$form = '';
$form .= '<form name="frm_payment_method" action="' . $action . '" method="post">';
$form .= '<input type="hidden" name="business" value="' . $data['merchant_email'] . '" />';
// Instant Payment Notification & Return Page Details /
$form .= '<input type="hidden" name="notify_url" value="' . $data['notify_url'] . '" />';
$form .= '<input type="hidden" name="cancel_return" value="' . $data['cancel_url'] . '" />';
$form .= '<input type="hidden" name="return" value="' . $data['thanks_page'] . '" />';
$form .= '<input type="hidden" name="rm" value="2" />';
// Configures Basic Checkout Fields -->
$form .= '<input type="hidden" name="lc" value="" />';
/*$form .= '<input type="hidden" name="no_shipping" value="1" />';
$form .= '<input type="hidden" name="no_note" value="1" />';*/
// <input type="hidden" name="custom" value="localhost" />-->
$form .= '<input type="hidden" name="currency_code" value="' . $data['currency_code'] . '" />';
//$form .= '<input type="hidden" name="page_style" value="paypal" />';
$form .= '<input type="hidden" name="charset" value="utf-8" />';
$form .= '<input type="hidden" name="item_name" value="' . $data['product_name'] . '" />';
$form .= '<input type="hidden" value="_xclick" name="cmd"/>';
$form .= '<input type="hidden" name="amount" value="' . $data['amount'] . '" />';
$form .= '</form>';
$form .= '<script>';
$form .= 'setTimeout("document.frm_payment_method.submit()", 0);';
$form .= '</script>';
return $form;
我在“谢谢”页面中收到的值如下;
Array ( [payer_email] => niladrib.banerjee@XXXX [payer_id] => WN6EJUKG27CZ8 [payer_status] => VERIFIED [first_name] => Niladri [last_name] => Banerjee [address_name] => Niladri Banerjee [address_street] => 1 Main St [address_city] => San Jose [address_state] => CA [address_country_code] => US [address_zip] => 95131 [residence_country] => US [txn_id] => XXX [mc_currency] => USD [mc_fee] => 0.46 [mc_gross] => 5.50 [protection_eligibility] => ELIGIBLE [payment_fee] => 0.46 [payment_gross] => 5.50 [payment_status] => Completed [payment_type] => instant [item_name] => Demo Product [quantity] => 1 [txn_type] => web_accept [payment_date] => 2018-11-15T12:02:01Z [business] => niladrib.banerjee-facilitator@XXXXX [receiver_id] => 9K4AYW8P9K555 [notify_version] => UNVERSIONED [verify_sign] => Au.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX )