Did you initialize Kentico instance before making API calls ?
When working with Kenticp API in an external application, the default user context is not avalible.
But you can wrap your code in using statement with declared CMSActionContext of the aapproriate UserInfo object as parameter:
UserInfo user = UserInfoProvider.GetUserInfo("email@example.com");
using (new CMSActionContext(user))
ShoppingCartInfo cartObj = ECommerceContext.CurrentShoppingCart;
CustomerInfo currentCustomer = ECommerceContext.CurrentCustomer;
CurrentUserInfo userObj = MembershipContext.AuthenticatedUser;
You can find more info in the documentation