Understanding Gratuity for Contract Employees
There have been many posts in this forum regarding gratuity, with citations and clarifications. I am not going to cite any sections now, which you can easily find in this forum.
The Payment of Gratuity Act talks about employees. The one who employs him/her is liable to pay gratuity. In your question, you asked about a contract employee. The employer in this case is the contractor, who is engaged by a principal employer. Therefore, the contractor is liable to pay gratuity to his employee. If the contractor does not pay, the employee can claim the same from the principal employer.
However, another question will arise as to whether the employee has completed 5 years with the principal employer, which is unlikely except in some public sectors where they have many contract employees working for years. Even if the employee has not completed five years with the principal employer and if an amount is due from the contractor to the employee, then the principal employer is liable for the same with the right to recover the same from the contractor.
Details of relevant sections of the Payment of Gratuity Act and the Contract Labour (Regulation and Abolition) Act are available in this forum itself under the head Gratuity.
Thanks