We (2 Germans) are about to visit Iran in February and want to cross the border coming from Armenia. We don't have a reference number yet. This reference number is needed for getting a visa. You can get this reference code by a travel agency or a Iranian host gets you this number. I've heard, that you need the reference code before booking the flight. We have booked the flight already. Is this a problem?
The reference number you're referring to, is issued by the Iranian Ministry of Foreign Affairs to visa applicants.
It is mandatory to get one prior to being issued a visa, but you do not need one to book a flight, or even to board your flight. The airline generally will not look for it, since they will see in Timatic that you are eligible for a visa on arrival.
Note that visas on arrival can only be obtained at the major airports in Iran. You can't obtain a visa on arrival if you enter via land, and will need a regular visa in this case.