The TJX Companies has agreed to a $40.9m settlement with Visa USA Inc and Visa Inc following an unauthorised computer intrusion incident last year when millions of customer records were stolen by hackers.