Al-Ilmam bi-Ahadith al-Ahkam 506
وَعَن ابْن عَبَّاس رَضِيَ اللَّهُ عَنْهما قَالَ: قَالَ رجل: يَا نَبِي الله، إِن أبي (قد) مَاتَ وَلم يحجّ، أفأحج عَنهُ؟ قَالَ: " أَرَأَيْت لَو كَانَ عَلَى أَبِيك دين أَكنت قاضيه؟ قَالَ: نعم. قَالَ: فدين الله أَحَق ". (أخرجه النَّسَائِيّ) .
And from Ibn ʿAbbas, may Allah be pleased with them both, who said: A man said: "O Prophet of Allah, my father has died without performing Hajj; shall I perform Hajj on his behalf?" He said: "Do you think that if your father owed a debt, you would pay it?" He said: "Yes." He said: "Then the debt to Allah has more right [to be paid]." (An-Nasaʾi recorded it.)