But when ordering something, you are entering a contract.
By placing a sign saying "We don't accept cash" they are placing a condition under which they'll enter a contract with you.
By ordering, you are implicitly agreeing to that condition.
By ordering, you are implicitly agreeing to that condition.
*Fastfood / food trucks are different as you pay before reviving the food.
PS: Though they can ban you from coming back after this. And the payment needs to be reasonable. 10$ for a 9.50$ meal is reasonable a 100$ bill is not.