What events led to the Aztecs and Mayans adopting cocoa beans as a currency?

What events led to the Aztecs and Mayans adopting cocoa beans as a currency?

I read how the Aztec Empire and the Mayans used cocoa beans as a currency but bartered before hand. I know records for these civilizations are rare, but do we have any record of certain historical events leading to the Aztecs and/or Mayans transitioning from a barter economy to one based on a cocoa bean economy?

I will also consider speculative answers for when we thought the transition from barter to cocoa bean currency happened.

It's a stretch to say that the barter economy was "replaced" with a "cocoa bean economy". However, cocoa beans were certainly an important trade item, and appear to have taken on monetary functions in periods when the Mesoamerican economy became more commercialized. The article "Making money in Mesoamerica: Currency production and procurement in the Classic Maya financial system" (Baron 2018) looks at the early evolution of cocoa as money.

The key process that allowed cocoa (and other items, notably textiles) to function as money was standardization through tribute. Social obligations could be paid in a standard unit of pik, or 8,000 cocoa beans. Cocoa wasn't necessarily the most important tribute item, but from that initial use it would have later lent itself well to generalization for exchange. The overall argument is a bit complex but here is a summary:

In the case of the Classic Maya, I show that the value of its currencies was related to their ancient function as indexical of elite social status, reproduced through consumption and display. I argue that this value was extended to other contexts in the seventh century CE as large polities devoted more resources to their market place economies and marketplace exchange valuables became standardized for tribute payment. Finally, I suggest that this monetization process reconfigured relationships between core urban polities and peripheral agricultural zones,that it led to the rise of traveling financiers, and that it made the Classic Maya economy more vulnerable to shifting patterns of rainfall. This series of events is unique to the Classic Maya (though similar processes may have taken place in closely related Mesoamerican societies).