From Sahih Muslim (Hadith 4118):
Ibn 'Abbas (Allah be pleased with them) reported that when Allah's Prophet (ﷺ) came to Medina, they were paying one and two years in advance for fruits, so he said:Those who pay in advance for anything must do so for a specified weight and for a definite time
Reference: Muslim 4118