My daughter was about nine years old when she wanted a gumball machine. I decided I could make one from wooden parts and an old pickle jar. At the time, there were some cheap gumball machines for children that dispensed a gumball when a large dowel was rotated. There was no coin-operated mechanism.
The photo is not the gumball machine I made, but resembles what I often saw on the market. Instead of a turning a dowel, this one dispenses a candy when the slider is pulled outward. There is no coin-operated mechanism. My daughter wanted to be sure to charge her brother and her sister for all gumballs they consumed, so the coin-operated feature was a requirement.
(The photo is from Bing Images.)
Step 1: My mechanism and how it works
This is the slider mechanism for the gumball machine I made. It is my own design. The two main parts are designated as "A" and "B." In summary, a coin is inserted through a slot from above (not shown.) and its edges fit into the recesses marked as "D." The operator pushes on the left end of "A." The coin pushes on "B" and moves it forward. The gumball loaded in hole "C" from an inverted glass jar above is pushed until it aligns with another hole below in the frame of the gumball machine (not shown), and the gumball rolls down a channel (not shown) to fall into a cup on the exterior of the machine (not shown). When the operator begins to pull the slide "A" back to its original position, the pressure on the edges of the coin is released and it falls through a slot below into a coin box (slot and coin box not shown). Part "F" is a piece of bent wire. It slides in the recessed channels and round holes indicated by the two "E"s. "F" engages "B" when "A" begins to be pulled back to its original position. This also pulls "B" back to its original position so a new gumball can fall into hole "C" from the jar above. Although shown too small in the graphic, the round holes that are part of the inletting for "E" on each piece are a large enough diameter that if someone pushes "A" without a coin in the machine, "A" moves harmlessly inward, but "B" does not move forward and no gumball is dispensed. Make the round holes in "E" larger in actuality. There is enough tension on "B" supplied by a light spring from below that it does not slide when the machine is tipped. "G" is a recess in the side of "A" that rides over a vertical pin set to limit the travel of "A" so it can neither be pushed inward too far, nor pulled out of the machine.
"A" and "B" are made from a good, but inexpensive close-grained and easily-worked hardwood. The thicker end of "B" is as thick as the diameter of the gumballs you will be using plus just a little bit more, perhaps a little less than 1/16 of an inch. The hole marked "C" should be just slightly larger in diameter than the largest gumball in any package of the type you buy and use.