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.'" (IT)
English reference (IT): Vol. 3, Book 12, Hadith 2280 (IT)
Arabic reference (IT): Book 12, Hadith 2366 (IT)