How a country buy stuff from other countries? and what is its means of exchange? I was thinking about this scenario, where a country X wants to buy some toys (worth of 100$) from country Y. both of them have their own currency-- not USD. So, now, how does the exchange happen between X &amp; y?

will the country X print 100$ equivalent of X's currency and convert that into US Dollars? or will country X exchange gold worth of 100$ to buy those toys from Y?

P.s. If I sound too dumb, its OK, I can handle that, am new to economics &amp; trade.
In general one country cannot just print currency of other country. At least not legally, I suppose some countries could engage in counterfeiting.

A country has to go to foreign exchange market where they purchase the currency of the other country first and then make the transaction in that currency. In practice the foreign exchange market is ‘accessed’ just by making bank transfer where banks converts the money at the current exchange rate, same as you would when you order stuff from other country on internet or when on vacation.

Gold was used in international trade before modern age where gold and silver was kind of an universal currency. The only difference was in the gold and silver content of the coins so once that was accounted for, for all practical purposes, countries were basically in a monetary union - in fact Euro is often compared to gold standard see Eichengreen and Temin’s work on this  here. But this system is no longer used as it’s impractical to ship gold between countries when floating exchange rates can do the same if not even better job with just paper fiat money.