Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it
    Registrato dal
    May 2002
    Messaggi
    310

    [PAYPAL - IPN] - Verifica prezzo

    Ciao a tutti,
    sto utilizzando il seguente file IPN per la verifica della transazione Paypal, ma ho un dubbio

    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
    }
    
    ?>
    Form invio:

    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?

  2. #2
    Utente di HTML.it
    Registrato dal
    Oct 2009
    Messaggi
    292
    Ciao,
    Sono un Po arrugginito su paypal, ma se non ricordo male il check verified serve per assicurarsi che la richiesta arrivi da paypal! Quindi giustamente prima verifichi la sorgente e poi ti assicuri che la transazione sia corretta (prezzo compreso)

  3. #3
    Ciao anche io non ho capito questa cosa... se crei pulsanti criptati sattici il problema non si pone, ma se devi crearli dinamicamente il problema resta. Il verified da risultato a transizione avvenuta se non mi sbaglio e non ci sono controlli prima.
    Robyd come hai risolto?

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.