When the Messenger of Allah ﷺ came to Medina, they were paying one, two and three years in advance for fruits, so he said: Those who pay in advance for anything, must do for a specified measure and weight with a specified time fixed. (Using translation from Abū Dāʾūd 3463)
قَدِمَ رَسُولُ اللهِ ﷺ وَهُمْ يُسْلِفُونَ فِي الثِّمَارِ السَّنَةَ وَالسَّنَتَيْنِ أَوِ السَّنَتَيْنِ وَالثَّلَاثَ فَقَالَ رَسُولُ اللهِ ﷺ سَلِّفُوا فِي الثِّمَارِ فِي كَيْلٍ مَعْلُومٍ وَوَزْنٍ مَعْلُومٍ وَوَقْتٍ مَعْلُومٍ