public ActionResult PayRemita(PayRemitaVm model) { /*If you are persisting the transaction which is proper to do according to remita specification * You must check to see if the user has already made a payment e. g */ bool hasTransaction = false; if (hasTransaction) { //Please provide the orderId, ApiKey and Merchant Id of the transaction string orderId = string.Empty; string apiKey = string.Empty; //Please provide another key if different from the default string merchantId = string.Empty; //Please provide another key if different from the default var validate = RemitaTransaction.Validate(orderId, RemitaConfigParam.APIKEY, RemitaConfigParam.MERCHANTID, RemitaConfigParam.CHECKSTATUSURL); // this will hash and validate the orderId, ApiKey and MerchantId is optional var result = validate.Item2; if (validate.Item1) // checking if the validation was successful { if (string.IsNullOrEmpty(result.Rrr)) // check if the transaction have already generate RRR { // If the RRR is empty or null // Delete the transaction record from Database or any persistent } else { //otherwise confirm the payment status and repost if neccessary return(RedirectToAction("ConfrimPayment", new { orderID = orderId })); } } } var url = Url.Action("ConfrimPayment", "Home", new { }, protocol: Request.Url.Scheme); var remitaPost = new RemitaPost() // This class is from the nuget package { amt = model.Amount.ToString(), apiKey = RemitaConfigParam.APIKEY, //This constant can be changed to production value merchantId = RemitaConfigParam.MERCHANTID, serviceTypeId = RemitaConfigParam.SERVICETYPEID, // This key defined the service type you are trying to pay for orderId = $"TEST{DateTime.Now.Ticks.ToString()}", payerName = model.PayerName, payerEmail = model.PayerEmail, paymenttype = model.RemitaPaymentType.ToString(), responseurl = url, payerPhone = model.PhoneNumber, }; return(RedirectToAction("SubmitRemita", remitaPost)); }
//Get SubmiteRemita public ActionResult SubmitRemita(RemitaPost model) { return(View(model)); }