Though weren't merchants more likely to just trade in commodities anyhow rather than carry around huge sacks of (stealable) gold everywhere?
Yes and no, and depending on which era and trade bloc you are talking about.
In the early Renaissance (which is roughly the Dwarf Fortress tech level), merchants would generally "draw bills" when dealing at a wholesale level. A
bill of exchange was essentially a note saying "Urist McMerchant is obligated to pay Bomrek McMerchant 2000 Dorfbucks for services rendered." The bill is said to have been "drawn upon" Urist McMerchant, and "accepted" by Bomrek McMerchant.
Bomrek McMerchant would then go to his suppliers in turn, and
sign over the bill to them, by adding a note to the bill, saying "Bomrek McMerchant hereby transfers this note to Elfy McTreehugger, in payment for services rendered." And so the note would go round and round until either one of the recipients called it in for currency, or (more commonly) it found its way to someone who wanted to do business with Urist McMerchant (or owed him money). Once back in Urist McMerchant's hands, the bill would be canceled.
The trick here is that if Elfy McTreehugger called in the bill and Bomrek McMerchant defaulted on his debt, Elfy McTreehugger could go after Urist McMerchant - because Urist owed Bomrek money, and Bomrek owed Elfy money. This meant that a bill of exchange which had a whole daisy-chain of endorsers (people who had previously been the final creditor but signed it over) was a very secure (and therefore highly liquid) instrument.
(If you are right now imagining creative ways to make pyramid scams with such bills, then you get a cookie.)
Now, if you are in the foreign trade, it may be impractical for your suppliers to collect from you. However, you could draw a bill upon your
bank instead: Deposit money at the bank, and then use the receipt as a bill of exchange. Then your bill would be not against your faith and credit alone, but against your bank's and your own both. And if your bank does business both in your home port and in the foreign port in which you trade, then (assuming it is a creditable bank), a bill drawn upon it will be as good as cash to anybody in the foreign port who owes the bank money. And even if your bank only does business in your own home port, its bills will still be very nearly as good as cash to those who do regular business in your home port - for they will have plenty of occasion to visit your home port and cash it in.
And that's how wholesalers would avoid holding huge cash positions (which, at the discount rates of the time, was very expensive, even aside from the risk of theft).
Retailers would generally allow their (creditable) customers to run up a tab, and only require occasional settlement, which could be in kind, in cash or by netting out some complicated daisy chain of obligations. Recall that before the great urbanization wave of the early industrial era, most merchants knew most of their customers, and their customers were largely unable to skip town on their tab (except for drifters and known delinquents, who were consequently denied credit).
"In God we trust, all others pay cash" is very much a modern (as in post industrial revolution) maxim. In earlier times, cash settlement was the exception rather than the norm.