The Messenger of Allah ﷺ would not perform the funeral prayer over a man who died while owing a debt. A deceased man was brought before him, and he asked, "Does he owe any debt?"They replied, "Yes, two dinars."He said, "Pray over your companion."Abu Qatada al-Ansari then said, "I will take them upon myself, Messenger of Allah."So the Messenger of Allah ﷺ prayed over him.Later, when Allah granted victory to His Messenger ﷺ, he said, "I am closer to every believer than his own self. Whoever leaves a debt, its repayment is upon me, and whoever leaves wealth, it belongs to his heirs."
كان رسول الله ﷺ لايصلي على رجل مات وعليه دين، فأتي بميت فقال: أعليه دين؟ قالوا: نعم، ديناران، قال: صلوا على صاحبكم، فقال أبو قتادة الأنصاري: هما علي يا رسول الله، قال: فصلى عليه رسول الله ﷺ، فلما فتح الله على رسوله ﷺ قال: أنا أولى بكل مؤمن عن نفسه، فمن ترك دينا فعلي قضاؤه، ومن ترك مالا فلورثته.
Abu Dawud (3343) and Nasai (1962) both narrated it from the hadith of Abdul-Razzaq, and it is in his Musannaf (15257), from Mamar, from Zuhri, from Abu Salama, from Jabir, as mentioned. Its isnad is sahih. Ibn Hibban also graded it sahih (3064) through this same route, and he titled the chapter with these words, "The permissibility for a person to pray over every Muslim of the qibla who has died, even if he had debt upon him."