IPN php 代码无法验证,PayPal 错误代码为 301 或 302

问题描述 投票:0回答:1

我的 ipn 代码无法通过 PayPal 验证,并在我的 ipn_log 中产生此错误

[02/16/2024 10:04 AM] - FAIL: IPN Validation Failed.
IPN POST Vars from Paypal:
mc_gross=1.00, protection_eligibility=Eligible, address_status=confirmed, payer_id=3JW778WTCRMQJ, address_street=405 New Forest Road, payment_date=08:04:01 Feb 16, 2024 PST, payment_status=Completed, charset=windows-1252, address_zip=30582, first_name=Jim, mc_fee=0.52, address_country_code=US, address_name=James Balthrop, notify_version=3.9, custom=, payer_status=verified, [email protected], address_country=United States, address_city=Young Harris, quantity=1, verify_sign=AnUKh3Y83axkW7EKdCObcSoPPtWcAkQiuRQSI7X3OytYGQZAawP3v41H, [email protected], txn_id=00V709787S381571V, payment_type=instant, payer_business_name=myname, last_name=Balthrop, address_state=GA, [email protected], payment_fee=0.52, shipping_discount=0.00, insurance_amount=0.00, receiver_id=YKEYPFN3L9B94, txn_type=web_accept, item_name=Ryan Balthrop Debut CD, discount=0.00, mc_currency=USD, item_number=Debut CD, residence_country=US, shipping_method=Default, transaction_subject=, payment_gross=1.00, shipping=0.50, ipn_track_id=f293126421309, 
IPN Response from Paypal Server:
 HTTP/1.1 302 Moved Temporarily
Content-Type: text/html
Content-Length: 161
Connection: close
Location: https://ipnpb.paypal.com/cgi-bin/webscr

    <html>
    <head><title>302 Found</title></head>
    <body bgcolor="white">
    <center><h1>302 Found</h1></center>
    <hr><center>Avi Vantage/</center>
    </body>
    </html>
 
php paypal-ipn
1个回答
0
投票

我的 ipn 代码产生上述错误。
如果我使用 url-https://paypal.com/cgi-bin/webscr 它会产生 301 错误。
如果我使用 url-https://ipnpb.paypal.com/cgi-bin/webscr 它会产生 302 错误。

<?php
date_default_timezone_set('America/Chicago');
?><?php require_once('Connections/connsqli.php'); ?>
<?php require_once('webassist/mysqli/queryobj.php'); ?>
<?php
 require "paypal_integration_class/paypal.class.php";
require "config.php";
$p = new paypal_class;
$p->paypal_url = $payPalURL;

if ($p->validate_ipn()) {
if($p->ipn_data["payment_status"]=="Completed")
{
    $amount = $p->ipn_data["mc_gross"] - $p-        >ipn_data["mc_fee"];
        ?>
<?php
if (true) {
$InsertQuery = new WA_MySQLi_Query($connsqli);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "paypal_transactions";
$InsertQuery->bindColumn("transaction_ID", "i", "txn_id",     "WA_DEFAULT");
$InsertQuery->bindColumn("first_name", "s", "first_name",     "WA_DEFAULT");
$InsertQuery->bindColumn("last_name", "s", "last_name",     "WA_DEFAULT");
$InsertQuery->bindColumn("payer_email", "s", "payer_email",     "WA_DEFAULT");
$InsertQuery->bindColumn("address_street", "s",     "address_street", "WA_DEFAULT");
$InsertQuery->bindColumn("address_city", "s",     "address_city", "WA_DEFAULT");
$InsertQuery->bindColumn("address_state", "s",     "address_state", "WA_DEFAULT");
$InsertQuery->bindColumn("address_zip", "s", "address_zip",     "WA_DEFAULT");
$InsertQuery->bindColumn("item_name", "s", "item_name",     "WA_DEFAULT");
$InsertQuery->bindColumn("quantity", "s", "quantity",     "WA_DEFAULT");
$InsertQuery->bindColumn("mc_gross", "s", "mc_gross",     "WA_DEFAULT");
$InsertQuery->bindColumn("shipping", "s", "shipping",     "WA_DEFAULT");
$InsertQuery->bindColumn("mc_fee", "s", "mc_fee",     "WA_DEFAULT");
$InsertQuery->saveInSession("");
$InsertQuery->execute();
$InsertGoTo = "";
if (function_exists("rel2abs")) $InsertGoTo = $InsertGoTo?    rel2abs($InsertGoTo,dirname(__FILE__)):"";
$InsertQuery->redirect($InsertGoTo);
}
?>
<?php
}
}
?>
© www.soinside.com 2019 - 2024. All rights reserved.