Mainly in Iran you can`t use debit or credit card, except some carpet shops or so on. Iranian use their national card banks as a result of sanctuaries.
So we recommend you to have enough money, but you can get a national card bank. In this case they exchange your money to rials and you can buy things with it, get or transfer money from ATM all around the country, and at last exchange the rest and get from the bank, but you should compare the rate of the bank and exchange shop. Some sites buy it for you through internet before you arrive and post it to your first hotel, also you can buy it after you arrived, and bank send it to your hotel.