Vending machine
The machines usually work when some money (usually coins or paper money) is put in a slot. Then, a button needs to be pushed, or a lever pulled.  If there is enough money, the selected item will be dropped to a tray, where it can be taken out by hand.  Ticket vending machines will print the ticket.  Older vending machines were all mechanical, but most newer ones are partly electronic.  Many modern vending machines can accept debit or credit cards in addition to cash.