You can cancel a Nintendo Switch Online membership through your Switch's Nintendo eShop app. You can do this at any time after subscribing.