fix. improved logic for errors in payments controller