Problema di sincronizzazione PAYPAL con PHP

z.cristiano

Utente Attivo
16 Giu 2007
145
0
16
Buonasera,
posso chiederle un informazione?

Siccome ho fatto tanti siti con pagamenti PayPal che praticamente, fino adesso ha sempre tutto funzionato ma un solo problema su un sito che, quando gli utenti pagano con PayPal a volte non sincronizza se il pagamento è andato a buon fine....potrebbe essere un problema con il database MYSQL di ARUBA?

Perchè ho provato sul locale e anche sul server CONTABO, non hanno mai avuto problemi anche facendo il test di paypal chiamato SANDBOX PAYPAL..

Cosa può essere?

Vedo se posso anche dire cosa ho impostato su PAYPAL:

IMPOSTAZIONE CONTO -> PAGAMENTI SU SITO WEB -> Notifiche immediate di pagamento -> configurato si IPN (pagina di sincronizzazione dati nel database)

IMPOSTAZIONE CONTO -> PAGAMENTI SU SITO WEB -> Preferenze per il sito web -> configurato su Ritorno automatico per i pagamenti su sito web (pagina di ritorno se è andato a buon fine)

E infine ho messo il file PHP che sincronizza i dati (messo su IPN) vede sotto
PHP:
<?php


$req = 'cmd=_notify-validate';


foreach($_POST as $key => $value)

{


$value = urlencode(stripslashes($value));

$req .= "&". $key ."=". $value ."";


}


// post back to PayPal system to validate

$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.paypal.com", 443, $errno, $errstr, 30);


// assign posted variables to local variables

$item_name = $_POST['item_name'];

$business = $_POST['business'];

$item_number = $_POST['item_number'];

$payment_status = $_POST['payment_status'];

$mc_gross = $_POST['mc_gross'];

$mc_shipping = $_POST['mc_shipping'];

$payment_currency = $_POST['mc_currency'];

$txn_id = $_POST['txn_id'];

$receiver_email = $_POST['receiver_email'];

$receiver_id = $_POST['receiver_id'];

$quantity = $_POST['quantity'];

$num_cart_items = $_POST['num_cart_items'];

$payment_date = $_POST['payment_date'];

$first_name = $_POST['first_name'];

$last_name = $_POST['last_name'];

$payment_type = $_POST['payment_type'];

$payment_status = $_POST['payment_status'];

$payment_gross = $_POST['payment_gross'];

$payment_fee = $_POST['payment_fee'];

$settle_amount = $_POST['settle_amount'];

$memo = $_POST['memo'];

$shipping = $_POST['shipping'];

$payer_email = $_POST['payer_email'];

$txn_type = $_POST['txn_type'];

$payer_status = $_POST['payer_status'];

$address_street = $_POST['address_street'];

$address_city = $_POST['address_city'];

$address_state = $_POST['address_state'];

$address_zip = $_POST['address_zip'];

$address_country = $_POST['address_country'];

$address_status = $_POST['address_status'];

$item_number = $_POST['item_number'];

$tax = $_POST['tax'];

$option_name1 = $_POST['option_name1'];

$option_selection1 = $_POST['option_selection1'];

$option_name2 = $_POST['option_name2'];

$option_selection2 = $_POST['option_selection2'];

$for_auction = $_POST['for_auction'];

$invoice = $_POST['invoice'];

$custom = $_POST['custom'];

$notify_version = $_POST['notify_version'];

$verify_sign = $_POST['verify_sign'];

$payer_business_name = $_POST['payer_business_name'];

$payer_id =$_POST['payer_id'];

$mc_currency = $_POST['mc_currency'];

$mc_fee = $_POST['mc_fee'];

$exchange_rate = $_POST['exchange_rate'];

$settle_currency  = $_POST['settle_currency'];

$parent_txn_id  = $_POST['parent_txn_id'];

$pending_reason = $_POST['pending_reason'];

$reason_code = $_POST['reason_code'];

$night_phone_a = $_POST['night_phone_a'];

$night_phone_b= $_POST['night_phone_b'];

$day_phone_a = $_POST['day_phone_a'];

$day_phone_b = $_POST['day_phone_b'];

$contact_phone = $_POST['contact_phone'];



// subscription specific vars


$subscr_id = $_POST['subscr_id'];

$subscr_date = $_POST['subscr_date'];

$subscr_effective  = $_POST['subscr_effective'];

$period1 = $_POST['period1'];

$period2 = $_POST['period2'];

$period3 = $_POST['period3'];

$amount1 = $_POST['amount1'];

$amount2 = $_POST['amount2'];

$amount3 = $_POST['amount3'];

$shipping1 = $_POST['shipping1'];

$shipping2 = $_POST['shipping2'];

$shipping3 = $_POST['shipping3'];

$mc_amount1 = $_POST['mc_amount1'];

$mc_amount2 = $_POST['mc_amount2'];

$mc_amount3 = $_POST['mc_amount3'];

$recurring = $_POST['recurring'];

$reattempt = $_POST['reattempt'];

$retry_at = $_POST['retry_at'];

$recur_times = $_POST['recur_times'];

$username = $_POST['username'];

$password = $_POST['password'];


//auction specific vars


$for_auction = $_POST['for_auction'];

$auction_closing_date = $_POST['auction_closing_date'];

$auction_multi_item = $_POST['auction_multi_item'];

$auction_buyer_id = $_POST['auction_buyer_id'];


if(!$fp)

{


// HTTP ERROR


} else {


fputs ($fp, $header . $req);


while(!feof($fp))

{


$res = fgets ($fp, 1024);


if(strpos($res, "VERIFIED") == 0)

{


$queryAcquista = "INSERT INTO carrello (data, mc_gross, indirizzo_ip, indirizzo_host, paymentstatus, buyer_email, paymenttype, paymentdate, txnid, pendingreason, receiverid, payerid, id_lingua, nome_paypal, cognome_paypal, numero) VALUES ('". date("Y-m-d H:i:s") ."', '". $mc_gross ."', '". $_SERVER['REMOTE_ADDR'] ."', '". $_SERVER['SERVER_ADDR'] ."', '". $payment_status ."', '". $payer_email ."', '". $payment_type ."', '". $payment_date ."', '". $txn_id ."', '". $pending_reason ."', '". $receiver_id ."', '". $payer_id ."', '". $aggiungimenti[0] ."', '". $first_name ."', '". $last_name ."', '". $item_number ."')";


if(mysqli_query($connessione, $queryAcquistaBistrot))

{


$to = '[email protected]';


$subject = 'titolo';

 

$message = 'IL pagamento tramite PayPal è andata a buon fine.';


$headers = "MIME-Version: 1.0\n";

$headers .= "Content-type: text/html; charset=iso-8859-1\n";

$headers .= "From: Titolo <[email protected]>\n";


mail($to, $subject, $message, $headers);


}



} elseif(strcmp ($res, "INVALID") == 0)

{






}

}

fclose ($fp);

}

?>



Ho sbagliato qualcosa?
Non serve per forza configurare API?
 
Ultima modifica di un moderatore:

Max 1

Super Moderatore
Membro dello Staff
SUPER MOD
MOD
29 Feb 2012
4.449
338
83
avviso.png
 
Discussioni simili
Autore Titolo Forum Risposte Data
A Problema sincronizzazione Php PHP 0
K Problema form update PHP 2
O problema con dvr dahua xvr5116 IP Cam e Videosorveglianza 0
S Problema nel ciclare un json Javascript 0
G Problema con Xampp Web Server 1
andrea barletta Problema con miniature comandi Photoshop 0
I problema con alice Posta Elettronica 0
K Problema Inner join PHP 1
F firefox problema http Linux e Software 0
N Problema con position absolute e overflow HTML e CSS 4
E Problema jquery Success jQuery 2
L Problema con inner join PHP 11
K [php] Problema con inner join PHP 4
E problema selezione sfumata Photoshop 2
K [PHP] Problema con variabili concatenate. PHP 1
A Problema filtro fluidifica Photoshop Photoshop 1
H Problema Bordi Scontorno Photoshop 1
O problema con query PHP 4
R Problema installazione Realtek WiFi USB rtl8821 Reti LAN e Wireless 0
I problema con 2 account Posta Elettronica 1
L problema collegamento file css con html HTML e CSS 1
Y Problema percorso file in rete PHP 1
N Problema SEO "L'URL non si trova su Google" SEO e Posizionamento 4
E Problema accesso a file con app sviluppata con MIT APP INVENTOR 2 Sviluppo app per Android 0
P Problema acquisizione clienti Webdesign e Grafica 1
F NetBeans problema creazione progetto Java Windows e Software 0
M Problema con Try Catch PHP 0
C problema seo + cerco esperto SEO e Posizionamento 11
Sergio Unia Problema con gli eventi del mouse su una data table: Javascript 2
T PROBLEMA CON SESSIONI PHP 3
A Problema, non so, di scale() o transform, oppure altro? HTML e CSS 0
T ALTRO PROBLEMA CON ARRAY PHP PHP 1
R problema con else PHP 0
T PROBLEMA CON ARRAY PHP 8
L problema con query select PHP 2
R Problema query con ricerca id numerico PHP 2
F Problema con risposta PHP 0
S problema con recupero dati tabella mysql PHP 2
Z Problema con il mio tp-l i nk Reti LAN e Wireless 1
I PROBLEMA: Sostituzione sito XAMPP E-Commerce 0
T problema data 30/11/-1 PHP 0
L Problema RAM con Tomcat 8 Apache 0
napuleone problema con sort e asort PHP 4
Y Problema incolonnamento tabella PHP 7
S problema salvataggio immagini Photoshop 0
Z Problema con INT MySQL PHP 1
Z Problema database MySQL con XAMPP PHP 0
M Problema con controllo form in real time jQuery 6
D problema php mysql PHP 1
D problema php mysql PHP 1

Discussioni simili