You should have had a lawyer on consult from the beginning, reviewing the initial contract and its payment terms. If the client isn't paying, you need to be talking to your lawyer. If you don't have a lawyer and an ironclad contract, the entire situation is a toss-up and there are no guarantees. You can't even refuse to deliver and walk away from this client without a lawyer's determination that you are not breaching contract by doing so. You believe you are the one being wronged. The courts may not agree, and the company could even turn around and sue you for taking their project hostage.
Only your lawyer, with knowledge of your state's laws, a copy of your contract, and an archive of all communications between you and your client, can help. Do not make a single decision based on HN comments, no matter how insightful they seem. If you follow the wrong advice, you could well see yourself in deep legal trouble with ramifications worse than losing the $25,000.
tldr; You should have had a lawyer at the start of this contract. If not, you must get one now. Get a lawyer. Now.