[Resolvido] erro no IPN paypal
Olá
Estou a tentar usar o Instant Payment Notification (IPN) do Paypal para conseguir que o meu sistema mude o status do pagamento assum que ele for realizado. o problema é que sempre que testo o ipn com a farramenta do paypal renorna INVALID.
o paypal está a enviar através de $_POST os seguintes dados
instantSun Jun 17 2018 02:32:34 GMT+0100PendingconfirmedverifiedJohnSmithbuyer@paypalsandbox.comTESTBUYERID01John SmithUnited StatesUS95131CASan Jose123 any streetseller@paypalsandbox.comseller@paypalsandbox.comseller@paypalsandbox.comUSsomethingAK-123413.042.02USD0.4412.349.34web_accept5190922782.1xyz123abc12341undefined
sendo que pretendo receber a informação através deste código
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
header('Location: index.php');
exit();
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "cmd=_notify-validate&" . http_build_query($_POST));
$response = curl_exec($ch);
curl_close($ch);
file_put_contents('test.txt', $response);
Se alguém souber como ajudar ficaria muito grato.Discussão (3)
Carregando comentários...