A magician in a circus tried to get 30 Xanax tablets with a prescription for only six.
Joseph Gregory (23) of Oldtown Close, Naas appeared before Naas District Court.
The court heard the defendant committed the offence at Vista Pharmacy on the Ballymore Eustace Road in Naas in June.
Xanax tablets are commonly used to treat anxiety or panic attacks.
Judge Desmond Zaidan ordered the defendant to pay €500 to a homeless charity by December and said he would apply the Probation Act which means no conviction will be recorded.
The court was told that the defendant needed the pills for back pain arising from a previous injury.
Judge Zaidan said: "If you need extra medication, you're better off talking to your doctor."
If you have a story or want to send a photo or video to us please contact the Kildare Now editorial team. Between 9am and 5pm Monday to Sunday please call 045 409350. Between 5pm and midnight please call or text 086 729 0010. Or you can email content@kildarenow.com at any time.