私はカスタムデジタル電子商取引のIPNを作成していますが、問題があります。 すべてが動作し、私のIDは私がPIDと呼んでいる "保留中の支払い"支払いID)を入力すると、ユーザーはPaypalページに行き、支払いが完了したらPayPalは支払いが完了したかどうかをチェックし、ユーザーが購入したすべてのメディアを有効にするIPNリスナーに私に連絡します。PHP Paypal IPN:取引が確認されていません
は、私は正常ミカキャリックのPHPのクラス (http://www.micahcarrick.com/php-paypal-ipn-integration-class.html)を使用して、IPNを作成し、すべてが私はいつもpendign支払い状況を取得exept働いていると私は確認したものを得ることができません。
私は現在paypalサンドボックスでテストしています。私は2人のバイヤーと1人の売り手を作成しました。私は皆のために「支払いのレビュー」を有効にしました。
私も別のアプローチを試しましたが、私はいつも同じ結果を得ています。
コード: ますfile_put_contents( 'ipn.log'、 "\ n>はIPNの\ n" は、FILE_APPEND)。
//Check the Payment ID,i pass it to the IPN by GET
if(!isset($_GET['pid'])|| !is_numeric($_GET['pid'])){
file_put_contents('ipn.log',"\n!!!IPN:INVALID PID(".$_GET['pid'].")!!!\n",FILE_APPEND);
exit('PID INVALIDO!');
}
//Logging errors
ini_set('log_errors', true);
ini_set('error_log', dirname(__FILE__).'/ipn_errors.log');
// instantiate the IpnListener class
require('ipnlistener.php');
$listener = new IpnListener();
//Use the sandbox instead of going "live"
$listener->use_sandbox = true;
//validate the request
try {
$listener->requirePostMethod();
$verified = $listener->processIpn();
}
catch (Exception $e) {
error_log($e->getMessage());
exit(0);
}
//Just for debug
file_put_contents('ipn.log',"\n###IPN:verifying...###\n",FILE_APPEND);
if($verified){//the payment is verified
file_put_contents('ipn.log',"\n###IPN:transaction verified(confirmed=".$_POST['payment_status'].")###\n".$listener->getTextReport(),FILE_APPEND);
/*
Once you have a verified IPN you need to do a few more checks on the POST
fields--typically against data you stored in your database during when the
end user made a purchase (such as in the "success" page on a web payments
standard button). The fields PayPal recommends checking are:
1. Check the $_POST['payment_status'] is "Completed"
2. Check that $_POST['txn_id'] has not been previously processed
3. Check that $_POST['receiver_email'] is your Primary PayPal email
4. Check that $_POST['payment_amount'] and $_POST['payment_currency']
are correct
Since implementations on this varies, I will leave these checks out of this
example and just send an email using the getTextReport() method to get all
of the details about the IPN.
*/
if($_POST['payment_status']=="Completed"){
//--check if the price is right and enable the user media--
confirm_payment($_GET['pid'],$_POST['payment_amount']);
file_put_contents('ipn.log',"\n###IPN:Transaction completed###\n".$listener->getTextReport(),FILE_APPEND);
}
}
else {
/*
An Invalid IPN *may* be caused by a fraudulent transaction attempt. It's
a good idea to have a developer or sys admin manually investigate any
invalid IPN.
*/
file_put_contents('ipn.log',"\n###IPN:ERROR###\n".$listener->getTextReport(),FILE_APPEND);
}
私が作成したデバッグログ>は、この
のように常にIPNが正しく呼び出されたことを述べて--it IPN <ある
## IPN:検証... ## # < - IPNが取引を確認しています
## IPN:取引が確認済み(確認済み=保留中) < - 取引はベリですそれは保留中だから確認されていない、私はダウンロードを有効にすることはできません!
あなたは正しかった、私はその反対を述べたガイドに従った。とにかく「バイヤー」アカウントを作成し、それを宛先(dev.paypalの電子メールではない)として使用する必要があることを明記していない場合は、 また、価格で支払われる$ _POST ['mc_gross'] NOT $ _POST ['payment_amount']はコメントの中で述べたとおりです。 – Plokko