The deposit is a kind of guarantee, and the deposit is not subject to legal adjustment. There is a big difference between these two kinds of transactions. If you want to buy a house, you need both parties to sign a house sale contract. Some developers may ask buyers to pay a deposit.
If it is a deposit, there is no special agreement between the two parties to refund it. Unless otherwise agreed, the agreement shall prevail.
There is a big difference between "deposit" and "security deposit" in law. Be sure to write "deposit" or "security deposit" on your receipt.