Bonjour tout le monde,
Je suis occupé à intégrer à un site un moyen de paiement via Paypal.
J'ai lu pas mal d'informations sur la mise en place.
J'ai donc le bouton dont voici le code :
Ma question est au niveau notify, je n'arrive pas à afficher à l'écran les variables $_POST :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> <select name="amount"> <option value=''>Choose your category</option> <option value='400'>I'm a student</option> <option value='500'>I'm NOT a student</option> </select> <input name="currency_code" type="hidden" value="EUR" /> <input name="shipping" type="hidden" value="0" /> <input name="tax" type="hidden" value="0.00" /> <input name="return" type="hidden" value="http://164.15.112.38/congres/paypal_ok.php" /> <input name="cancel_return" type="hidden" value="http://164.15.112.38/congres/paypal_ok.php" /> <input name="notify_url" type="hidden" value="http://164.15.112.38/congres/Fonctions/notify.php" /> <input name="cmd" type="hidden" value="_xclick" /> <input name="business" type="hidden" value="moncompte" /> <input name="item_name" type="hidden" value="Peroxidase Meeting 2011" /> <input name="no_note" type="hidden" value="1" /> <input name="lc" type="hidden" value="EN" /> <input name="bn" type="hidden" value="PP-BuyNowBF" /> <input name="custom" type="hidden" value="ID_ACHETEUR" /> <input alt="Effectuez vos paiements via PayPal : une solution rapide, gratuite et sécurisée" name="submit" src="https://www.paypal.com/fr_FR/FR/i/btn/btn_buynow_LG.gif" type="image" /><img src="https://www.paypal.com/fr_FR/i/scr/pixel.gif" border="0" alt="" width="1" height="1" /> </form>
Merci d'avance pour votre aide.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
54
55
56
57
58
59
60
61
62 <?php // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-validate'; foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } // post back to PayPal system to validate $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"; //If testing on Sandbox use: //$fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30); $fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30); if (!$fp) { // HTTP ERROR } else { fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024); if (strcmp ($res, "VERIFIED") == 0) { // check the payment_status is Completed // check that txn_id has not been previously processed // check that receiver_email is your Primary PayPal email // check that payment_amount/payment_currency are correct // process payment // echo the response echo "The response from IPN was: <b>" .$res ."</b><br><br>"; //loop through the $_POST array and print all vars to the screen. foreach($_POST as $key => $value){ echo $key." = ". $value."<br>"; } } else if (strcmp ($res, "INVALID") == 0) { // log for manual investigation // echo the response echo "The response from IPN was: <b>" .$res ."</b>"; } } fclose ($fp); } ?>
beegees
Partager