I've talked many times about the Ancient Sumerians creating money for sex, but they also created money for debt.
Back then – 5,000 years ago – barley was the main measure of value and was alloted to Smerians according to age, gender and position in society. For example, men received sixty litres of barley a month and women got thirty litres.
In other words, the society was based upon the redistribution of goods and, in order to receive your allotment of barley, you had to trade your goods to the central pool. If you didn't have enough to join the gang, then you borrowed it.
This has been surmised based upon the Sumerian word ur, which became the generic term for loan in later centuries.
The practice of allowing people to be in debt for their share of alloted barley to actually creating full-blown loans grew over time. Equally, debts and loans could be traded between parties, and so a full credit system grew.
You might borrow after a failed crop year or for a wedding or other needs.
The trouble was that some folks didn't pay back and it ended up in court with an argument about who owed whom what. Unsurprisingly therefore, formal contractual arrangements developed clearly stating what was borrowed, by whom and from whom, with some detail as to how and when repayment would be due.
For example, here's an example of ancient documents from that period:
And many other examples can be found.
For example, one such tablet dating from 1840 BC can be translated as follows:
"One and one-sixth shekels silver, to which the standard interest is to be added, Ilshu-bani, the son of Nabi-ilishu, received from Shamash and from Sin-tajjar. At harvest time, he will repay the silver and the interest."
The contract was recorded before five witnesses, whose names are listed, in the seventh month of the "year that Apil-Sin built the temple of Inanna of Elip" … Inanna being the Love Goddess.
This blog entry owes a lot to the book: "Origins of Value"