This raises too many questions to give a meaningful answer here on HN.
But if you want a quick opinion.... sue them for underpaying you and report it to the tax department and demand full pay for the work you did and also point out to them that you own the intellectual property rights of all the work you did and threaten to sue them if they don’t pay you for it.
Just throw it to a lawyer.