开发者

What is causing my PayPal IPN script to fail?

开发者 https://www.devze.com 2022-12-18 05:38 出处:网络
I am receiving the following from a PayPal IPN script. Is it evident from the following what is causing the IPN transaction to fail? If not, how can I investigate the problem further?

I am receiving the following from a PayPal IPN script. Is it evident from the following what is causing the IPN transaction to fail? If not, how can I investigate the problem further?

[01/25/2010 7:49 PM] - FAIL: IPN Validation Failed.
IPN $_POST variables from PayPal:
mc_gross=25.00
protection_eligibility=Ineligible
address_status=unconfirmed
payer_id=AEVB83JZKDRCL
tax=0.00
address_street=1 Main Terrace
payment_date=10:49:52 Jan 25, 2010 PST
payment_status=Pending
charset=windows-1252
address_zip=W12 4LQ
first_name=Test
address_country_code=GB
address_name=Test User
notify_version=2.9
custom=
payer_status=unverified
address_country=United Kingdom
address_city=Wolverhampton
quantity=1
verify_sign=A0I1KzEZadt6mIDXxQkkIQCQKPTMAGvCuZ8RKXsOCujIi.RoMxAnbZXi
payer_email=test1_1263505944_per@example.com
txn_id=38A45069EV5838100
payment_type=instant
last_name=User
address_state=West Midlands
receiver_email=martin@example.com
pending_reason=unilateral
txn_type=web_accept
item_name=Ultimate Challenge UK Ressurection  Standard Seating (25.00 GBP)
mc_currency=GBP
item_number=
residence_country=GB
test_ipn=1
handling_amount=0.00
transaction_subject=Ultimate Challenge UK Ressurection  Standard Seating (25.00 GBP)
payment_gross=
shipping=0.00


IPN response from PayPal server:
 HTTP/1.1 200 OK
Date: Mon, 25 Jan 2010 18:49:56 GMT
Server: Apache
Set-Cookie: cwrClyrK4LoCV1fydGbAxiNL6iG=_hMqg4cipUMV6RnPhXQ-05S5HEZk2hx2Yc87bjkBg5dZZLYqHTsxqiYwvU9Hjas5YeKTg9jnkbQYomER3_bjuAIW9f15003nc2FYPzIYqFuCc-Jfz1B8byXHhtrJ6OHyiPlmo0%7cGRbawzJR-iAiebJ1pZJZ3DzypAO4untXvofHa07UaqPHkeOZNQTSoCfMobgODGnxgP6jHW%7cf29zaCIP63s4TuzaT12cEiU-aih_kOHju4cqZ4KPV18bl-LTNlFzFLLGmr_DOhyXznq--m%7c1264445397; domain=.paypal.com; path=/
Set-Cookie: cookie_check=yes; expires=Thu, 23-Jan-2020 18:49:57 GMT; domain=.paypal.com; path=/
Set-Cookie: navcmd=_notify-validate; domain=.paypal.com; path=/
Set-Cookie: navlns=0; expires=Sun, 20-Jan-2030 18:49:57 GMT; domai开发者_运维问答n=.paypal.com; path=/
Vary: Accept-Encoding
Keep-Alive: timeout=5, max=92
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8

7
INVALID
0


Anyone using the PHP Paypal IPN Integration Class by Micah Carrick and having the same problem: The IPN variables and values have to be preceded with cmd=_notify-validate. In the paypal.class.php file it's just the opposite.

So, just replace $post_string = ''; in line 179 by
$post_string="cmd=_notify-validate";
replace
$post_string .= $field.'='.urlencode(stripslashes($value)).'&';

in line 181 by $post_string .= '&' . $field.'='.urlencode(stripslashes($value));

then delete $post_string.="cmd=_notify-validate"; in line 184 and your problem should be solved.


Have you tried the IPN test tool to investigate the problem?

You can use it to reproduce the form you're submitting and see if you get consistent results.

You might get better answers if you specify exactly in which context it is failing.


For connect to sandbox Paypal use this line :

$fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30); 

and not : $fp = fsockopen($url_parsed['host'],"80",$err_num,$err_str,30);

and the response IPN send the word "VERIFIED"

If you're testing Paypal IPN over SSL, you will have to use ssl://www.sandbox.paypal.com on the port 443


@ Dominik , that seems to fix my problems too ! I happened to be using Md Emran Hasan's PHP class. And done tearing my hair out for about a week with this issue!

So my edit looked like this... where $postString .="cmd=_notify-validate"; // used to be after the while loop! This code was wrapped in a validateIPN function.

    $postString .= "cmd=_notify-validate"; // append ipn command

    foreach ($_POST as $field=>$value)
    {
        $this->ipnData["$field"] = $value;
        $postString .= '&' . $field .'=' . urlencode(stripslashes($value));
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消