Is it wrong if I added an onion to the customer's drink?
I wouldn't believe this unless I had heard this for myself. Are you really that mean?
The customer was rude to me and I wanted to get back at them.
It isn't right to do something like that to get back at them for being rude. You will just make them angry with you and then they could complain and you could get fired. Getting revenge for the way they treated you doesn't make you the better person.
Yeah, I should never have done that.
I appreciate your level of humility. It can be hard to restrain yourself from being rude back to someone who mistreats you, but try to have some patience and realize they are probably having a bad day and are only taking it out on you by mistake.