It is usually because of more than one person fails when a failure has an important impact. A perspective is:
- The customer responsibility is to communicate specifications, their expectations and managing risk of the supplier;
- The person who deals with the customer (owner, seller, accounts manager) responsibility is to confirms the specifications, manage the expectations and assess the customer satisfaction and payment risk;
- The developer responsibility is to program a software that is maintainable, satisfy the specifications, communicate impediments and unclear instructions;
There are multiple strategies to avoid being impacted by customer situations:
- small deliveries to synchronize specifications and customer expectations;
- update planning of what is delivered and what will be delivered to manage scope and expectation;
- payment for each delivery to avoid losing negotiation advantage;
- keep the source code that has not been paid to avoid losing negotiation advantage;
My feeling from your question and the importance of the situation is the loss of revenue is attributed directly to you. As others mentioned, managing customer relation and money is usually not the developer responsibility when you are an employee.
Q. What should be the next steps (Legally,career-wise, etc)?
- The 4 years of experience you have at your current position means you are able to do the job whatever your skill level;
- A supplier doing 6 months of works without perceiving any payment is a tremendous financial risk, the customer can close doors for multiple reasons: sued, bankrupt, raided, etc.
The fault is distributed to everyone participated to this project at various extents:
- If the customer did not communicate his dissatisfaction at the beginning;
- If the office people did not manage the financial risk and the customer relation risk by matching developers to projects;
- If the delivered software does not match the requirement;
There is no clear answer, it depends of the company position, are you blamed entirely for the lost of the revenue? what are the consequences? their intents? how are you finances? can you stand-up for your parts and risk losing your job? is your manager is open to discussion? what is your perspective?
Q. How should I bring back my confidence?
I propose that you take your share of the responsibility and you leave the over to the other collaborators. Everybody is human and face failure, they are inevitable and sometime hard. I propose to accept them and accept they will be more, learns if there is some value and manage it as a human.
In conclusion, this answer may not be useful but it demonstrates that you are living a complex situation with a lot of grey areas where a combination of people actions created it, please, do not inflict all the responsibility to yourself.