Algorithm to find Unique users from their transactions
You don't need any ML here: in the question you just gave the full algorithm to find the target output ;) At best a ML system would find just the same method after using a lot of annotated data.
The method is essentially what you said:

Group the users by their card number or email (easily done with a map for each), this gives you the cases of &quot;sure&quot; identical users.
Group the users by their name, this gives you the cases of &quot;possible&quot; identical users. For this part you might want to use string similarity measures.