refactoring payment transaction