Sahih al-Bukhari 2289
Narrated Salama bin Al-Akwa:
Once, while we were sitting in the company of Prophet, a dead man was 
     brought. The Prophet (ﷺ) was requested to lead the funeral prayer for the 
     deceased. He said, "Is he in debt?" The people replied in the 
     negative. He said, "Has he left any wealth?" They said, "No." So, he 
     led his funeral prayer. Another dead man was brought and the people 
     said, "O Allah's Messenger (ﷺ)! Lead his funeral prayer." The Prophet (ﷺ) said, 
     "Is he in debt?" They said, "Yes." He said, "Has he left any wealth?" 
     They said, ''Three Dinars." So, he led the prayer. Then a third dead 
     man was brought and the people said (to the Prophet (ﷺ) ), Please lead his
     funeral prayer." He said, "Has he left any wealth?" They said, "No." 
     He asked, "Is he in debt?" They said, ("Yes! He has to pay) three 
     Diners.', He (refused to pray and) said, "Then pray for your (dead) 
     companion." Abu Qatada said, "O Allah's Messenger (ﷺ)! Lead his funeral 
     prayer, and I will pay his debt." So, he led the prayer.
حَدَّثَنَا الْمَكِّيُّ بْنُ إِبْرَاهِيمَ، حَدَّثَنَا يَزِيدُ بْنُ أَبِي عُبَيْدٍ، عَنْ سَلَمَةَ بْنِ الأَكْوَعِ ـ رضى الله عنه ـ قَالَ كُنَّا جُلُوسًا عِنْدَ النَّبِيِّ صلى الله عليه وسلم إِذْ أُتِيَ بِجَنَازَةٍ، فَقَالُوا صَلِّ عَلَيْهَا‏.‏ فَقَالَ ‏"‏ هَلْ عَلَيْهِ دَيْنٌ ‏"‏‏.‏ قَالُوا لاَ‏.‏ قَالَ ‏"‏ فَهَلْ تَرَكَ شَيْئًا ‏"‏‏.‏ قَالُوا لاَ‏.‏ فَصَلَّى عَلَيْهِ ثُمَّ أُتِيَ بِجَنَازَةٍ أُخْرَى، فَقَالُوا يَا رَسُولَ اللَّهِ، صَلِّ عَلَيْهَا‏.‏ قَالَ ‏"‏ هَلْ عَلَيْهِ دَيْنٌ ‏"‏‏.‏ قِيلَ نَعَمْ‏.‏ قَالَ ‏"‏ فَهَلْ تَرَكَ شَيْئًا ‏"‏‏.‏ قَالُوا ثَلاَثَةَ دَنَانِيرَ‏.‏ فَصَلَّى عَلَيْهَا، ثُمَّ أُتِيَ بِالثَّالِثَةِ، فَقَالُوا صَلِّ عَلَيْهَا‏.‏ قَالَ ‏"‏ هَلْ تَرَكَ شَيْئًا ‏"‏‏.‏ قَالُوا لاَ‏.‏ قَالَ ‏"‏ فَهَلْ عَلَيْهِ دَيْنٌ ‏"‏‏.‏ قَالُوا ثَلاَثَةُ دَنَانِيرَ‏.‏ قَالَ ‏"‏ صَلُّوا عَلَى صَاحِبِكُمْ ‏"‏‏.‏ قَالَ أَبُو قَتَادَةَ صَلِّ عَلَيْهِ يَا رَسُولَ اللَّهِ، وَعَلَىَّ دَيْنُهُ‏.‏ فَصَلَّى عَلَيْهِ‏.‏