mirkos90 (Normal User)
Rookie
Messaggi: 42
Iscritto: 13/10/2007
|
Ups, ho editato mentre rispondevi (sry)
Comunque, ok
Se puoi rispondi anche all'edit? ci sono così vicino.....
Ultima modifica effettuata da mirkos90 il 10/11/2009 alle 16:35 |
|
NewAge (Normal User)
Pro
Messaggi: 153
Iscritto: 23/08/2009
|
Codice sorgente - presumibilmente Plain Text |
<? $prezzo=5; $dns="www.io.it"; $id=5; $mail="io@io.it" ?>
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick"><!--senza s- -->
<input type="hidden" name="business" value="<? echo $mail; ?>">
<input type="hidden" name="lc" value="IT">
<input type="hidden" name="notify_url" value="SITO/PayPal/?id=<? echo $id; ?>">
<input type="hidden" name="item_name" value="<? echo $dns; ?>">
<input type="hidden" name="amount" value="<? echo $prezzo; ?>">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="button_subtype" value="products">
<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!">
<img alt="" border="0" src="https://www.paypal.com/it_IT/i/scr/pixel.gif" width="1" height="1">
</form>
|
Secondo me basta questo codice così ad occhio, testa però.
|
|
mirkos90 (Normal User)
Rookie
Messaggi: 42
Iscritto: 13/10/2007
|
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 |
|
NewAge (Normal User)
Pro
Messaggi: 153
Iscritto: 23/08/2009
|
posta il codice della form e della pagina ipn che hai fatto.
PS: la pagina ipn non è su un server locale vero?
|
|
mirkos90 (Normal User)
Rookie
Messaggi: 42
Iscritto: 13/10/2007
|
Certo:
index.html:
Codice sorgente - presumibilmente Plain Text |
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="MAIL"><!--MNF6K3LQFT5KS-->
<input type="hidden" name="lc" value="IT">
<input type="hidden" name="notify_url" value="http://SITO/PayPal/index.php?id=1">
<input type="hidden" name="item_name" value="prova.it">
<input type="hidden" name="amount" value="70">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
<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!">
<img alt="" border="0" src="https://www.paypal.com/it_IT/i/scr/pixel.gif" width="1" height="1">
</form>
|
index.php
Codice sorgente - presumibilmente Php |
<? $req = 'cmd=_notify-validate'; foreach ($_POST as $key => $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, $errstr, 30 ); $item_name = $_POST['item_name']; $item_number = $_POST['item_number']; $payment_status = $_POST['payment_status']; $payment_amount = $_POST['mc_gross']; $payment_currency = $_POST['mc_currency']; $txn_id = $_POST['txn_id']; $receiver_email = $_POST['receiver_email']; $payer_email = $_POST['payer_email']; if (!$fp) { echo("Errore, contattare errors@SITO"); } else { fputs ($fp, $header . $req); $res = fgets ($fp, 1024 ); if (strcmp ($res, "VERIFIED") == 0 ) { echo("riuscito"); $h = fopen("lol.txt","a+"); $scrivi = "$item_name\n$item_number\n$payment_status\n$payment_amount\n$payment_currency\n$txn_id\n$payer_email"; } else if (strcmp ($res, "INVALID") == 0 ) { echo("Errore, contattare errors@sSITO [INVALID]"); } } } ?>
|
Ultima modifica effettuata da mirkos90 il 10/11/2009 alle 17:24 |
|
NewAge (Normal User)
Pro
Messaggi: 153
Iscritto: 23/08/2009
|
Mhmmm, il tuo sito è dotato di protocollo ssl? se non lo è devi usare
$fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);
|
|
mirkos90 (Normal User)
Rookie
Messaggi: 42
Iscritto: 13/10/2007
|
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 |
|
NewAge (Normal User)
Pro
Messaggi: 153
Iscritto: 23/08/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);
|
|