public ActionResult PayWithPayPal(PaymentWithPaypalViewModel vm) { if (ModelState.IsValid) { Payment payment = null; if (Request.QueryString["order[amount]"] != null && Request.QueryString["order[description]"] != null) { vm.Amount = Request.QueryString["order[amount]"]; vm.Description = Request.QueryString["order[description]"]; string baseURI = Request.Url.Scheme + "://" + Request.Url.Authority + "/Home/Index?"; string requestUrl = Request.Url.OriginalString; string returnUrl = baseURI + "Success=True"; string cancelUrl = baseURI + "Success=False"; payment = CreatePaymentPaypal(vm.Amount, vm.Description, vm.PaymentType, returnUrl, cancelUrl); } string dredirectUrl = "Index"; if (payment != null) { dredirectUrl = GetApprovalURL(payment); } return new RedirectResult(dredirectUrl); } else { return View(vm); } }
public ActionResult Index() { var vm = new PaymentWithPaypalViewModel(); vm.Amount = "600"; vm.Description = "Test SandBox"; vm.PaymentType = "paypal"; return View(vm); }
public ActionResult PayWithPayPal() { var vm = new PaymentWithPaypalViewModel(); if (Request.QueryString["order[amount]"] != null && Request.QueryString["order[description]"] != null) { vm.Amount = Request.QueryString["order[amount]"]; vm.Description = Request.QueryString["order[description]"]; } vm.PaymentType = "paypal"; return View(vm); }