A funeral was brought before the Prophet ﷺ, and they said, "Prophet of Allah, perform the funeral prayer over him."He asked, "Did he leave behind any debt?"They said, "Yes."He asked, "Did he leave behind any wealth?"They said, "No."He said, "Pray over your companion yourselves."A man from the Ansar named Abu Qatada said, "Pray over him, and his debt is upon me." So he prayed over him.
أخبرنا عمرو بن علي ومحمد بن المثنى قالا حدثنا يحيى قال حدثنا يزيد بن أبي عبيد قال حدثنا
أتي النبي ﷺ بجنازة فقالوا يا نبي الله صل عليها قال هل ترك عليه دينا قالوا نعم قال هل ترك من شيء قالوا لا قال صلوا على صاحبكم قال رجل من الأنصار يقال له أبو قتادة صل عليه وعلي دينه فصلى عليه
Bukhari transmitted it in "Transfers of Debt," in the chapter "If the debt of a deceased person is transferred to a man, it is permissible," Hadith 2289, from the hadith of Yazid bin Abu Ubayd, with the same wording. It is also found in Kubra, Hadith 2088.Yahya is Qattan.