Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
PHP - PayPal e IPN con PHP
Forum - PHP - PayPal e IPN con PHP - Pagina 2

Pagine: [ 1 2 3 ] Precedente | Prossimo
Avatar
mirkos90 (Normal User)
Rookie


Messaggi: 42
Iscritto: 13/10/2007

Segnala al moderatore
Postato alle 16:29
Martedì, 10/11/2009
Ups, ho editato mentre rispondevi :_doubt: (sry)
Comunque, ok :k:

Se puoi rispondi anche all'edit? ci sono così vicino..... :cheer:

Ultima modifica effettuata da mirkos90 il 10/11/2009 alle 16:35
PM Quote
Avatar
NewAge (Normal User)
Pro


Messaggi: 153
Iscritto: 23/08/2009

Segnala al moderatore
Postato alle 16:39
Martedì, 10/11/2009
Codice sorgente - presumibilmente Plain Text

  1. <? $prezzo=5; $dns="www.io.it"; $id=5; $mail="io@io.it" ?>
  2.  
  3. <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
  4. <input type="hidden" name="cmd" value="_xclick"><!--senza s- -->
  5. <input type="hidden" name="business" value="<? echo $mail; ?>">
  6. <input type="hidden" name="lc" value="IT">
  7. <input type="hidden" name="notify_url" value="SITO/PayPal/?id=<? echo $id; ?>">
  8. <input type="hidden" name="item_name" value="<? echo $dns; ?>">
  9. <input type="hidden" name="amount" value="<? echo $prezzo; ?>">
  10. <input type="hidden" name="currency_code" value="EUR">
  11. <input type="hidden" name="button_subtype" value="products">
  12. <input type="image" src="https://www.paypal.com/it_IT/IT/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - Il sistema di pagamento online più facile e sicuro!">
  13. <img alt="" border="0" src="https://www.paypal.com/it_IT/i/scr/pixel.gif" width="1" height="1">
  14. </form>



Secondo me basta questo codice così ad occhio, testa però. :)

PM Quote
Avatar
mirkos90 (Normal User)
Rookie


Messaggi: 42
Iscritto: 13/10/2007

Segnala al moderatore
Postato alle 16:46
Martedì, 10/11/2009
Niente :-S, arrivo a pagare, pago, dice che ho pagato, ma a me pare che non ha stabilito alcun contatto con la pagina nel mio server
(Ho fatto si che la mia pagina, scrivesse in un file di testo se gli arrivano richieste, questo funziona con il servizio di test di PayPal IPN, ma non quando faccio il pagamento tramite Form no :-|)

Ultima modifica effettuata da mirkos90 il 10/11/2009 alle 16:52
PM Quote
Avatar
NewAge (Normal User)
Pro


Messaggi: 153
Iscritto: 23/08/2009

Segnala al moderatore
Postato alle 17:02
Martedì, 10/11/2009
posta il codice della form e della pagina ipn che hai fatto.

PS: la pagina ipn non è su un server locale vero?

PM Quote
Avatar
mirkos90 (Normal User)
Rookie


Messaggi: 42
Iscritto: 13/10/2007

Segnala al moderatore
Postato alle 17:18
Martedì, 10/11/2009
Certo:
index.html:
Codice sorgente - presumibilmente Plain Text

  1. <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
  2. <input type="hidden" name="cmd" value="_xclick">
  3. <input type="hidden" name="business" value="MAIL"><!--MNF6K3LQFT5KS-->
  4. <input type="hidden" name="lc" value="IT">
  5. <input type="hidden" name="notify_url" value="http://SITO/PayPal/index.php?id=1">
  6. <input type="hidden" name="item_name" value="prova.it">
  7. <input type="hidden" name="amount" value="70">
  8. <input type="hidden" name="currency_code" value="EUR">
  9. <input type="hidden" name="button_subtype" value="products">
  10. <input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
  11. <input type="image" src="https://www.paypal.com/it_IT/IT/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - Il sistema di pagamento online più facile e sicuro!">
  12. <img alt="" border="0" src="https://www.paypal.com/it_IT/i/scr/pixel.gif" width="1" height="1">
  13. </form>



index.php
Codice sorgente - presumibilmente Php

  1. <?
  2. $id = htmlentities($_GE&#358;['id']);
  3. $req = 'cmd=_notify-validate';
  4. foreach ($_POST as $key => $value) {
  5. $value = urlencode(stripslashes($value));
  6. $req .= "&$key=$value";
  7. }
  8. $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
  9. $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
  10. $header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
  11. $fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
  12. $item_name = $_POST['item_name'];
  13. $item_number = $_POST['item_number'];
  14. $payment_status = $_POST['payment_status'];
  15. $payment_amount = $_POST['mc_gross'];
  16. $payment_currency = $_POST['mc_currency'];
  17. $txn_id = $_POST['txn_id'];
  18. $receiver_email = $_POST['receiver_email'];
  19. $payer_email = $_POST['payer_email'];
  20. if (!$fp) {
  21. echo("Errore, contattare errors@SITO");
  22. } else {
  23. fputs ($fp, $header . $req);
  24. while (!feof($fp)) {
  25. $res = fgets ($fp, 1024);
  26. if (strcmp ($res, "VERIFIED") == 0) {
  27.             echo("riuscito");
  28.             $h = fopen("lol.txt","a+");
  29.             $scrivi = "$item_name\n$item_number\n$payment_status\n$payment_amount\n$payment_currency\n$txn_id\n$payer_email";
  30.             fwrite($h,$scrivi);
  31.             fclose($h);
  32. }
  33. else if (strcmp ($res, "INVALID") == 0) {
  34. echo("Errore, contattare errors@sSITO [INVALID]");
  35. }
  36. }
  37. fclose ($fp);
  38. }
  39. ?>


Ultima modifica effettuata da mirkos90 il 10/11/2009 alle 17:24
PM Quote
Avatar
NewAge (Normal User)
Pro


Messaggi: 153
Iscritto: 23/08/2009

Segnala al moderatore
Postato alle 17:27
Martedì, 10/11/2009
Mhmmm, il tuo sito è dotato di protocollo ssl? se non lo è devi usare

    $fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);

PM Quote
Avatar
mirkos90 (Normal User)
Rookie


Messaggi: 42
Iscritto: 13/10/2007

Segnala al moderatore
Postato alle 17:33
Martedì, 10/11/2009
Sinceramente, non sò come verificare se il server che utilizzo (hostgator) sia dotato di SSL :-|.
Comunque, non dovrei mettere sempre
www.sandbox.paypal.com ?
EDIT:
Nulla:
ne con
www.sandbox.paypal.com
ne con:
www.paypal.com
:-|

Ultima modifica effettuata da mirkos90 il 10/11/2009 alle 17:44
PM Quote
Avatar
NewAge (Normal User)
Pro


Messaggi: 153
Iscritto: 23/08/2009

Segnala al moderatore
Postato alle 18:53
Martedì, 10/11/2009
Ho detto:

non usare $fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);

ma

$fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);

PM Quote
Pagine: [ 1 2 3 ] Precedente | Prossimo