It is narrated from Sayyiduna al-Hakam bin Umayr (may Allah be pleased with him): the Prophet (peace and blessings be upon him) said: "Whoever does you a good turn, repay him. If you do not find the means, then pray for him."
Al-Tabarani recorded it; its chain contains a narrator, Yahya bin Ya'la al-Aslami, who is da'if (weak).