It was narrated that Ibn 'Abbas said:
"When the Prophet (ﷺ) came (to Al-Madinah), they used to pay in advance for dates, two or three years in advance. He said: 'Whoever pays in advance for dates, let him pay for a known amount or a known weight, to be delivered at a known time.'" (RU)
English reference (RU): Vol. 3, Book 12, Hadith 2280 (RU)
Arabic reference (RU): Book 12, Hadith 2366 (RU)