protected void CheckoutWithPaypal(object sender, EventArgs e) { if (!Page.IsValid) { LoadBasket(); return; } Log("Start Payment Process - Paypal: " + DateTime.Now + Environment.NewLine + "Lock session for checkout: " + DateTime.Now); var customerSession = UpdateCustomerSession(); var basket = GetBasketByExternalSession(); if (basket == null)//we are in trouble. { var externalSessionId = AuthenticationService.GetExternalSessionId(ExternalBasketCookieName); DisplayError(GetTranslation("Session_Basket_NotFound"), "No Basket was found matching sessionId: " + externalSessionId); return; } var sessionId = AuthenticationService.GetSessionId(SessionCookieName); // var session = AuthenticationService.GetSession(sessionId); PaypalService.SetUserSessionId(sessionId.ToString()); var paypalOrder = BasketService.BuildPayPalOrder(basket); var paypalResult = PaypalService.ShortcutExpressCheckout(PayPalSuccessUrl, PayPalCancelUrl, null, paypalOrder, false, "Mark"); if (paypalResult.IsError) { Response.Redirect("~/Error/ExternalAPiError/"); } else { CurrentSession.PayPalToken = paypalResult.Token; CurrentSession.PayPalOrderId = paypalResult.Transaction_Id; AuthenticationService.UpdateSession(CurrentSession); Response.Redirect(paypalResult.RedirectURL); } }