[SOLVED] Paypal intergration seems to be working but [SOLVED]

Sorry if this is in the wrong section delete if not correct.

im trying to intergrate paypal into a script im writing but i seem to have an odd problem.

everything seems to work as in it goes to paypal, you can pay, i seem to be getting a response from paypal on the listener because its adding the transaction to the database and its saying the transaction is completed. but it takes me back to the success page but says “your payment has failed”

From looking at it it looks like it isnt getting the $_GET information to complete correctly.

Any help would be greatly appreciated and if you need any other info please dont hesitate to ask.

Thank you


Which API are you using so I know I am looking at the correct documentation? What is the code you are using for the callback?

1 Like

POST all PayPal response data objects as well (minus any secure data, CC#, CVV…etc)


The code im using now is the code from here.

And now it seems to have stopped inserting the data into the database the code i use for inserting into database is :

    // Check connection
if($con === false){
    die("ERROR: Could not connect. " . mysqli_connect_error());
$sql = "SELECT * FROM payments WHERE txn_id = '".$txn_id."'";
    $result = mysqli_query($con,$sql);
        $sql = "INSERT INTO payments (item_number, txn_id, payment_gross, currency_code, payment_status)
VALUES ('$item_number', '$txn_id', '$payment_amount', '$payment_currency', '$payment_status')";
if ($con->query($sql) === TRUE) {    	
} else {
    echo "Error: " . $sql . "<br>" . $con->error;
    echo "Error: " . $sql . "<br>" . $con->error;

And the ipn.log is giving me this information

[2020-01-16 22:38 UTC] HTTP request of validation request:POST /cgi-bin/webscr HTTP/1.1
Host: www.sandbox.paypal.com
Accept: /
Connection: Close
Content-Length: 871
Content-Type: application/x-www-form-urlencoded

for IPN payload: cmd=_notify-validate&mc_gross=1.99&protection_eligibility=Eligible&payer_id=6Q27739SU9NY4&payment_date=14%3A38%3A36+Jan+16%2C+2020+PST&payment_status=Completed&charset=windows-1252&first_name=John&mc_fee=0.27&notify_version=3.9&custom=&payer_status=verified&business=sb-ahc28888156%40business.example.com&quantity=1&verify_sign=AxwQlCNrr.wyis5gcX3IE2GAz3GJA6CXLuMg4eM85GHe0aFriH8MEOJb&payer_email=sb-kodn5886846%40personal.example.com&txn_id=4CD66969A4673693H&payment_type=instant&last_name=Doe&receiver_email=sb-ahc28888156%40business.example.com&payment_fee=&shipping_discount=0.00&receiver_id=JUG4RGR57XDCU&insurance_amount=0.00&txn_type=web_accept&item_name=cucumber&discount=0.00&mc_currency=GBP&item_number=vrcZ2yjxPUQK0opVDgaq&residence_country=GB&test_ipn=1&shipping_method=Default&transaction_subject=&payment_gross=&ipn_track_id=5396627aaa528
[2020-01-16 22:38 UTC] HTTP response of validation request: HTTP/1.1 200 OK
Cache-Control: max-age=0, no-cache, no-store, must-revalidate
Content-Type: text/html; charset=UTF-8
Date: Thu, 16 Jan 2020 22:38:52 GMT
Paypal-Debug-Id: fe436ca94b31f
Set-Cookie: c9MWDuvPtT9GIMyPc3jwol1VSlO=dXoZCo3D5TrrCsKdTNMrW6XD5OSeAKL4eoBtAcSWW2u6nJhjVP92STrwdqvwzs-dYGRNGGtM-QF1Hqbb4P6qKjYDheDyofxFFzobhTCRQpLdwnUSs8gbG_O7ndQJfvDgt6jOMze3EtVthwr-gHiYmyDb4bs4PlYdo8kY2FXnAoG026SVEKvIMzAcvuXs6MRKKFEy1kN6rmdrcEx6NKnHPrpCA2BcWfhBFvb5Pg4HtMJjhNwpqlG9XIJTAa1uA1J6jksj0QRCsX3hqQ-WvmDvkYzmWy4OHIOi1oReDVVIlvMOW7ZJrjnKugEnfpMobtcMYYRdrcSut94ON3owFzf6-LnjrwI9XpaaXEUZBFxTiDfFLF-Cqji6TFHsE_EjnBWcBR9KUKvK7OYZ9-bz9_RoD-hyuwUQYXvAgziW3dF9d6j7b–u13YwtLKrS2W; Path=/; Domain=paypal.com; HttpOnly; Secure
Set-Cookie: cookie_check=yes; Path=/; Domain=paypal.com; Expires=Sun, 13 Jan 2030 22:38:53 GMT; HttpOnly; Secure
Set-Cookie: navcmd=_notify-validate; Path=/; Domain=paypal.com; HttpOnly; Secure
Set-Cookie: navlns=0.0; Path=/; Domain=paypal.com; Expires=Sat, 15 Jan 2022 22:38:53 GMT; HttpOnly; Secure
Set-Cookie: Apache=; Path=/
Set-Cookie: X-PP-SILOVER=name%3DSANDBOX3.WEB.1%26silo_version%3D880%26app%3Dappdispatcher%26TIME%3D1579214333%26HTTP_X_PP_AZ_LOCATOR%3Dsandbox.slc; Path=/; Domain=paypal.com; Expires=Thu, 16 Jan 2020 23:08:53 GMT; HttpOnly; Secure
Set-Cookie: X-PP-L7=1; Path=/; Domain=paypal.com; Secure
Vary: Accept-Encoding,User-Agent
X-Frame-Options: SAMEORIGIN
Content-Length: 8
Connection: close
Strict-Transport-Security: max-age=63072000


**Im not sure if theres anything else you need thank you in advance


HI again

I have done an ipn simulator on hte paypal site done it as an express check out and the reply was.

IPN was sent and the handshake was verified.

thank you


Hi all

Thank you to everyone who helped this problem is now solved.

i was trying to check a field in the database before it was put in there so was always going to be false lol


Glad you got it worked out. I hadn’t had a chance to say, that this is just a bad way to do things. An Update would have been what you wanted for this section anyway, and if it didn’t have a row to update, it wouldn’t have. The other option would be to do an Upsert: insert if it isn’t there, update if it is.

Sponsor our Newsletter | Privacy Policy | Terms of Service