Ciao a tutti,
sto utilizzando il seguente file IPN per la verifica della transazione Paypal, ma ho un dubbio
Form invio:codice:<?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"; } // for live mode $url="https://www.paypal.com/cgi-bin/webscr"; // for developement mode $url="https://www.sandbox.paypal.com/cgi-bin/webscr"; // instead of use of fopen you can use $res=file_get_contents($url"?".$req); // compare response if (strcmp (trim($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 } else if (strcmp (trim($res), "INVALID") == 0) { // log for manual investigation } ?>
codice:<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="business" value="seller@designerfotos.com"> <input type="hidden" name="item_name" value="hat"> <input type="hidden" name="item_number" value="123"> <input type="hidden" name="amount" value="15.00"> <input type="hidden" name="first_name" value="John"> <input type="hidden" name="last_name" value="Doe"> <input type="hidden" name="address1" value="9 Elm Street"> <input type="hidden" name="address2" value="Apt 5"> <input type="hidden" name="city" value="Berwyn"> <input type="hidden" name="state" value="PA"> <input type="hidden" name="zip" value="19312"> <input type="hidden" name="night_phone_a" value="610"> <input type="hidden" name="night_phone_b" value="555"> <input type="hidden" name="night_phone_c" value="1234"> <input type="hidden" name="email" value="jdoe@zyzzyu.com"> <input type="image" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online"> </form>
Immaginiamo che l'utente si collega al sito e sta per completare il pagamento inviando questo form.
Prima del submit della pagina apre con firebug e modifica l'importo nel campo "amount", invia il form, paypal richiama il mio suddetto IPN passando tutte le info ricevute con un importo sicuramente diverso da quello che mi aspetto...
A questo punto immagino che la transazione (e quindi il pagamento) si conclude con "$res=file_get_contents($url"?".$req);", che senso ha quindi fare i controlli di validità dei campi solo dopo il VERIFIED??
Tutti gli esempi che trovo in rete sono come questo.
Mi sfugge qualcosa?

Rispondi quotando