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