Visualizzazione dei risultati da 1 a 5 su 5

Discussione: ipn paypal e variabili

  1. #1

    ipn paypal e variabili

    Salve. Sto sviluppando un metodo di pagamento paypal su un sito, ma ho riscontrato alcuni problemi.
    Per ora però mi concentro sul principale, poi nel caso chiederò in seguito.

    Il pagamento viene effettuato correttamente ma al ritorno sulla pagina ipn.php le variabili post mi appaiono tutte vuote.

    N.B. lavoro su sandbox e ho creato sia l'account business (con ipn attivato) che quell privato per l'acquisto.

    questo è il form che va a paypal
    Codice PHP:
    <form action="https://www.sandbox.paypal.com/it/cgi-bin/webscr" method="post">
    <
    input type="hidden" name="cmd" value="_xclick">
    <
    input type="hidden" name="business" value="mioaccount@miosito.it">
    <
    input type='hidden' name='test_ipn' value='1'>
    <
    input type='hidden' name='notify_url' value='http://www.miosito.it/ipn/ipn.php'>
    <
    input type="hidden" name="return" value="http://www.miosito.it/ipn/ipn.php">
    <
    input type="hidden" name="item_name" value="Prodotto Venduto">
    <
    input type="hidden" name="amount" value="5.00">
    <
    input type="hidden" name="currency_code" value="EUR">
    <
    input type='image' src='images/buy_go.png' name='acquista' value='acquista'>
    </
    form

    e questo è la semplicissima pagina ipn dove ho lasciato solo il cmd e il print delle variabili

    Codice PHP:
    $req 'cmd=_notify-validate';


    foreach (
    $_POST as $key => $value) {
    $value urlencode(stripslashes($value));
    $req .= "&$key=$value";
    echo 
    $key." = "$value."
    "
    //qui provo a stampare tutti i contenuti ma è vuoto sia $key che $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 ('ssl://www.sandbox.paypal.com'443$errno$errstr30);   // sandbox 
    non viene stampato nulla!
    if($fp) da TRUE quindi non dovrebbe essere li il problema.

    dove può essere?

    grazie
    http://codecanyon.net/category/all?ref=Manuelandro
    And I bet she told a million people that she'd stay in touch, Well all the little promises they dont mean much,When theres
    memories to be made

  2. #2
    non sono esperto di queste cose... ma dico la mia:
    ma sei sicuro che quel input type="image" funge da submit...?

  3. #3
    certo. ma io al paypal ci arrivo, pago e ritorno pure. sono le variabili POST di ritorno che danno problemi
    http://codecanyon.net/category/all?ref=Manuelandro
    And I bet she told a million people that she'd stay in touch, Well all the little promises they dont mean much,When theres
    memories to be made

  4. #4
    ho inserito una serie di debug per capire cosa non va in porto
    Codice PHP:
    $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 ('ssl://www.sandbox.paypal.com'443$errno$errstr30);   // sandbox

    if (!$fp) { echo"DEBUG: SOCK NON APERTO
    "
    // HTTP ERROR
    } else { echo"DEBUG: SOCK APERTO
    "
    ;

    $fputs fputs ($fp$header $req);    if(!$fputs) { echo"DEBUG: FPUTS FAILED
    "
    ; } else { echo"DEBUG: FPUTS OK
    "
    ; }

    while (!
    feof($fp)) {
        
    $res fgets ($fp1024); if(!$res) { echo"DEBUG: FGETS FAILED
    "
    ; } else { echo"DEBUG: FGETS OK
    "
    ; }

    if (
    strcmp ($res"VERIFIED") == 0) {
    echo
    "DEBUG: VERFIED";
    }
    else if (
    strcmp ($res"INVALID") == 0) {
        echo
    "DEBUG: NOT VERIFIED";
    }
    }
    fclose ($fp);

    ed il risultato è questo
    codice:
    DEBUG: SOCK APERTO
    DEBUG: FPUTS OK
    DEBUG: FGETS OK
    DEBUG: FGETS OK
    DEBUG: FGETS OK
    DEBUG: FGETS OK
    DEBUG: FGETS OK
    DEBUG: FGETS OK
    DEBUG: FGETS OK
    DEBUG: FGETS OK
    DEBUG: FGETS OK
    DEBUG: FGETS OK
    DEBUG: FGETS OK
    DEBUG: FGETS OK
    DEBUG: NOT VERIFIED
    http://codecanyon.net/category/all?ref=Manuelandro
    And I bet she told a million people that she'd stay in touch, Well all the little promises they dont mean much,When theres
    memories to be made

  5. #5
    Utente di HTML.it L'avatar di luca200
    Registrato dal
    Apr 2002
    Messaggi
    4,120
    Non so quanto ti sarà utile, ma io tempo fa provai ad usare la sandbox e non funzionava una mazza.
    Dovetti fare le prove in ambiente di produzione, stornando gli addebiti ogni volta

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.