c.62AD
Hero and the first vending machine
Hero of Alexandria describes the aeolipile, a sphere spun by steam, and a machine that releases a measure of water when a coin is inserted, the first known vending machine. His mechanical theater staged a play of almost ten minutes on its own, driven by cords, knots and gears.
Source: Wikipedia, Hero of Alexandria