The Prophet ﷺ would not perform the funeral prayer over a man who had unpaid debt. A deceased man was brought to him, and he asked, "Does he owe any debt?"They said, "Yes, two dinars."He said, "Pray over your companion."Abu Qatada said, "They are upon me to pay, Messenger of Allah."So he prayed over him. Then, when Allah granted victories to His Messenger ﷺ, he said, "I am closer to every believer than his own self. Whoever leaves behind a debt, it is upon me to settle, and whoever leaves behind wealth, it belongs to his heirs."
حدثنا عبد الرزاق حدثنا معمر عن الزهري عن أبي سلمة بن عبد الرحمن
كان النبي ﷺ لا يصلي على رجل عليه دين فأتي بميت فسأل هل عليه دين قالوا نعم ديناران قال صلوا على صاحبكم فقال أبو قتادة هما علي يا رسول الله فصلى عليه فلما فتح الله عز وجل على رسوله ﷺ قال أنا أولى بكل مؤمن من نفسه فمن ترك دينا فعلي ومن ترك مالا فلورثته
Its chain of transmission is sahih. Haythami said in 7/50, "The men of Ahmad's narrators are the men of the Sahih." Hakim also narrated it in 2/320 and graded it sahih, and Dhahabi agreed with him.