Note that there are some explanatory texts on larger screens.

plurals
  1. POCode Igniter Paypal IPN :: Failed Validation due to %0A
    primarykey
    data
    text
    <p>I have found out that the reason my live IPN callback is failing is due to the secondary custom address line being placed on a new line thanks to the character %0A.</p> <p>Now I found a forum post about this saying to use preg_replace() after the urlencode() to fix it.</p> <p>Whilst my logs no longer show the second part of the address on a new line, I am still getting Failed responses.</p> <p>Sandbox IPN test works 100% fine btw!</p> <p>Here is my recent failed response:</p> <pre><code>[04/06/2011 9:50 PM] - FAIL: IPN Validation Failed. IPN POST Vars from Paypal: mc_gross=0.01, protection_eligibility=Partially+Eligible+-+INR+Only, address_status=unconfirmed, payer_id=9K77MVZTDM594, tax=0.00, address_street=XXX+XXXXXX+XXXX%0D%0AXXXXXXXXX, payment_date=14%3A49%3A54+Apr+06%2C+2011+PDT, payment_status=Completed, charset=windows-1252, address_zip=XXX+XXX, first_name=XXXX, mc_fee=0.01, address_country_code=GB, address_name=XXXX+XXXXXXX, notify_version=3.1, custom=1234567890, payer_status=verified, business=XXXX%40XXXXXXXXXX.org.uk, address_country=United+Kingdom, address_city=XXXXXXXXX, quantity=1, verify_sign=ApKghSivOFtm6Gk7Iqy6QZvljWTIAYIpfc-Ew7d1VnZBDsFqcj5EugKu, payer_email=XXXXXXXX%40gmail.com, txn_id=4P917406R68516736, payment_type=instant, last_name=XXXXXXX, address_state=XXXXXXXXXX, receiver_email=XXXX%40XXXXXXXXXX.org.uk, payment_fee=, receiver_id=V4BXQHT3VGZNA, txn_type=web_accept, item_name=Property+Name+Here, mc_currency=GBP, item_number=1234, residence_country=GB, handling_amount=0.00, transaction_subject=1234567890, payment_gross=, shipping=0.00, IPN Response from Paypal Server: HTTP/1.1 200 OK Date: Wed, 06 Apr 2011 21:50:05 GMT Server: Apache Set-Cookie: c9MWDuvPtT9GIMyPc3jwol1VSlO=JxDUosn1BGy-BGZ8_loF9qdJB8p0zaq4ygql2vv-wr6gZhUyoUobb_raRpEtxg2Lt2_AIAFJO0HTQnbcKkUfv4baA1xeGgPSvAIPqRmviBEpCrtoMjQpxXdVXiOau5FloCtrn0%7cg-VIk7zlxsbY7FvV2g4tHq21VEFKmgQkvHlx7GybNRPg0IZ7rqEa0EjIj1J80sJxIxtqVm%7c_M2zQAKDYSInX-d1c_mggK-Q3a9OM9NjrmWB77K3EL2gTV6y1NwnlSiFczF6HT64jNSV8G%7c1302126606; domain=.paypal.com; path=/; Secure; HttpOnly Set-Cookie: cookie_check=yes; expires=Sat, 03-Apr-2021 21:50:06 GMT; domain=.paypal.com; path=/; Secure; HttpOnly Set-Cookie: navcmd=_notify-validate; domain=.paypal.com; path=/; Secure; HttpOnly Set-Cookie: navlns=0.0; expires=Tue, 01-Apr-2031 21:50:06 GMT; domain=.paypal.com; path=/; Secure; HttpOnly Set-Cookie: Apache=10.191.196.11.50971302126605524; path=/; expires=Tue, 21-Feb-05 15:21:49 GMT Connection: close Transfer-Encoding: chunked Content-Type: text/html; charset=UTF-8 7 INVALID 0 </code></pre> <p>(X's simply replace sensitive information)</p> <p>Notice how @'s now show as %04?</p> <p>Why would a Sandbox IPN work, and not this one? (maybe because sandbox doesn't have that secondary address line at all?)</p> <p>This is my updated code with the preg_replace()</p> <pre><code>$value = str_replace("\n", "\r\n", $value); $value = urlencode(stripslashes($value)); $value = preg_replace('/(.*[^%^0^D])(%0A)(.*)/i','${1}%0D%0A${3}',$value);// IPN fix $this-&gt;ipn_data[$field] = $value; $post_string .= $field.'='.$value.'&amp;'; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload