Our team made a mistake in software code and that caused the customer lose a lot of money. Now they ask us for that amount to give them back as compensation.
How to deal with that?
For any project, there is a process of verification and validation of scope and acceptance of delivery. Before that occurs, the seller of services is on the hook to 'get it right.' After this occurs, there is a formal, legal, and real transfer of accountability from the seller to the buyer. This process could be a moment in time, like when you take the car off the lot, or could be a process over time, like when you create your punch list over a year for the builder. Whatever that process is, it is final.
Assuming this transfer took place on your project, your customer assumed responsibility for the product and went to market. A defect surfaced and they got hit. This is the risk of all business decisions as there is never a guarantee of perfection or success. They do not really have the right to try to transfer this risk and accountability to you, EXCEPT if they can show some sort of negligence or malpractice in some way and a mistake does not necessarily meet this standard.
That said, you are not free of risk or cost. The threat of suit is there, for which you have to defend and this costs money and time. You have the threat of your reputation, which has an unknown cost to you. And of course you will not be a candidate for future work for this client, either, which might already be the case anyway.
This is a benefit / cost decision. What are the costs to give the money back, the cost to fix the bug, the cost of possible legal defense (win or lose), and the cost of your reputation. There is no single answer that any of us can provide here. "Sue me" is a viable and realistic answer as coughing up the money is, or somewhere in between. Your organization, including legal, will need to sit down and conduct this analysis carefully.