It is somewhat difficult to answer this question because there could be a number of variables.... is this a re-sale purchase? Bank owned REO? Or is this a new construction purchase? In any of these situations you need to consult your purchase agreement whether it be a California Association of Realtors contract or Developer's contract. Read carefully and identify the provisions surrounding both your contingencies (ability to secure a loan, the appraisal, approval upon having a professional home inspection) and the liquidated damages.
If the contract is not clear to you explicitly. You may consider having an initial consultation with an attorney that specializes in Real Estate practice. Get a good referral from someone you trust. It may cost you a 1-hour fee but you will gain invaluable clarification of the situation and your rights. If you are being represented by an agent, you can also have them contact the legal department at the California Association of Realtors.
But first and foremost, reference back to your purchase agreement contract.
Best of luck to you!