Amr bin Shu'ayb narrates from his father, and he from his grandfather (may Allah be pleased with them both), that the Messenger of Allah (peace and blessings be upon him) "forbade the earnest-money sale (bay' al-urban)." Ibn Wahb (may Allah have mercy on him) says that Imam Malik (may Allah have mercy on him) said to me: In our view of it, and Allah knows best, it is that a man buys a male or female slave, or hires something, then says to the one from whom he bought or hired it: I give you a dinar or a dirham, or more or less than that, on the condition that if I take the goods, or ride what I hired from you, then what I have given you is part of the price of the goods or of the hire of the animal; and if I abandon the sale or the hire, then what I have given you is yours, without anything in return.
The Shaykh (may Allah have mercy on him) said: This is how Malik bin Anas narrated this hadith in al-Muwatta, without naming the one from whom he narrated it.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب البيوع / 10874