Bulugh al-Maram 882
وَعَنْ أَبِي هُرَيْرَةَ - رضي الله عنه - أَنَّ رَسُولَ اللَّهِ - صلى الله عليه وسلم - كَانَ يُؤْتَى بِالرَّجُلِ الْمُتَوَفَّى عَلَيْهِ الدَّيْنُ, فَيَسْأَلُ: «هَلْ تَرَكَ لِدَيْنِهِ مِنْ قَضَاءٍ?» فَإِنْ حُدِّثَ أَنَّهُ تَرَكَ وَفَاءً صَلَّى عَلَيْهِ, وَإِلَّا قَالَ: «صَلُّوا عَلَى صَاحِبِكُمْ» فَلَمَّا فَتَحَ اللَّهُ عَلَيْهِ الْفُتُوحَ قَالَ: «أَنَا أَوْلَى بِالْمُؤْمِنِينَ مِنْ أَنْفُسِهِمْ, فَمَنْ تُوُفِّيَ, وَعَلَيْهِ دَيْنٌ فَعَلَيَّ قَضَاؤُهُ». مُتَّفَقٌ عَلَيْهِ. وَفِي رِوَايَةٍ لِلْبُخَارِيِّ: «فَمَنْ مَاتَ وَلَمْ يَتْرُكْ وَفَاءً».
From Abu Hurayrah, may Allah be pleased with him, that a deceased man who owed a debt would be brought to the Messenger of Allah ﷺ, and he would ask: "Has he left anything to pay off his debt?" If he was told that he had left enough to pay it, he would pray over him; otherwise he would say: "Pray over your companion." When Allah granted him conquests, he said: "I am closer to the believers than their own selves. Whoever dies owing a debt, its repayment is upon me." Agreed upon. In a narration of al-Bukhari: "Whoever dies and does not leave enough to pay it."