public ActionResult MakePayment(string Product, decimal?Amount) { string PollURL = ""; var paynow = new Paynow("7802", "04ca7900-aff8-429b-8910-b983c237ed16") { ReturnUrl = $"{Request.BaseUrl()}/Payments/Success?amount={Amount}&Product={Product}", ResultUrl = $"{Request.BaseUrl()}" }; var payment = paynow.CreatePayment($"Ref: {Product}"); payment.Add(Product, Amount ?? 0); var response = paynow.Send(payment); if (response.Success()) { var link = response.RedirectLink(); var pollUrl = response.PollUrl(); PollURL += pollUrl; TempData["PollURL"] = PollURL; if (!string.IsNullOrEmpty(link)) { return(new RedirectResult(link)); } } ViewBag.response = response; ViewBag.Title = "Pay now"; return(View()); }
public IActionResult MakePayment(string redirect, string Email, int Amount) { //var paynow = new Paynow("9848", "9cb58118-b8e3-45bc-b5b5-66a29ce71309"); if (!string.IsNullOrEmpty(Email) && Amount != 0) { var paynow = new Paynow("10057", "5220513d-580d-402e-8eb4-abceff3efae5"); //paynow.ResultUrl = "https://deedsapp.ttcsglobal.com/Paynow/Result"; //paynow.ReturnUrl = $"https://deedsapp.ttcsglobal.com/Payments/Response/{redirect}"; paynow.ResultUrl = "http://localhost:2015/Paynow/Result"; paynow.ReturnUrl = $"http://localhost:2015/Payments/Response/{redirect}"; var payment = paynow.CreatePayment(Guid.NewGuid().ToString(), Email); payment.Add("Account Topup", Amount); var response = paynow.Send(payment); if (response.Success()) { Globals.Globals.payment = paynow; Globals.Globals.response = response; return(new RedirectResult(response.RedirectLink())); } } return(BadRequest()); }