BAYHAQI 11399:
from Kān —
[Machine] The Messenger of Allah, ﷺ , used to not ask about any aspect of a person's deeds when a funeral procession was brought to him, except to ask about their debt. If it was mentioned that the deceased had a debt, he would refrain from praying the funeral prayer for them. And if it was mentioned that they did not have a debt, he would pray the funeral prayer for them. Then, a funeral procession came and when he stood up, he asked his companions, "Does your companion have any debt?" They replied, "He has two dinars of debt." The Messenger of Allah, ﷺ , then righted himself and said, "Pray for your companion." Ali bin Abi Talib said, "O Messenger of Allah, I will take care of these two for him." So the Messenger of Allah, ﷺ , prayed the funeral prayer for him, then he said to Ali, "May Allah reward you with goodness. Allah has fulfilled your pledge as you fulfilled the pledge of your brother. There is no deceased person who dies with a debt, except that he is held captive by his debt. So whoever fulfills the debt of a deceased, Allah will fulfill his debt on the Day of Resurrection." Some of them said, "Is this specifically for Ali or for all Muslims?" He, ﷺ , replied, "No, it is for all Muslims. The narrations on the authority of Abu Qatadah concerning the responsibility for the debt of the deceased are more reliable, and Allah knows best."
البيهقي ١١٣٩٩:
عن كان —
كَانَ رَسُولُ اللهِ ﷺ إِذَا أُتِيَ بِجِنَازَةٍ لَمْ يَسْأَلْ عَنْ شَيْءٍ مِنْ عَمَلِ الرَّجُلِ إِلَّا أَنْ يَسْأَلَ عَنْ دَيْنِهِ فَإِنْ قِيلَ عَلَيْهِ دَيْنٌ كَفَّ عَنِ الصَّلَاةِ عَلَيْهِ وَإِنْ قِيلَ لَيْسَ عَلَيْهِ دَيْنٌ صَلَّى عَلَيْهِ فَأُتِيَ بِجِنَازَةٍ فَلَمَّا قَامَ سَأَلَ أَصْحَابَهُ هَلْ عَلَى صَاحِبِكُمْ مِنْ دَيْنٍ؟ قَالُوا عَلَيْهِ دِينَارَانِ دَيْنٌ فَعَدَلَ عَنْهُ رَسُولُ اللهِ ﷺ فَقَالَ صَلُّوا عَلَى صَاحِبِكُمْ فَقَالَ عَلِيُّ بْنُ أَبِي طَالِبٍ ؓ يَا نَبِيَّ اللهِ هُمَا عَلَيَّ بَرِئَ مِنْهُمَا فَتَقَدَّمَ رَسُولُ اللهِ ﷺ فَصَلَّى عَلَيْهِ ثُمَّ قَالَ يَا عَلِيُّ جَزَاكَ اللهُ خَيْرًا فَكَّ اللهُ رِهَانَكَ كَمَا فَكَكْتَ رِهَانَ أَخِيكَ إِنَّهُ لَيْسَ مِنْ مَيِّتٍ يَمُوتُ وَعَلَيْهِ دَيْنٌ إِلَّا وَهُوَ مُرْتَهَنٌ بِدَيْنِهِ فَمَنْ فَكَّ رِهَانَ مَيِّتٍ فَكَّ اللهُ رِهَانَهُ يَوْمَ الْقِيَامَةِ فَقَالَ بَعْضُهُمْ هَذَا لِعَلِيٍّ خَاصَّةً أَمْ لِلْمُسْلِمِينَ عَامَّةً؟ فَقَالَ لَا بَلْ لِلْمُسْلِمِينَ عَامَّةً عَطَاءُ بْنُ عَجْلَانَ ضَعِيفٌ وَالرِّوَايَاتُ فِي تَحَمُّلِ أَبِي قَتَادَةَ دَيْنَ الْمَيِّتِ أَصَحُّ وَاللهُ أَعْلَمُ
hadithunlocked.com