Hello,
In my Opinion:
It is the responsibility of the Principle Employer to ensure that all the payments are paid to Employee, even when he is in Contract.
Hence as such the Principle Employer will become liable for payment of Gratuity also.
However,
As per Sec 10 of Payment of Gratuity Act
" Where an employer is charged with an offence punishable under this Act, he shall be entitled, upon complaint duly made by him and on giving to the complainant not less than three clear days notice in writing of his intention to do so, to have any other person whom he charges as the actual offender brought before the court at the time appointed for hearing the charge; and if, after the commission of the offence has been proved, the employer proves to the satisfaction of the court -
(a) that he has used due diligence to enforce the execution of this Act, and
(b) that the said other person committed the offence in question without his knowledge, consent or connivance, that other person shall be convicted of the offence and shall be liable to the like punishment as if he were the employer and the employer shall be discharged from any liability under this Act in respect of such offence."
Hence, you have to give notice to the Contractor and ensure the payment of Gratuity.
Hope this answers your query
Regards,