أَخْبَرَنِي عَمْرُو بْنُ دِينَارٍ، عَنِ الزُّهْرِيِّ، عَنْ سُلَيْمَانَ بْنِ يَسَارٍ، عَنِ النَّبِيِّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ مِثْلَهُ وَزَادَ فِيهِ فَقَالَتْ: يَا رَسُولَ اللَّهِ، فَهَلْ يَنْفَعُهُ ذَلِكَ؟ قَالَ: "نَعَمْ كَمَا لَوْ كَانَ عَلَيْهِ دَيْنٌ فَقَضَيْتِيهِ نَفَعَهُ" .
It is narrated from the Prophet ﷺ through the chain of Amr bin Dinar in a similar manner, and in this narration, these additional words are mentioned: That woman said, "O Messenger of Allah! Will this (Hajj on behalf of another) benefit him?" The Prophet ﷺ replied, "Yes, just as if he had a debt and you paid it off on his behalf, it would benefit him; in the same way, Hajj will also benefit him."