Implemented Logic for handling payments