I want to change a flag in DB or insert a new value whenever a paypal payment is completed, but I can't seem to find the part of the code to do that.

I know every time a user makes a successful payment, they get redirected to a success URL but I can't seem to find the controller that handle that redirection.