Précédent   Forum du club des développeurs et IT Pro > Webmasters - Développement Web > Général Conception Web > E-Commerce
E-Commerce Forum d'entraide sur le commerce électronique sur le Web, et sur les paiements en ligne
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse
 
Outils de la discussion
Publicité
'
Vieux 21/02/2011, 09h16   #1
leoz2007
Invité de passage
 
Inscription : février 2009
Messages : 15
Détails du profil
Informations forums :
Inscription : février 2009
Messages : 15
Points : 0
Points : 0
Par défaut Paypal IPN invalide

Bonjour a tous,
je suis charge de mettre en place un système de payement par Paypal sur le site de notre entreprise.

Actuellement, j'ai créer un bouton sur paypal.com, hoster sur mon serveur, configurer l'ipn, test sandbox.

Je reçois bien les notifications de paypal, le payement sur mon compte est bien valider.
je n'arrive par contre pas a récupérer les valeurs de l'ipn que je souhaiterais pusher dans ma DB.

Je cherche en vain, mais IPN me renvois constamment un résultat INVALID.

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
$req = 'cmd=_notify-validate';

foreach ($_POST as $key => $value) {
  $value = urlencode(stripslashes($value));
  $req .= "&$key=$value";
}

$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";

$fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);
if (!$fp)
  {
    $mail_From = "From: lol@lol.lol";
    $mail_To = $email;
    $mail_Subject = "HTTP PAYPAL ERROR";
    $mail_Body = $errstr;
    mail($mail_To, $mail_Subject, $mail_Body, $mail_From);
  }
 else
   {
     fputs ($fp, $header . $req);
     while (!feof($fp)) {
       $res = fgets ($fp, 1024);

       if ($res == "VERIFIED")
         {
           if (($payment_status == 'Completed') && ($receiver_email == "dev_1297996026_biz@lol.lol") && ($payment_amount == $amount_they_should_have_paid ) && ($payment_currency == "EUR") && (!txn_id_used_before($txn_id)))
             {
               $userid = (empty($_POST['custom'])) ? '42420' : $_POST['custom'];
//REQUETES SQL
             }
           else
             {
               $mail_To = "lol@lol.lol";
               $mail_Subject = "PayPal IPN status not completed or security check fail";
               $mail_Body = "Something wrong. \n\nThe transaction ID number is: $txn_id \n\n Payment status = $payment_status \n\n Payment amount = $payment_amount";
               mail($mail_To, $mail_Subject, $mail_Body);
             }
         }
       else if (strcmp ($res, "INVALID") == 0)
         {
           $res = var_dump($_POST);
           $mail_To = "lol@lol.lol";
           $mail_Subject = "PayPal - Invalid IPN ";
           $mail_Body = "We have had an INVALID response. \n\nThe transaction ID number is: $txn_id \n\n username = $username \n\n res=$req\n\n header=$header";
           mail($mail_To, $mail_Subject, $mail_Body);
         }
     }
    fclose ($fp);
  }
pour infos le header correspond a :
Code :
1
2
cmd=_notify-validate&test_ipn=1&payment_type=instant&payment_date=23%3A10%3A24+Feb+20%2C+2011+PST&payment_status=Completed&address_status=confirmed&payer_status=unverified&first_name=John&last_name=Smith&payer_email=buyer%40paypalsandbox.com&payer_id=TESTBUYERID01&address_name=John+Smith&address_country=France&address_country_code=FR&address_zip=95131&address_state=CA&address_city=San+Jose&address_street=123%2C+any+street&receiver_email=seller%40paypalsandbox.com&receiver_id=TESTSELLERID1&residence_country=FR&item_name1=something&item_number1=AK-1234&quantity1=1&tax=2.02&mc_currency=EUR&mc_fee=0.44&mc_gross_1=9.34&mc_handling=2.06&mc_handling1=1.67&mc_shipping=3.02&mc_shipping1=1.02&txn_type=cart&txn_id=24221710&notify_version=2.4&custom=xyz123&invoice=abc1234&charset=windows-1252&verify_sign=Aupij1oYOKQskMQ5jMuGmlbvJaEGAmLs-P69iqQd.rAuwAJAJJ6Byjpm
Merci a ceux qui m'apporterons une aide précieuse ^^
leoz2007 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 04/06/2012, 13h04   #2
waldo955
Invité de passage
 
Inscription : octobre 2010
Messages : 2
Détails du profil
Informations forums :
Inscription : octobre 2010
Messages : 2
Points : 2
Points : 2
Peut-être un peu tard, mais pourra servir aux autres.

J'ai eu le même prob, et c'était mon adresse de retour qui était mal adressée.

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

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

J'espère que ce sera utile à qqu.
waldo955 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse
Outils de la discussion

Navigation rapide


Fuseau horaire GMT +2. Il est actuellement 14h55.


 
 
 
 
Partenaires

Hébergement Web