Sunan Ibn Majah Book 15, Hadith 25
“Whoever dies owing a Dinar or a Dirham, it will be paid back from his good deeds, because then there will be no Dinar or Dirham.”
“The soul of the believer is attached to his debt until it is paid off.”
if a believer died at the time of the Messenger of Allah (ﷺ) and he had debts, the Messenger of Allah (ﷺ) would ask: “Did he leave anything with which to off his debt?” If they said yes, then he would offer the funeral prayer for him, but if they said no, then he would say: “Pray for your companion.” When Allah granted his Prophet (ﷺ) the conquests, he said: “I am nearer to the believers than their own selves. Whoever dies owing a debt, I will pay it off for him, and whoever leaves behind wealth, it will be for his heirs.”