poetic justice; retributive justice
A literary concept where virtue is rewarded and vice punished in a fitting or ironic manner. Often used in discussions of narrative structure.
This story depicts poetic justice, where the villain falls into his own trap.
The concept of poetic justice is widely seen from classical literature to modern films.
因果応報 is a Buddhist term for karmic retribution, often implying a moral cause-and-effect over a longer timescale, while 詩的正義 is a literary device focusing on fitting narrative outcomes.
Compound of 詩的 (poetic) and 正義 (justice), likely a calque from English 'poetic justice'.