If your terms of employment stipulates that your notice period is 2 months or 2 months salary in lieu of notice, then it is upto you to decide whether you should serve 2 months or to get relieved immediately after paying 2 months' pay. If you chose the second one, the company cannot ask you to work for 2 months. When you have paid 2 months pay, you are discharged and under what ground the company can sue you? There is no legal complications. Just the other side of the coin, imagine that the company does not want your service. The company will give you a notice that your service will end after two months from now. In case the company wants that you should be relieved immediately then the company will pay you 2 months' pay and ask you not to come from tomorrow. In the former case, the company will take your labour/ service for two months and in return pay you salary. During this period, you can find an employment for you. In the latter case the company will not take any service for two months but will pay you 2 months'pay and ask you to go immediately. Again this 2 months salary that you get is meant for compensating the loss of income till you get an employment. In the same manner, you can either inform the company that you will be with the company only for 2 more months and during this 2 months you will contribute your service to the company and in return, obviously, collect the remuneration for that service, ie, salary. During this period the company can find a replacement. Alternatively, you can say that my service will not be available from tomorrow and you pay two months'pay which the company can use to pay additional remuneration to existing persons who will discharge your functions or hire a temporary employee in your place. Therefore, there is no illegality in paying money and getting relieved without notice.