未提出要求
请求:CMD = _notify-验证&安培; mc_gross = 2.00安培; protection_eligibility =合格&安培; address_status =确认&安培; payer_id = LDYM496TZ5PMS&安培;税务= 0.00&安培; address_street = 7 Malcom Ave Quarrington Hill& payment_date = 10:56:23 Jul 10,2014 PDT&安培; PAYMENT_STATUS =完成&安培;字符集=窗口1252&安培; address_zip = DH6 4QT&安培;如first_name =假&安培; mc_fee = 0.38&安培; address_country_code = GB&安培; ADDRESS_NAME =假 假&放大器; notify_version = 3.8安培;自定义= 168安培; payer_status =未经验证和放大器; business=fake@gmail.com& = ADDRESS_COUNTRY美国 英国及安培; ADDRESS_CITY =达勒姆&安培;数量= 0&安培; verify_sign = AO3SqMqkkL6g6znCfk.bTx0YGc9QAAC62A.uYD2AR27aMUKA8tjOenQg&安培; payer_email=fake@gmail.com& txn_id = 0V51470288084925M&安培; payment_type =即时&安培;姓氏=假&安培; ADDRESS_STATE =安培; receiver_email=fake@gmail.com& payment_fee = 0.38&安培; receiver_id = 43PTLVVM58JD4&安培; txn_type = web_accept&安培; ITEM_NAME = Hyubusa&安培; mc_currency = USD&安培; ITEM_NUMBER =安培; residence_country = GB&安培; transaction_subject = 168&安培; payment_gross = 2.00安培; ipn_track_id = 8f6ab718d71f2
POST失败
mc_gross = 2.00安培; protection_eligibility =合格&安培; address_status =确认&安培; payer_id = LDYM496TZ5PMS&安培;税务= 0.00&安培; address_street = 7 +马尔科姆+大道%0D%0AQuarrington +山及; PAYMENT_DATE = 10%3A56%3A23 +月+ 10 %2C + 2014 + PDT&安培; PAYMENT_STATUS =完成&安培;字符集=窗口1252&安培; address_zip = DH6 + 4QT&安培;如first_name =假&安培; mc_fee = 0.38&安培; address_country_code = GB&安培; ADDRESS_NAME =假+假&安培; notify_version = 3.8&安培;定制= 168&安培; payer_status =未经验证和放大器;经营=假%40gmail.com和放大器; ADDRESS_COUNTRY =美国+英国和放大器; ADDRESS_CITY =达勒姆和放大器;数量= 0&安培; verify_sign = AO3SqMqkkL6g6znCfk.bTx0YGc9QAAC62A.uYD2AR27aMUKA8tjOenQg和放大器; PAYER_EMAIL =假%40gmail.com和放大器; txn_id = 0V51470288084925M和放大器; payment_type =即时与放大器;姓氏=假&安培; ADDRESS_STATE =安培; RECEIVER_EMAIL = adamhyubusa%40gmail.com&安培; payment_fee = 0.38&安培; receiver_id = 43PTLVVM58JD4&安培; txn_type = web_accept&安培; ITEM_NAME = Hyubusa&安培; mc_currency = USD&安培; ITEM_NUMBER =安培; residence_country = GB&安培; transaction_subject = 168&安培; paym ent_gross = 2.00安培; ipn_track_id = 8f6ab718d71f2
所以,我的PayPal IPN正在返回INVALID响应有时候! ...当我在沙箱上测试时,它工作正常。当我使用自己的CC进行测试时,它可以正常工作。
有时候,当我收到捐款时,钱就来了......但是IPN的回复是无效的。
我在美国......目前失败的特定捐赠者来自英国......我不知道这是否有任何相关性。这是我的代码。
$request = "cmd=_notify-validate";
foreach ($_POST as $varname => $varvalue){
$email .= "$varnamefake: $varvalue\n";
if(function_exists('get_magic_quotes_gpc') and get_magic_quotes_gpc()){
$varvalue = urlencode(stripslashes($varvalue));
}
else {
$value = urlencode($value);
}
$request .= "&$varname=$varvalue";
}
$ch = curl_init();
//curl_setopt($ch,CURLOPT_URL,"https://www.sandbox.paypal.com/cgi-bin/webscr");
curl_setopt($ch,CURLOPT_URL,"https://www.paypal.com/cgi-bin/webscr");
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch,CURLOPT_POSTFIELDS,$request);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,false);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
$result = curl_exec($ch);
curl_close($ch);
switch($result){
case "VERIFIED":
$message = "good: $".$_POST['mc_gross']." | ".$_POST['custom'];
$amt = str_replace("$", "", $_POST['mc_gross']);
$data = array(
'STATUS' => 1,
'AMOUNT' => $amt
);
$this->db->where('ID', $_POST['custom']);
$this->db->update('donations', $data);
case "INVALID":
$message ="bad";
mail("fakeemail@fake.com","paypal response", $message);
break;
default:
$message ="other";
mail("fakeemail@fake.com","paypal response", $message);
}
未提出要求
请求:CMD = _notify-验证&安培; mc_gross = 2.00安培; protection_eligibility =合格&安培; address_status =确认&安培; payer_id = LDYM496TZ5PMS&安培;税务= 0.00&安培; address_street = 7 Malcom Ave Quarrington Hill& payment_date = 10:56:23 Jul 10,2014 PDT&安培; PAYMENT_STATUS =完成&安培;字符集=窗口1252&安培; address_zip = DH6 4QT&安培;如first_name =假&安培; mc_fee = 0.38&安培; address_country_code = GB&安培; ADDRESS_NAME =布伦丹 假&放大器; notify_version = 3.8安培;自定义= 168安培; payer_status =未经验证和放大器; business=fake@gmail.com& = ADDRESS_COUNTRY美国 英国及安培; ADDRESS_CITY =达勒姆&安培;数量= 0&安培; verify_sign = AO3SqMqkkL6g6znCfk.bTx0YGc9QAAC62A.uYD2AR27aMUKA8tjOenQg&安培; payer_email=fake@gmail.com& txn_id = 0V51470288084925M&安培; payment_type =即时&安培;姓氏=沃森&安培; ADDRESS_STATE =安培; receiver_email=fake@gmail.com& payment_fee = 0.38&安培; receiver_id = 43PTLVVM58JD4&安培; txn_type = web_accept&安培; ITEM_NAME = Hyubusa&安培; mc_currency = USD&安培; ITEM_NUMBER =安培; residence_country = GB&安培; transaction_subject = 168&安培; payment_gross = 2.00安培; ipn_track_id = 8f6ab718d71f2
POST失败
mc_gross = 2.00安培; protection_eligibility =合格&安培; address_status =确认&安培; payer_id = LDYM496TZ5PMS&安培;税务= 0.00&安培; address_street = 7 +马尔科姆+大道%0D%0AQuarrington +山及; PAYMENT_DATE = 10%3A56%3A23 +月+ 10 %2C + 2014 + PDT&安培; PAYMENT_STATUS =完成&安培;字符集=窗口1252&安培; address_zip = DH6 + 4QT&安培;如first_name =假&安培; mc_fee = 0.38&安培; address_country_code = GB&安培; ADDRESS_NAME =假+假&安培; notify_version = 3.8&安培;定制= 168&安培; payer_status =未经验证和放大器;经营=假%40gmail.com和放大器; ADDRESS_COUNTRY =美国+英国和放大器; ADDRESS_CITY =达勒姆和放大器;数量= 0&安培; verify_sign = AO3SqMqkkL6g6znCfk.bTx0YGc9QAAC62A.uYD2AR27aMUKA8tjOenQg和放大器; PAYER_EMAIL =假%40gmail.com和放大器; txn_id = 0V51470288084925M和放大器; payment_type =即时与放大器;姓氏=沃森&安培; ADDRESS_STATE =安培; RECEIVER_EMAIL = adamhyubusa%40gmail.com&安培; payment_fee = 0.38&安培; receiver_id = 43PTLVVM58JD4&安培; txn_type = web_accept&安培; ITEM_NAME = Hyubusa&安培; mc_currency = USD&安培; ITEM_NUMBER =安培; residence_country = GB&安培; transaction_subject = 168&安培; PA yment_gross = 2.00安培; ipn_track_id = 8f6ab718d71f2
答案 0 :(得分:1)
if(function_exists('get_magic_quotes_gpc') and get_magic_quotes_gpc()){
$varvalue = urlencode(stripslashes($varvalue));
}
else {
$value = urlencode($value);
}
IPN变量已经进行了网址编码,没有再次对它们进行编码以便将其发送回PayPal - 可能是某些交易有效而其他交易无法解决的原因。