public ActionResult Pay(long?prime, long?vid, long?id, string userid, string amnt) { Teacher forsale = db.Teachers.Find(id); DateTime _date = Convert.ToDateTime(DateTime.Now); _date = _date.AddDays(365); forsale.UserId = User.Identity.GetUserId(); forsale.Status = true; forsale.Date = DateTime.Now; forsale.EndDate = _date; forsale.StratDate = DateTime.Now; db.Entry(forsale).State = EntityState.Modified; db.SaveChanges(); var ids = DateTime.Now.ToString("mmddyyyy"); RazorpayClient client = new RazorpayClient(RazorPayConst.Api_Key, RazorPayConst.Key_Secret); Dictionary <string, object> options = new Dictionary <string, object>(); options.Add("amount", amnt); // amount in the smallest currency unit options.Add("receipt", "order_id" + ids); options.Add("currency", "INR"); options.Add("payment_capture", "1"); Order order = client.Order.Create(options); List <Order> payments = client.Order.All(); string datas = payments[0]["id"]; ViewBag.receipt = datas; RazorPayPaymentDetails clients = new RazorPayPaymentDetails(); clients.Amount = Convert.ToDouble(amnt); clients.Currency = "INR"; clients.Captured = "Paid"; clients.RazorpayOrderId = ids; clients.MerchantOrderId = "vooq.com"; clients.PaymentId = User.Identity.GetUserId(); clients.PaymentDate = DateTime.Now; db.RazorPayPaymentDetails.Add(clients); db.SaveChanges(); return(View()); }
public ActionResult Pay(long?prime, long?vid, long?id, string userid, string amnt) { var amnts = amnt.Replace(".", ""); var ids = DateTime.Now.ToString("mmddyyyy"); RazorpayClient client = new RazorpayClient(RazorPayConst.Api_Key, RazorPayConst.Key_Secret); Dictionary <string, object> options = new Dictionary <string, object>(); options.Add("amount", amnts); // amount in the smallest currency unit options.Add("receipt", "order_id" + ids); options.Add("currency", "INR"); options.Add("payment_capture", "1"); Order order = client.Order.Create(options); List <Order> payments = client.Order.All(); string datas = payments[0]["id"]; ViewBag.receipt = datas; ViewBag.userid = User.Identity.GetUserId(); ViewBag.vid = vid; ViewBag.id = id; ViewBag.prime = prime; ViewBag.email = User.Identity.Name; RazorPayPaymentDetails clients = new RazorPayPaymentDetails(); clients.Amount = Convert.ToDouble(amnt); clients.Currency = "INR"; clients.Captured = "Paid"; clients.RazorpayOrderId = ids; clients.MerchantOrderId = "vooq.com"; clients.PaymentId = User.Identity.GetUserId(); clients.PaymentDate = DateTime.Now; db.RazorPayPaymentDetails.Add(clients); db.SaveChanges(); return(View()); }