Ciao a tutti,
sto cercando di implementare PayPal sul mio sito, per l'invio dei dati nessun intoppo, il problema nasce con il return automatico..
Vorrei implementare il IPN! nella mia pagina di return i paramentri del pagamento mi vengono scritti nell'url in tale modo:
http://--/paypal/payment.aspx?tx=74Y42708DV8899058&st=Completed&amt=17.00&cc=EUR&cm=2a30d57b-f9d3-4dfa-86c3-6e2ea7d7b201&item_number=
ma da quanto ho capito questo è sbagliato, io dovrei ricevere, come ad esempio prendo una transazione di aruba, un url così composto:
http://pagamenti.aruba.it/ConfermaPagamentoOrdine.aspx?idordine=MO3915536&idlang=1&token=EC-6RH90361NT577232S&PayerID=ARYBH3349W5WG
Se ho capito male salto la convalida della notifica, è giusto? Qualcuno saprebbe dove sbaglio? Il mio codice è il seguente:
string strFormValues = Encoding.ASCII.GetString(this.Request.BinaryRead(this.Request.ContentLength));
string requestUriString = "https://www.sandbox.paypal.com/cgi-bin
// Create the request back
HttpWebRequest request =(HttpWebRequest)WebRequest.Create(requestUriString);
// Set values for the request back
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
string obj2 = strFormValues + "&cmd=_notify-validate";
request.ContentLength = obj2.Length;
// Write the request back IPN strings
StreamWriter writer = new StreamWriter(request.GetRequestStream(), Encoding.ASCII);
writer.Write(RuntimeHelpers.GetObjectValue(obj2));
writer.Close();
//send the request, read the response
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream responseStream = response.GetResponseStream();
Encoding encoding = Encoding.GetEncoding("utf-8");
StreamReader reader = new StreamReader(responseStream, encoding);
// Reads 256 characters at a time.
char[] buffer = new char[0x101];
int length = reader.Read(buffer, 0, 0x100);
while (length > 0)
{
// Dumps the 256 characters to a string
string IPNResponse = new string(buffer, 0, length);
length = reader.Read(buffer, 0, 0x100);
string pay_stat = Request.QueryString["st"];
//if (String.Compare(IPNResponse, "VERIFIED", false) == 0)
if (!string.IsNullOrEmpty(pay_stat) && pay_stat == "Completed")
{
resultLabel.Text = "Grazie per aver effettuato il pagamento!"; +
}
else
{
resultLabel.Text = "Il pagamento tramite PayPal non è andato a buon fine.";}
}