taste of one's own medicine

get / have a taste of one’s own medicine (for one) (to receive difficulties of the same kind that one has been causing other people) — получить по заслугам

Example 1: Now you see how it feels to have someone call you names! You are getting a taste of your own medicine! — Так тебе и надо. За что боролся, на то и напоролся.

Example 2: Mary is often rude and abrupt with people. She was devastated when I treated her rudely. She doesn’t like having a taste of her own medicine. / She didn’t like getting a dose of her own medicine.

take one's medicine (to accept the punishment or the bad fortune that one deserves.) — отвечать по заслугам; принять заслуженное

Example : He knows he did wrong, and he knows he has to take his medicine.

to give somebody a dose /a taste of their own medicine (if you give someone a taste of their own medicine, you do something bad to someone that they have done to you to teach them a lesson ) — расплатиться той же монетой; отплатить тем же; ср: как аукнется, так и откликнется

Example 1: Jane is always playing practical jokes on her colleagues. Someone is going to give her a dose of her own medicine someday. — ... кто-то же дожен воздать ей по заслугам.

Example 2: And she did get a dose of her own medicine when everyone in the office started playing practical jokes on her.

See also
[get one's come-uppance]
[get what's coming to one]
pay the piper
[serves you right]
have it coming
take one's medicine