protected void Page_Load(object sender, EventArgs e) { string key = "rzp_test_2pjQoIV7c1RY6C"; string secret = "nWwe91xQO3NIDzJUp1mUmr9O"; ListDictionary trf = new ListDictionary(); trf.Add("amount", 500); trf.Add("account", "acc_EDR7BXuzPGG3kQ"); trf.Add("currency", "INR"); ArrayList lst = new ArrayList(); lst.Add(trf); Dictionary <string, object> input = new Dictionary <string, object>(); input.Add("amount", 10000); // this amount should be same as transaction amount input.Add("currency", "INR"); input.Add("receipt", "12121"); input.Add("payment_capture", 1); input.Add("transfers", lst); System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; RazorpayClient client = new RazorpayClient(key, secret); Razorpay.Api.Order order = client.Order.Create(input); orderId = order["id"].ToString(); Console.WriteLine("order"); }
public ActionResult PayYourDonations(MiniDonationModel model) { var typeM = (MoneyType)(Convert.ToInt32(model.MType)); var typeNmae = typeM.DisplayName(); Dictionary <string, object> input = new Dictionary <string, object>(); input.Add("amount", model.Amount * 100); // this amount should be same as transaction amount input.Add("currency", typeNmae); input.Add("receipt", model.DonateId.ToString()); input.Add("payment_capture", 0); string key = ConfigurationManager.AppSettings["RPapikey"]; string secret = ConfigurationManager.AppSettings["RPSecretkey"]; //string key = "rzp_test_5iPslGRlz5M0ss"; //string secret = "qEsCxVcyaRoSAatpBaVZMBdp"; ////string key = "rzp_live_S9v0s4ePfuxE1p"; ////string secret = "KJylHsBzeIlVeF336TPxjk6w"; ServicePointManager.SecurityProtocol = ServicePointManager.SecurityProtocol | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; RazorpayClient client = new RazorpayClient(key, secret); Razorpay.Api.Order order = client.Order.Create(input); var orderId = order["id"].ToString(); ViewBag.Order = orderId; model.orderId = orderId; ViewBag.Amount = model.Amount * 100; ViewBag.EMail = model.Email; ViewBag.RPkey = key; IService.UpdateCampaignDonationorder(model.DonateId, orderId, "", ""); return(View(model)); }
/// <summary> /// get razor pay order id /// </summary> /// <param name="amount"></param> /// <returns></returns> public string GetRazorPayOrderID(double amount = 0) { try { string stringAmount = amount.ToString(); //string stringReceipt = receipt.ToString(); Dictionary <string, object> input = new Dictionary <string, object>(); input.Add("amount", stringAmount); // this amount should be same as transaction amount input.Add("currency", "INR"); input.Add("receipt", "Receipt"); input.Add("payment_capture", 1); string key = "rzp_live_zdMcQe4K4jLkpq"; string secret = "AznDjQ8cnbwgz3YuaHIVru7M"; RazorpayClient client = new RazorpayClient(key, secret); Razorpay.Api.Order order = client.Order.Create(input); var orderId = order["id"].ToString(); return(orderId); } catch (Exception ex) { throw ex; } }
protected void Page_Load(object sender, EventArgs e) { string key = "rzp_test_xxxxxxxx"; string secret = "xxxxxxxxxxxxxx"; ListDictionary trf = new ListDictionary(); trf.Add("amount", 500); trf.Add("account", "acc_EDR7BXuzPGG3kQ"); trf.Add("currency", "INR"); ArrayList lst = new ArrayList(); lst.Add(trf); Dictionary <string, object> input = new Dictionary <string, object>(); input.Add("amount", 10000); // this amount should be same as transaction amount input.Add("currency", "INR"); input.Add("receipt", "12121"); input.Add("payment_capture", 1); input.Add("transfers", lst); RazorpayClient client = new RazorpayClient(key, secret); Razorpay.Api.Order order = client.Order.Create(input); orderId = order["id"].ToString(); Console.WriteLine("order"); }
public ActionResult PayNow(HotelDetailsVM obj) { HotelDetailsVM model = new HotelDetailsVM(); if (!(User.Identity.IsAuthenticated)) { return(RedirectToAction("Login", "Account", new { Areas = "" })); } Random randomObj = new Random(); string transactionId = randomObj.Next(10000000, 100000000).ToString(); Razorpay.Api.RazorpayClient client = new Razorpay.Api.RazorpayClient(razorKey, razorSecred); Dictionary <string, object> options = new Dictionary <string, object>(); options.Add("amount", "100"); // Amount will in paise options.Add("receipt", transactionId); options.Add("currency", "INR"); options.Add("payment_capture", "0"); // 1 - automatic , 0 - manual Razorpay.Api.Order orderResponse = client.Order.Create(options); string orderId = orderResponse["id"].ToString(); ViewBag.RzpID = razorKey; ViewBag.TransactionID = transactionId; ViewBag.amount = 1; ViewBag.name = obj.preBookDtl.CustName; ViewBag.currency = "INR"; ViewBag.orderDesc = obj.preBookDtl.CustDetails; ViewBag.orderid = orderId; ViewBag.phone = obj.preBookDtl.CustPhNo; model.hotelDtl = objAPI.GetRecordByQueryString <HotelDtl>("webrequest", "gethoteldtl", "HotelID=" + obj.preBookDtl.HotelID); model.preBookDtl = obj.preBookDtl; Session["OrderDetails"] = obj.preBookDtl; return(View(model)); }
public MiniDonationModel CreateOrderRazorPay(MiniDonationModel model) { try { var typeNmae = model.MType; Dictionary <string, object> input = new Dictionary <string, object>(); input.Add("amount", model.Amount * 100); // this amount should be same as transaction amount input.Add("currency", typeNmae); input.Add("receipt", model.DonateId.ToString()); input.Add("payment_capture", 1); Dictionary <string, string> notees = new Dictionary <string, string>(); notees.Add("CampaignId", model.campaignId.ToString()); // this amount should be same as transaction amount input.Add("notes", notees); string key = ConfigurationManager.AppSettings["RPapikey"]; string secret = ConfigurationManager.AppSettings["RPSecretkey"]; //string key = "rzp_test_5iPslGRlz5M0ss"; //string secret = "qEsCxVcyaRoSAatpBaVZMBdp"; ////string key = "rzp_live_S9v0s4ePfuxE1p"; ////string secret = "KJylHsBzeIlVeF336TPxjk6w"; System.Net.ServicePointManager.SecurityProtocol = System.Net.ServicePointManager.SecurityProtocol | System.Net.SecurityProtocolType.Tls11 | System.Net.SecurityProtocolType.Tls12; RazorpayClient client = new RazorpayClient(key, secret); Razorpay.Api.Order order = client.Order.Create(input); var orderId = order["id"].ToString(); model.orderId = orderId; model.RazorPayKey = key; UpdateCampaignDonationorder(model.DonateId, orderId, "", ""); return(model); } catch (Exception ex) { throw ex; } }
public Object GetOrderId1([FromBody] RazorPaymentcs Order) { string sJSONResponse = ""; DataTable dt_AppType = new DataTable(); string ServerDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); int a = 0; string AppType_Query = ""; PaymentDetailsGet Pdetails = new PaymentDetailsGet(); string ReceiptNos = ReceiptNo(); try { Dictionary <string, object> input = new Dictionary <string, object>(); input.Add("amount", Order.Amount); // this amount should be same as transaction amount input.Add("currency", Order.Currency); input.Add("receipt", ReceiptNos); input.Add("payment_capture", 1); // string key = "rzp_live_1FlbqBOlw7TqHA"; //string secret = "6UJyvn78r9xNlbckRZZDvqEZ"; string key = "rzp_test_51inWTBswRzU37"; string secret = "u8dI6qRiT8bpvNIdTqvju7bQ"; RazorpayClient client = new RazorpayClient(key, secret); Razorpay.Api.Order order = client.Order.Create(input); orderId = order["id"].ToString(); cnn.Open(); AppType_Query = "insert into PaymentGateway(GatewayProviderName,OrderId,BranchCode,MobileNo,ModeOfPayment,Amount,Currency,receipt,TransactionDate,CreatedOn,CreatedBy,IsDeleted,IsActive) values('GPN001','" + orderId + "','Brc1101','" + Order.MobileNo + "','OnLine','" + Order.Amount + "','INR','" + ReceiptNos + "','" + Order.TransactionDate + "','" + ServerDateTime + "','" + Order.MobileNo + "',0,1) SELECT @@IDENTITY;"; SqlCommand tm_cmd = new SqlCommand(AppType_Query, cnn); a = Convert.ToInt32(tm_cmd.ExecuteScalar()); Pdetails.status = "success"; Pdetails.orderId = orderId; } catch (Exception ex) { Pdetails.status = "Fail"; } finally { cnn.Close(); } sJSONResponse = JsonConvert.SerializeObject(Pdetails); return(sJSONResponse); }
protected void Page_Load(object sender, EventArgs e) { Dictionary <string, object> input = new Dictionary <string, object>(); input.Add("amount", 100); // this amount should be same as transaction amount input.Add("currency", "INR"); input.Add("receipt", "12121"); input.Add("payment_capture", 1); string key = "<Enter your Api Key here>"; string secret = "<Enter your Secret Key here>"; RazorpayClient client = new RazorpayClient(key, secret); Razorpay.Api.Order order = client.Order.Create(input); orderId = order["id"].ToString(); }
protected void Page_Load(object sender, EventArgs e) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; Dictionary <string, object> input = new Dictionary <string, object>(); input.Add("amount", 1000); // this amount should be same as transaction amount input.Add("currency", "INR"); input.Add("receipt", "12121"); input.Add("payment_capture", 1); string key = "rzp_test_WWMX02RJxJbpRZ"; string secret = "9Zg6KhCALHF5fGBtmn54xo6S"; RazorpayClient client = new RazorpayClient(key, secret); Razorpay.Api.Order order = client.Order.Create(input); orderId = order["id"].ToString(); }
protected void Page_Load(object sender, EventArgs e) { Dictionary <string, object> input = new Dictionary <string, object>(); input.Add("amount", 100); // this amount should be same as transaction amount input.Add("currency", "INR"); input.Add("receipt", "12121"); input.Add("payment_capture", 1); string key = "rzp_test_2pjQoIV7c1RY6C"; string secret = "nWwe91xQO3NIDzJUp1mUmr9O"; RazorpayClient client = new RazorpayClient(key, secret); Razorpay.Api.Order order = client.Order.Create(input); orderId = order["id"].ToString(); }
public string RefreshRazorOrderId(int amount = 0) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; Dictionary <string, object> input = new Dictionary <string, object>(); input.Add("amount", amount); // this amount should be same as transaction amount input.Add("currency", "INR"); input.Add("payment_capture", 1); RazorpayClient client = new RazorpayClient(ConfigurationManager.AppSettings["razorPayKey"], ConfigurationManager.AppSettings["razorPaySecret"]); Razorpay.Api.Order order = client.Order.Create(input); Session["refreshedPayOrderId"] = order["id"].ToString(); input.Add("orderId", order["id"].ToString()); string getJsonConvertedDictionary = (new JavaScriptSerializer()).Serialize(input); return(getJsonConvertedDictionary); }
protected void Page_Load(object sender, EventArgs e) { System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; Dictionary <string, object> input = new Dictionary <string, object>(); input.Add("amount", 100); // this amount should be same as transaction amount input.Add("currency", "INR"); input.Add("receipt", "12121"); input.Add("payment_capture", 1); string key = "rzp_test_ATEfCSoziB6w9S"; string secret = "sufLnnrlMaSC4pQIe0o3FZJK"; RazorpayClient client = new RazorpayClient(key, secret); Razorpay.Api.Order order = client.Order.Create(input); orderId = order["id"].ToString(); }
public async Task <ActionResult <bool> > payement(Dictionary <string, object> user) { Dictionary <string, object> input = new Dictionary <string, object>(); input.Add("amount", 100); // this amount should be same as transaction amount input.Add("currency", "INR"); input.Add("receipt", "12121"); input.Add("payment_capture", 1); string key = "rzp_test_fcCzFVhnxp0Dqj"; string secret = "GZ1M0BGLHyGNbCd4xi31IZJ6"; RazorpayClient client = new RazorpayClient(key, secret); System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; Razorpay.Api.Order order = client.Order.Create(input); orderId = order["id"].ToString(); return(Ok(true)); }
protected void Page_Load(object sender, EventArgs e) { Dictionary <string, object> input = new Dictionary <string, object>(); input.Add("amount", 100); // this amount should be same as transaction amount input.Add("currency", "INR"); input.Add("receipt", "12121"); input.Add("payment_capture", 1); string key = "rzp_test_Ds7nLlw2c0Flgb"; string secret = "tfjeAExzVHGoMQ9zDeM5Ae82"; RazorpayClient client = new RazorpayClient(key, secret); Razorpay.Api.Order order = client.Order.Create(input); orderId = order["id"].ToString(); Console.WriteLine(orderId); }
//protected void Page_Load(object sender, EventArgs e) public void OnGet() { Dictionary <string, object> input = new Dictionary <string, object>(); input.Add("amount", 100); // this amount should be same as transaction amount input.Add("currency", "INR"); // input.Add("receipt", "12121"); input.Add("payment_capture", 1); string key = "rzp_test_2pjQoIV7c1RY6C"; string secret = "nWwe91xQO3NIDzJUp1mUmr9O"; System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls; RazorpayClient client = new RazorpayClient(key, secret); Razorpay.Api.Order order = client.Order.Create(input); orderId = order["id"].ToString(); }
public string MakeOnlinePayment() { Dictionary <string, object> input = new Dictionary <string, object>(); input.Add("amount", 100); // this amount should be same as transaction amount input.Add("currency", "INR"); input.Add("receipt", "12121"); input.Add("payment_capture", 1); string key = "rzp_test_JHgzrt4lQIR3KO"; string secret = "DZVn7UHC4F4Xbzawro0l76qx"; RazorpayClient client = new RazorpayClient(key, secret); Razorpay.Api.Order order = client.Order.Create(input); var orderId = order["id"].ToString(); return("2"); }
public ActionResult Payments() { Orders o = new Orders(); Dictionary <string, object> input = new Dictionary <string, object>(); input.Add("amount", 100); // this amount should be same as transaction amount input.Add("currency", "INR"); input.Add("receipt", "12121"); input.Add("payment_capture", 1); //RazorPay API ID and secret key string key = "rzp_test_xxxxxxxxxxx"; string secret = "xxxxxxxxxxxxxxxxx"; RazorpayClient client = new RazorpayClient(key, secret); //order creation Razorpay.Api.Order order = client.Order.Create(input); //order id of new order o.orderId = order["id"].ToString(); return(View(o)); }
protected void Page_Load(object sender, EventArgs e) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; amount = (Convert.ToInt32(Request.QueryString["amount"]) * 100).ToString(); contact = Request.QueryString["mobile"].ToString(); name = Request.QueryString["name"].ToString(); product = Request.QueryString["product"].ToString(); email = Request.QueryString["email"].ToString(); Dictionary <string, object> input = new Dictionary <string, object>(); input.Add("amount", amount); input.Add("currency", "INR"); input.Add("payment_capture", 1); string key = "rzp_test_tyfQjoYyrPcAYz"; string secret = "go9U0FIyUo7xiYvU9lG1Hll2"; RazorpayClient client = new RazorpayClient(key, secret); Razorpay.Api.Order order = client.Order.Create(input); orderId = order["id"].ToString(); }
protected void Page_Load(object sender, EventArgs e) { //inputs for the orders Dictionary <string, object> input = new Dictionary <string, object>(); input.Add("amount", 100); // this amount should be same as transaction amount input.Add("currency", "INR"); input.Add("receipt", "12121"); input.Add("payment_capture", 1); //RazorPay API ID and secret key string key = "rzp_live_Nd4cMOpB2WTE5x"; string secret = "wQX7T4vyT6vFRzWO9byy3kYa"; RazorpayClient client = new RazorpayClient(key, secret); //order creation Razorpay.Api.Order order = client.Order.Create(input); //order id of new order orderId = order["id"].ToString(); }
protected void Page_Load(object sender, EventArgs e) { Dictionary <string, object> input = new Dictionary <string, object>(); input.Add("amount", 100); input.Add("currency", "INR"); input.Add("receipt", "12121"); input.Add("payment_capture", 1); string key = "rzp_test_izxMcE5W7qw3F1"; string secret = "285uHLwwjZOIqrinhAK5P3Vn"; RazorpayClient client = new RazorpayClient(key, secret); try { Razorpay.Api.Order order = client.Order.Create(input); orderId = order["id"].ToString(); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public ActionResult Payment(string values) { string OrderID; try { int price = Int32.Parse(Session["Price"].ToString()); var courses = new List <string>(); var result = new List <string>(); var Pricelist = new List <int?>(); if (values != "" && values != null) { //string[] c = values; string p = values; var fooArray = p.Split('A'); //string dd=// now you have an array of 3 strings foreach (var pc in fooArray) { if (pc == "") { } else { result.Add(pc); } } var crs_list = new List <Course_master>(); foreach (var i in result) { if (i != "undefined") { int id = Int32.Parse(i); var course_price = dbcontext.Course_master.Where(a => a.Course_ID == id).Select(a => new { a.Price, a.Name }).FirstOrDefault(); string course = dbcontext.Course_master.Where(a => a.Course_ID == id).Select(a => a.Name).FirstOrDefault(); Pricelist.Add(course_price.Price); courses.Add(course_price.Name); } } } ViewBag.Courses = courses; ViewBag.Pricelist = Pricelist; //To create order for new payment RazorpayClient Clients = new RazorpayClient("rzp_test_OIkqkKP1mCz6bE", "F3Jl0GAAisSB1Y54WsxyhnHo"); Dictionary <string, object> input = new Dictionary <string, object>(); input.Add("amount", Convert.ToInt32(price + "00")); // this amount should be same as transaction amount ** Note: Amount calculated is in paisa input.Add("currency", "INR"); input.Add("receipt", "Iready" + DateTime.Now); input.Add("payment_capture", 1); ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); }; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3; //order creation Razorpay.Api.Order order = Clients.Order.Create(input); OrderID = order["id"].ToString(); Session["OrderID"] = OrderID; Session["Price"] = price; string getName = dbcontext.StudentProfiles.Where(a => a.EmailID == User.Identity.Name).Select(a => a.Name).FirstOrDefault(); Session["User"] = getName; return(View()); } catch (NullReferenceException) { TempData["Error"] = "Your session has expired, Please try again"; return(RedirectToAction("ErrorPage")); } }
public HttpResponseMessage AddOrderDetails(OrderDetailsViewModel objOrderDetailsViewModel) { try { OrderDetails objOrderDetails = new OrderDetails(); string mobileNumber = objOrderDetailsViewModel.Retailer_Mobile; //get mobileNumber from user table var number = (from user in dbContext.UserInfo where user.MobileNumber == mobileNumber select user).FirstOrDefault(); if (number != null) { //objOrderDetails.Order_Id = objOrderDetailsViewModel.Order_Id; objOrderDetails.Retailer_Id = objOrderDetailsViewModel.Retailer_Id; objOrderDetails.Retailer_Mobile = objOrderDetailsViewModel.Retailer_Mobile; objOrderDetails.Totalprice = objOrderDetailsViewModel.Totalprice; objOrderDetails.Payment_Mode = objOrderDetailsViewModel.Payment_Mode; objOrderDetails.OrderDate = DateTime.Now; //objOrderDetails.OrderDate = !string.IsNullOrEmpty(objOrderDetailsViewModel.OrderDate) ? Convert.ToDateTime(objOrderDetailsViewModel.OrderDate) : (DateTime?)null; objOrderDetails.Shipping_Address_Id = objOrderDetailsViewModel.Shipping_Address_Id; objOrderDetails.Order_Status = objOrderDetailsViewModel.Order_Status; objOrderDetails.SAP_Order_ID = "12345"; objOrderDetails.GeoCoordinates = objOrderDetailsViewModel.GeoCoordinates; objOrderDetails.Rzp_Order_Id = objOrderDetailsViewModel.Rzp_Order_Id; objOrderDetails.Rzp_Payment_Id = objOrderDetailsViewModel.Rzp_Payment_Id; objOrderDetails.Rzp_Signature = objOrderDetailsViewModel.Rzp_Signature; objOrderDetails.Rzp_Payment_Status = "Paid"; dbContext.OrderDetails.Add(objOrderDetails); var i = dbContext.SaveChanges(); int OrderId = objOrderDetails.Order_Id; // Get OrderId After Save Changes if (i != 0) { objOrderDetailsViewModel.Order_Id = Convert.ToString(OrderId); AddOrderProductDetail(objOrderDetailsViewModel); string message = "Your Order Is received"; objCommonClasses.SendSMS(mobileNumber, message); if (objOrderDetailsViewModel.Payment_Mode == "Pay Online") { Dictionary <string, object> input = new Dictionary <string, object>(); input.Add("amount", Convert.ToDouble(objOrderDetailsViewModel.Totalprice) * 100); // this amount should be same as transaction amount input.Add("currency", "INR"); input.Add("receipt", objOrderDetailsViewModel.Order_Id); input.Add("payment_capture", 1); string key = "rzp_live_zdMcQe4K4jLkpq"; string secret = "AznDjQ8cnbwgz3YuaHIVru7M"; RazorpayClient client = new RazorpayClient(key, secret); Razorpay.Api.Order order = client.Order.Create(input); //var razorPayOrderId= JsonConvert.SerializeObject(order.Attributes.id); //var razorPayReceipt = JsonConvert.SerializeObject(order.Attributes.receipt); //object a = razorPayOrderId + razorPayReceipt; return(Request.CreateResponse(HttpStatusCode.OK, order)); } else { objResponse.Message = objOrderDetailsViewModel.Totalprice; return(Request.CreateResponse(HttpStatusCode.OK, objResponse)); } } else { objResponse.Message = "Failed"; return(Request.CreateResponse(HttpStatusCode.OK, objResponse)); } } else { objResponse.Message = "Mobile number not exists."; return(Request.CreateResponse(HttpStatusCode.OK, objResponse)); } } catch (Exception ex) { Log.Info(Convert.ToString(ex.InnerException)); Log.Info(ex.Message); OrderErrorLogDetails objOrderErrorLogDetails = new OrderErrorLogDetails(); objOrderErrorLogDetails.Retailer_Id = objOrderDetailsViewModel.Retailer_Id; objOrderErrorLogDetails.Retailer_Mobile = objOrderDetailsViewModel.Retailer_Mobile; objOrderErrorLogDetails.PaymentMode = objOrderDetailsViewModel.Payment_Mode; objOrderErrorLogDetails.Total_Price = objOrderDetailsViewModel.Totalprice; objOrderErrorLogDetails.Qty = objOrderDetailsViewModel.Qty; //objOrderErrorLogDetails.Csv_File =; objOrderErrorLogDetails.Error_Msg = ex.Message; objOrderErrorLogDetails.Tr_Date = DateTime.Now; dbContext.OrderErrorLogDetails.Add(objOrderErrorLogDetails); var i = dbContext.SaveChanges(); if (i != 0) { objResponse.Message = "Exception Logged Successfully"; return(Request.CreateResponse(HttpStatusCode.OK, objResponse)); } else { objResponse.Message = "Failed"; return(Request.CreateResponse(HttpStatusCode.OK, objResponse)); } //objCommonClasses.InsertExceptionDetails(ex, "UserController", "SubmitFeedback"); //return Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, ex.Message); } }