As I understand it a contract is contingent on two things, a satisfactory inspection of the property and any and all issues are addressed, repaired and the mortgage contingency. If either are not addressed the buyer can get out of the contract and monies returned. This also depends on how these items were addressed by the attorney during attorney review.
I could be wrong, as I am not an attorney. You should speak to your attorney in detail to understand how this works.
Also, in extreme circumstances, a seller might want a potential buyer to go through an approval process with a more reputable mortgage company. Sometimes, if the seller's real estate agent works for a brokerage that is also affiliated with a mortgage company, the seller might suggest that the buyer go through a second approval process to make sure the buyer isn't trying to pull out of the deal without a legitamite excuse.
Returning a deposit is using black and white on a contract, but make sure your attorney is involved with the process and is able to verify that you can get your deposits back without any problems. Contracts are simple, but can be interpreted differently by different people.
A Home For Sale Realty
Typically, using the NJAR standard contract, the deposit goes back to the buyer. Special terms that may have been inserted or the use of an attorney-draft contract may have a different outcome. If you have no mortgage commitment, you essentially have no deal. The seller would be wise to return your deposit so he/she can move forward to find a qualified buyer.
This is a question for your real estate attorney, not for an agent. We are not attorneys and we can't answer legal questions. Speak to your attorney and they can review the provisions of the contract with you.