Tuve la aplicación de prueba integrada con Paypal express checkout y funcionaba bien. Pero ahora parece haber algún problema. Después del pago exitoso en paypal cuando mi manejador de IPN comprueba la respuesta, paypal devuelve la respuesta como página html en lugar de "VERIFICADA" o "NO VÁLIDA", y debido a esto no puedo verificar el pago. ¿Hay algún cambio en Paypal recientemente para el pago y envío rápido? A continuación se muestra el código completopago exprés de PayPal devolviendo la respuesta como html en MVC .net
<form id="Paypal" name="Paypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr"
method="post">
@Html.Hidden("cmd", "_xclick")
@Html.Hidden("business", "[email protected]")
@Html.Hidden("item_name", "Payment for course registration")
@Html.Hidden("amount", 100)
@Html.Hidden("no_shipping", "1")
@Html.Hidden("return", "http://localhost:49319/cart/IPN")
@Html.Hidden("rm", "2")
@Html.Hidden("notify_url", "http://localhost:49319/cart/IPN")
@Html.Hidden("cancel_return", "http://localhost:49319/cart/PaymentFailure")
@Html.Hidden("currency_code", "CAD")
@Html.Hidden("tax_cart", "1")
@Html.Hidden("custom", "12")
<div class="checkout-button">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif"
align="left" style="margin-right: 7px;" />
</div>
</form>
IPN código del controlador:
string paypalUrl = useSandbox ? "https://www.sandbox.paypal.com/cgi-bin/webscr"
: "https://www.paypal.com/cgi-bin/webscr";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(paypalUrl);
// Set values for the request back
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
byte[] param = Request.BinaryRead(Request.ContentLength);
string strRequest = Encoding.ASCII.GetString(param);
StringBuilder sb = new StringBuilder();
sb.Append(strRequest);
foreach (string key in formVals.Keys)
{
sb.AppendFormat("&{0}={1}", key, formVals[key]);
}
strRequest += sb.ToString();
req.ContentLength = strRequest.Length;
//for proxy
//WebProxy proxy = new WebProxy(new Uri("http://urlort#");
//req.Proxy = proxy;
//Send the request to PayPal and get the response
string response = "";
using (StreamWriter streamOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII))
{
streamOut.Write(strRequest);
streamOut.Close();
using (StreamReader streamIn = new StreamReader(req.GetResponse().GetResponseStream()))
{
response = streamIn.ReadToEnd();
}
}
return response;
Editar: Aquí está cadena de solicitud enviado a PayPal
CONTEXTO = wtgSziM4C5x0SI-9CmKcv2vkSeTLK5P_g6HqzC__YTYkcqziFNcB84p79Ja & myAllTextSubmitID = & cmd = _flow & transaction_subject = 12 & txn_type = web_acce pt & payment_date = 01% 3A59% 3A21 + Mayo + 02% 2C + 2011 + PDT & last_name = Usuario & residence_country = CA & pending_reason = paymentreview & item_name = Pago + de + plato + registro & payment_gross = & mc_currency = CAD & negocio = pramod_1298956597_biz% 40sumerusolutions.com & payment_type = instante & protection_eligibility = No elegible & payer_status = verificada & verify_sign = Ag7LtkvrF1u9.1ScLJwRM4btR1G1A16qsCs-xUl6EpI1rE1UWpodXJsc & txn_id = 15Y20623GD922445F & PAYER_EMAIL = pramod_1298961722_per% 40sumerusolutions.com & impuesto = 0,00 & test_ipn = 1 & nombre apellido = Prueba & receiver_email = pramod_1298956597_biz% 40sumerusolutions.com & cantidad = 1 & payer_id = Z2MRT3Q9L6E28 & receiver_id = RT3M59WESZHEE & item_number = & payment_status = Pendiente de & handling_amount = 0.00 & envío = 0.00 = 850.00 mc_gross & & encargo = 12 & charset = windows-1252 & notify_version = 3,1 & merchant_return_link = + clic aquí & form_charset = UTF-8CONTEXT = wtgSziM4C5x0SI-9CmKcv2vkSeTLK5P_g6HqzC__YTYkcqziFNcB84p79Ja & myAllTextSubmitID = & cmd =_flowtransaction_subject = 12 & txn_type = web_accept & payment_date = 01% 3A59% 3A21 + Mayo + 02% 2C + 2011 + PDT & last_name = Usuario & residence_country = CA & pending_reason = paymentreview & item_name = Pago + de + plato + registro & payment_gross = & mc_currency = CAD & negocio = pramod_1298956597_biz% 40sumerusolutions.com & payment_type = instante & protection_eligibility = No elegible & payer_status = verificada & verify_sign = Ag7LtkvrF1u9.1ScLJwRM4btR1G1A16qsCs-xUl6EpI1rE1UWpodXJsc & txn_id = 15Y20623GD922445F & PAYER_EMAIL = pramod_129896172 2_per% 40sumerusolutions.com & tax = 0.00 & test_ipn = 1 & first_name = Test & receiver_email = pramod_1298956597_biz% 40sumerusolutions.com & cantidad = 1 & payer_id = Z2MRT3Q9L6E28 & receiver_id = RT3M59WESZHEE & item_number = & payment_status = Pendiente de & handling_amount = 0.00 & envío = 0.00 & mc_gross = 850.00 & encargo = 12 & charset = windows-1252 & notify_version = 3,1 & merchant_return_link = clic + aquí & form_charset = UTF-8 & cmd = _notify-validar
Hola nEEbz, por favor vea la respuesta de paypal actualizada arriba en mi publicación. No tengo ni idea de esto, esto sucede siempre, incluso cuando el pago es exitoso. PD: esto es de Sandbox y no he probado el código en el sitio real de PayPal. Antes de ir con el sitio real, quiero confirmar primero en sandbox. – pramodtech