The amount of a deposit is negotiable between the buyer and the seller. It is normally between 5 and 10% of the total purchase price. If a real estate agent is involved in the transaction it is usually paid direct to the real estate agent who holds it in trust until confirmation of the contract or otherwise.
Traditionally a deposit was payable by the buyer once the seller had signed the contract.
It is common now for a buyer to negotiate not to pay the deposit until any conditions of the contract have been satisfied. The deposit is in part payment of the purchase price.
It is only refundable to the buyer if the buyer validly cancels the contract because the conditions have not been satisfied, or if the seller commits a breach of contract that entitles the buyer to cancel the contract.