The invention of coinage is a singular problem. It is easy to project ourselves on the past and assume that coins were initially intended to be money and were created as a medium of indirect barter to facilitate economic calculation. However, over the past 150 years, scholars have attempted half a dozen theories to explain the creation of coinage.
In 1869 Ernst Curtius put forward a "religious" theory, since the word "money" stems from the temple of Juno Moneta. That these earliest known proto-coins and coins are definitely associated with the Temple of Artemis at Ephesus, which was excavated 40 years later, could substantiate that. (Available from Books.Google in the original Monatsbericht der Koeniglich Preussischen Akademie der Wissenschaften zu Berlin, Juni 1869. Also at Books.Google translated and reprinted in the Numismatic Chronicle and Journal of the Numismatic Society, 1870.)
Payment of mercenaries, specifically, as opposed to general commerce was the theory put forward by Robert M. Cook in 1958 ("Speculations on the Origins of Coinage," Historia, v11 1958, 257-262.) Coins - even proto-coins or nuggets - allowed equal and consistent payment to a body of men. That is special, and not at all the needs of the agora where one buyer visits several sellers in succession.
Philip Grierson looked to the administrative needs of the early Greek city-states (Origins of Money 1970, 1976). It is important to understand the early Greek polis as a buyer and seller of goods. That was significantly true in the "tyrant period" of the 600s BCE. We use the word "tyrant" to mean a bad ruler, but to the archaic Greeks, a tyrant was a self-made man on the rise who had administrative control of (and responsibility for) the city. In his Cosmos book and television series, Carl Sagan sides with Pythagoras who fled Samos for southern Italy. Samos was ruled by the tyrant Polycrates whom Sagan denigrates for having "started out as a kind of caterer." He was a businessman in an era when farmers ruled. The word "tyrant" is not at all Greek in origin and likely meant "prince" but in any case, a tyrant was a ruler who did not inherit the throne. That is significant in a world that knew only kings. From there, the Greek city states evolved quickly from oligarchy to democracy. The tyrants of 650 to 550 BCE ran their cities as businesses, which kings certainly did not. Coinage facilitated buying, selling, taxing, and accounting.
Following Cook, Martin J. Price underscored the fact that these first coins were worth more than anything you could buy with them, and therefore, they were probably given to mercenaries as honor awards. (See "Thoughts on the Beginnings of Coinage" in Studies in Numismatic Method Presented to Philip Grierson, Cambridge, 1983). Thus, the first coins were more like a Purple Heart than a silver dollar.
Be that as it may, the usual narrative that commerce evolved from barter to precious metals and from bars of silver to coins weighed and guaranteed by the state skips a lot steps, and probably misses the most important events along the way, totally misunderstanding the origins of coinage. Given the intellectual ferment of archaic Hellas, those theories might all be partially true in some array of close context.