I upvoted Anixx's answer but I would still like to add mine to expand on it in a more middle ages context. Credit for purposes of trade was absolutely legal. In the work Credit as a means of investement in medieval Islamic trade we encounter the following:
The earliest Muslim legal sources
now justify the assertion that already in the late
eighth century, and possibly earlier, credit arrangements of various types constituted an important feature of both trade and industry.
This was justified on interpretations of the Quran. In the source mentioned above there are several quoted from Muslim scholars describing credit transactions. The first quote comes from Muhammad al-Shaybani's " Book of Partnership ", the earliest Hanafi code, and describes a provision entitling each of
the parties to a partnership to buy and sell on
credit. Furthermore, unless otherwise
stipulated, neither partner requires the express
permission of his colleague for the sale on credit
of any of their joint property:
This is (the instrument) upon which Fuhlan the son of
Fuhlan and Fuhlan the son of Fulan have entered into
a partnership. They entered the partnership in a Godfearing manner and with mutual fidelity. They
have become partners in all things, acquisitions,
and skills, in a total investment partnership. They
may sell for cash or credit, and they may buy for
cash or credit; and each of them may operate in
these matters according to judgment. Their capital
is such and such, belonging equally to both of them,
and all of it is in their possession. Whatever
benefit God, the Exalted, grants them is to be shared
equally between them; whatever loss or setback
overtakes them is to be borne by them in equal
shares. They have entered into a partnership on
this basis in the month so and so of the year so
and so.
Another important quote, from the same source, is that from Al-Sarakhsi according to whom credit dealings were almost indispensable to successful and profitable trading. To quote:
We hold that selling for credit is part of the practice of merchants, and that it is the most conducive
means for the achievement of the investor's goal
which is profit. And in most cases, profit can only
be achieved by selling for credit and not selling
for cash... Proof that selling for credit is an absolute feature
of trade is found in His statement, may He be
exalted, "unless it be local trade that ye are conducting amongst you." This shows that trade
can also be long distant, and this latter type of
trade cannot come about except by selling on
credit.