state logic for checkout