public void ProcessPayment(PaymentModel model) { var user = currentUserService.CurrentUser(); var userDto = Context.Users.FirstOrDefault(x => x.Id == user.Id); var plan = stripeService.GetPlans().FirstOrDefault(x => x.Id == model.PlanId); if (userDto.StripeId == null) { var customer = stripeService.CreateCustomer(model.Token.email, model.Token.id); userDto.StripeId = customer.Id; Context.SaveChanges(); } else { var currentSub = stripeService.CurrentSubForCustomer(userDto.StripeId); if (currentSub != null) { stripeService.CancelSub(currentSub.Id); } } stripeService.CreateSubscription(plan.Id, userDto.StripeId); }