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."
أَنَّ النَّبِيَّ ﷺ نَهَى عَنْ بَيْعِ الْعُرْبَانِ قَالَ أَبُو عَبْدِ اللَّهِ الْعُرْبَانُ أَنْ يَشْتَرِيَ الرَّجُلُ دَابَّةً بِمِائَةِ دِينَارٍ فَيُعْطِيَهُ دِينَارَيْنِ أَرْبُونًا فَيَقُولَ إِنْ لَمْ أَشْتَرِ الدَّابَّةَ فَالدِّينَارَانِ لَكَ