paypal / ipn-code-samples

Other
562 stars 486 forks source link

Missing POST Data #124

Closed juanmasantos closed 6 years ago

juanmasantos commented 6 years ago

General information

Issue description

Hello everyone!

I'm having a real problem with the Paypal system, it doesn't work to me, just that. I think I have followed all the steps at perfection but... I'm about to throw in the towle. I know there are many issues open but none work for me, I explain myself.

I've got the first file I have called zzz.php (listener)

<?php namespace Listener;

require('PaypalIPN.php');

use PaypalIPN;

$ipn = new PaypalIPN();

// Use the sandbox endpoint during testing.
$ipn->useSandbox();
$verified = $ipn->verifyIPN();
if ($verified) {
    $response = "verified";
    file_put_contents("test.txt", $response);
    /*
     * Process IPN
     * A list of variables is available here:
     * https://developer.paypal.com/webapps/developer/docs/classic/ipn/integration-guide/IPNandPDTVariables/
     */
} else {
    $response = "negativo2";
    file_put_contents("test.txt", $response);
}

// Reply with an empty 200 response to indicate to paypal the IPN was received correctly.
header("HTTP/1.1 200 OK");
?>

PaypalIPN.php which we all know. The error log of my server throws

[25-Feb-2018 16:46:49 UTC] PHP Fatal error:  Uncaught exception 'Exception' with message 'Missing POST Data' in /home2/laplatas/public_html/php/PaypalIPN.php:72
Stack trace:
#0 /home2/laplatas/public_html/php/zzz.php(11): PaypalIPN->verifyIPN()
#1 {main}
  thrown in /home2/laplatas/public_html/php/PaypalIPN.php on line 72
[25-Feb-2018 16:47:44 UTC] PHP Fatal error:  Uncaught exception 'Exception' with message 'Missing POST Data' in /home2/laplatas/public_html/php/PaypalIPN.php:72
Stack trace:
#0 /home2/laplatas/public_html/php/zzz.php(11): PaypalIPN->verifyIPN()
#1 {main}
  thrown in /home2/laplatas/public_html/php/PaypalIPN.php on line 72

The adress of IPN is:

https://www.laplata.surf/php/zzz.php (the first file I added to this post)

The button is sending the notify_url to:

https://www.laplata.surf/php/zzz.php (same first file)

The button is sending the user to:

https://www.laplata.surf/php/booking_correct.php (The thanks page)

What am I doing wrong?

overint commented 6 years ago

Are you sure PayPal is sending the IPN post back to the correct file? Have you tested with the sandbox?

overint commented 6 years ago

The Missing POST Data is only thrown when there is nothing at all in the $_POST superglobal. This means if you are sending the IPN to the correct URL you probably have a server misconfiguration somewhere.

juanmasantos commented 6 years ago

Hi overint, finally it was a completely mess from paypal, somehow they where making an update and it was a server problem. Everything fixed already

overint commented 6 years ago

Ok, no worries. Will close the ticket.