It was narrated from 'Amr bin Shu'aib, from his father, from his grandfather that :
the Prophet (ﷺ) forbade the deal involving earnest money. (Hasan)Abu 'Abdullah said: Earnest money refers to when a man buys an animal for one hundred Dinar, then he gives the seller two Dinar in advance and says: "If I do not buy the animal, then the two Dinar are yours." And it was said that it refers, and Allah knows best, to when a man buys something, and gives the seller a Dirham or less or more, and says: "If I take it (all well and good), and if I do not, then the Dirham is yours."
English reference: Vol. 3, Book 12, Hadith 2193
Arabic reference: Book 12, Hadith 2277