Cercherò di arrivare dritto al punto. Attualmente sto lavorando con PayPal IPN e non ho mai visto questo problema prima. Ho usato l'IPN di PayPal e le mie implementazioni sono sempre state le stesse. Questa volta però sta producendo risultati molto strani.ASP.NET Paypal IPN restituito VERIFICATO ma non è possibile inviare IPN
Attualmente sto ospitato con WinHost.com
codice utilizzato:
public void MakeHttpPost()
{
ErrorLog log = new ErrorLog();
//Post back to either sandbox or live
string strSandbox = "https://www.sandbox.paypal.com/cgi-bin/webscr";
string strLive = "https://www.paypal.com/cgi-bin/webscr";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(strSandbox);
//Set values for the request back
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
byte[] param = HttpContext.Current.Request.BinaryRead(HttpContext.Current.Request.ContentLength);
string strRequest = Encoding.ASCII.GetString(param);
strRequest += "&cmd=_notify-validate";
req.ContentLength = strRequest.Length;
//for proxy
//WebProxy proxy = new WebProxy(new Uri("http://url:port#"));
//req.Proxy = proxy;
//Send the request to PayPal and get the response
StreamWriter streamOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII);
streamOut.Write(strRequest);
streamOut.Close();
StreamReader streamIn = new StreamReader(req.GetResponse().GetResponseStream());
string strResponse = streamIn.ReadToEnd();
streamIn.Close();
log.error = strResponse;
log.Insert();
if (strResponse == "VERIFIED")
{
PaypalPaymentHistory PPH = new PaypalPaymentHistory();
PPH.LastName = HttpContext.Current.Request["last_name"];
PPH.FirstName = HttpContext.Current.Request["first_name"];
PPH.State = HttpContext.Current.Request["address_state"];
PPH.Zipcode = HttpContext.Current.Request["address_zip"];
PPH.Address = HttpContext.Current.Request["address_street"];
PPH.UserName = HttpContext.Current.Request["option_name2"];
PPH.PaymentStatus = HttpContext.Current.Request["payment_status"];
PPH.SelectedPackage = HttpContext.Current.Request["option_selection1"];
PPH.PayerStatus = HttpContext.Current.Request["payer_status"];
PPH.PaymentType = HttpContext.Current.Request["payment_type"];
PPH.PayerEmail = HttpContext.Current.Request["payer_email"];
PPH.ReceiverId = HttpContext.Current.Request["receiver_id"];
PPH.TxnType = HttpContext.Current.Request["txn_type"];
PPH.PaymentGross = HttpContext.Current.Request["payment_gross"];
PPH.Insert();
}
else if (strResponse == "INVALID")
{
//log for manual investigation
}
else
{
//log response/ipn data for manual investigation
}
}
L'idea qui è che io controllare lo stato dell'ordine e quindi inserire o meno inserire il record al database ma questo codice è ancora in prova quindi niente è ufficiale.
Il problema che sto avendo è che quando eseguo sandbox ed eseguo un pagamento tramite il mio sito, paypal invia la richiesta IPN. La voce viene gettata nel database e tutti i dati vengono inviati correttamente, tuttavia PayPal sta mostrando che il post IPN è "Non riuscito" ed è sempre bloccato su "Nuovo tentativo". Comunque sto ricevendo "VERIFIED" di nuovo in strResponse. Questo a sua volta sta causando fino a 8 record per transazione. L'errore segnalato da paypal è 500 - Errore interno del server. Qualsiasi aiuto sarebbe pazzamente apprezzato visto che questa è stata una maratona di testa di due giorni fino a questo punto!
Grazie per qualsiasi aiuto o risoluzione!
P.S Ho letto quasi tutte le domande IPN su StackOverflow e non ho visto nulla di simile.
ho il controller che richiama quella funzione WWW.site.com/payment/processpayment che è il link nella casella IPN Paypal – jhartzell
sto ottenendo l'entroterra da PayPal verificato mostrando tuttavia paypal sta mostrando non è riuscita e si ritira costantemente il post per i miei controller azione ProcessPayment che chiama MakeHttpPost – jhartzell
Il controller è molto semplice, l'unico che è in esso è il mio oggetto PPIPN PP = nuovo PPIPN ("TEST") e poi PP.MakeHttpPost(). Non vedo come potrebbe fallire. http://www.mysite.com/payment/processpayment Non è questo un indirizzo IPN corretto da inserire in paypal? Apprezzo davvero il tuo aiuto Rick. – jhartzell