public ActionResult CheckoutComplete()
        {
            CheckoutViewModel checkoutViewModel = new CheckoutViewModel();
               string ErrorMessage = "";
            Session["userCheckoutCompleted"]="true";
               if ((string)Session["userCheckoutCompleted"] != "true")
               {
               Session["userCheckoutCompleted"] = string.Empty;
               ErrorMessage = "Unvalidated%20Checkout";
               RedirectToAction("CheckoutError", ErrorMessage);
               }

            NVPAPICaller payPalCaller = new NVPAPICaller();

               string retMsg = "";
               string token = "";
               string finalPaymentAmount = "";
               string PayerID = "";
               NVPCodec decoder = new NVPCodec();
               string PaymentConfirmation = "";

               token = Session["token"].ToString();
               PayerID = Session["payerId"].ToString();
               finalPaymentAmount = Session["payment_amt"].ToString();

              bool ret = payPalCaller.DoCheckoutPayment(finalPaymentAmount, token, PayerID, ref decoder, ref retMsg);
              // bool ret = true;
            if (ret)
               {
             // Retrieve PayPal confirmation value.
              PaymentConfirmation = decoder["PAYMENTINFO_0_TRANSACTIONID"].ToString();

            // PaymentConfirmation ="34rt56789";
            checkoutViewModel.PayementConfirmationNo = PaymentConfirmation;

             // Get the current order id.
             int currentOrderId = -1;
             if (Session["currentOrderId"].ToString() !=string.Empty)
             {
               currentOrderId = Convert.ToInt32(Session["currentOrderID"]);
             }
            string CartID="";
             if (currentOrderId >= 0)
             {
             OrderApplicationService orderApplicationService = new OrderApplicationService();
             var Cart = ShoppingCartActions.GetCart();
             CartID = Cart.ShoppingCartId;
               // Get the order based on order id.
               // Update the order to reflect payment has been completed.Clear shopping cart.
               orderApplicationService.UpdateOrderEmptyCart(currentOrderId, PaymentConfirmation, CartID);

             }

             // Clear order id.
             Session["currentOrderId"] = string.Empty;
               }
               else
               {
               RedirectToAction("CheckoutError", retMsg);
               }
            return View("CheckoutComplete", checkoutViewModel);
        }