A Good Samaritan who stepped in to pay for the groceries of an elderly stranger when her card was declined says it was the thought of his grandmother that moved him to take action.

Ryan O’Donnell, 34, from the town of Wyoming in NSW, was caught on camera in the act of kindness at a local Coles, and the photo went viral after it was posted to Twitter.

In an interview with TODAY this morning, Mr O’Donnell explained he was waiting in line when he noticed the lady in front of him in the line was having problems processing her payment.

Mr O'Donnell said that after her card was declined several times, she went around to the service desk for assistance.

After he had finished paying for his own groceries, Mr O'Donnell joined her, handing the woman at the checkout a $50 note to cover the elderly stranger's expenses.

Mr O’Donnell said that when the lady asked how she could pay him back, he assured her that it was “only $44, you’ll be right – enjoy your day”.

Mr O'Donnell explained he was moved to help by the woman’s resemblance to his grandmother.

“So I just could not walk away,” he told hosts Karl Stefanovic and Lisa Wilkinson.

“That’s how my mum and dad brought me up.”

Mr O’Donnell said that the response to his story - which included a post to the Facebook page of Opposition Leader Bill Shorten - has been “overwhelming”.