public ActionResult procesar_pago(FormCollection Request) { var token = Request["token"].Split(',')[0]; var payment_method_id = Request["payment_method_id"].Split(',')[0]; var installments = Request["installments"].Split(',')[0]; var issuer_id = Request["issuer_id"].Split(',')[0]; if (MercadoPago.SDK.AccessToken == null) { MercadoPago.SDK.SetAccessToken("TEST-6196665787772204-120903-7e3696caa9ad7207eae686fc4d423f53-684823230"); } var carrito = cartprocess.GetByCookie(User.Identity.Name); var listadoitems = itemsprocess.GetByCartId(carrito.Id); var Total = sum_items(listadoitems); //MercadoPago.SDK.SetAccessToken(token); Payment payment = new Payment(); payment.TransactionAmount = (float)Total; payment.Token = token; payment.Description = "Spark-Art"; payment.Installments = int.Parse(installments); //Convert.ToInt32(installments); payment.PaymentMethodId = payment_method_id; payment.IssuerId = issuer_id; payment.Payer = new MercadoPago.DataStructures.Payment.Payer() { Email = "*****@*****.**" }; var payret = payment.Save(); ViewBag.Confirmacion = (payment.Status); ViewBag.Cuotas = payment.Installments; ViewBag.Monto = payment.TransactionAmount; //Impacto y creacion de la orden y lineas de orden Entities.Model.Order order = new Entities.Model.Order(); CheckAuditPattern(order, true); var ship = shippingprocess.GetByCookie(User.Identity.Name); order.ShippingId = ship.Id; order.Email = User.Identity.Name; order.OrderDate = DateTime.Now; order.TotalPrice = Total; order.ItemCount = carrito.CartItem.Count(); order = orderprocess.AgregarOrder(order); var pdf = crear_pdf(order, listadoitems, ship); order.Pdf = pdf; orderprocess.EditarOrder(order); enviarmail(order); ViewBag.items = listadoitems; ViewBag.pago = payment; foreach (CartItem item in listadoitems) { OrderDetail orderdetail = new OrderDetail(); CheckAuditPattern(orderdetail, true); orderdetail.OrderId = order.Id; orderdetail.ProductId = item.ProductId; orderdetail.Price = item.Price; orderdetail.Quantity = item.Quantity; orderprocess.AgregarLinea(orderdetail); itemsprocess.EliminarCartItem(item.Id); } cartprocess.EliminarCart(carrito); ViewBag.items = listadoitems; return(View("procesar_pago", order)); }