我嘗試使用貝寶的沙盒IPN模擬器發送一些測試付款,但仍然IPN日誌說IPN失敗。我試圖進入Profile > Selling Tools > Language Encoding > Changed to UTF-8
仍然沒有用。 IPN日誌說貝寶IPN從貝寶模擬器失敗
[09/11/2014 10:02 PM] - FAIL: IPN Validation Failed.
IPN POST Vars from Paypal:
residence_country=US, invoice=abc1234, address_city=San Jose, first_name=John, payer_id=TESTBUYERID01, shipping=3.04, mc_fee=0.44, txn_id=222972945, [email protected], quantity=1, custom=xyz123, payment_date=04:59:06 11 Sep 2014 PDT, address_country_code=US, address_zip=95131, tax=2.02, item_name=something, address_name=John Smith, last_name=Smith, [email protected], item_number=AK-1234, verify_sign=AFcWxV21C7fd0v3bYYYRCpSSRl31AMzH.1OGLzhiRtwR90w31D5sjl55, address_country=United States, payment_status=Completed, address_status=confirmed, [email protected], [email protected], notify_version=2.1, txn_type=web_accept, test_ipn=1, payer_status=verified, mc_currency=USD, mc_gross=12.34, address_state=CA, mc_gross1=9.34, payment_type=instant, address_street=123, any street,
IPN Response from Paypal Server:
HTTP/1.0 302 Found
Location: https://www.sandbox.paypal.com
Server: BigIP
Connection: close
Content-Length: 0
按照PayPal的文檔,我去過這個鏈接是PayPal的文檔中提到https://gist.github.com/xcommerce-gists/3440401/download#。並嘗試使用相同的代碼,並在PayPal IPN設置和IPN模擬器的通知URL中設置了網址。但仍然沒有工作。不幸的是,上述鏈接中的代碼不會向日志文件添加任何記錄。
我也有另一個代碼,在日誌文件中記錄,但記錄爲失敗。
代碼:
<?php
ob_start();
if($_SESSION == null) {
session_start();
}
error_reporting(0);
require_once('paypal.class.php'); // include the class file
$p = new paypal_class; // initiate an instance of the class
$p->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; // testing paypal url
$this_script = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
if (empty($_GET['action'])) $_GET['action'] = 'process';
switch ($_GET['action']) {
case 'ipn':
if ($p->validate_ipn()) {
$subject = 'Instant Payment Notification - Recieved Payment';
$p->send_report ($subject);
}
else {
$subject = 'Instant Payment Notification - Payment Fail';
$p->send_report ($subject);
}
break;
}
?>
今天就面臨着同樣的問題。解決這個職位:http://stackoverflow.com/questions/11746644/paypal-sandbox-ipn-always-returns-invalid/37630831#37630831 – Naguissa 2016-07-19 08:24:04