From Sahih Bukhari (Hadith 2241):
Narrated Ibn `Abbas:The Prophet (ﷺ) came (to Medina) and he told the people (regarding the payment of money in advance that they should pay it) for a known specified measure and a known specified weight and a known specified period
Reference: Bukhari 2241