A woman came to the Prophet ﷺ and said, "My mother had a month of fasting due from her. Should I make it up on her behalf?"He replied, "If your mother had a debt, would you pay it off for her?"She said, "Yes."He said, "Then a debt owed to Allah is even more deserving of being paid."
حدثنا مسدد حدثنا يحيى قال سمعت الأعمش ح و حدثنا محمد بن العلاء حدثنا أبو معاوية عن الأعمش المعنى عن مسلم البطين عن سعيد بن جبير
أن امرأة جاءت إلى النبي ﷺ فقالت إنه كان على أمها صوم شهر أفأقضيه عنها فقال لو كان على أمك دين أكنت قاضيته قالت نعم قال فدين الله أحق أن يقضى
Bukhari narrated it in the Book of Fasting, Chapter: Whoever dies while owing a fast, hadith no. 1953, from the hadith of Abu Muawiya. Muslim narrated it in the Book of Fasting, Chapter: Fulfilling the fast on behalf of the deceased, hadith no. 1148, from the hadith of Amash, with the same wording. See also hadith no. 3208.