Refactoring the /transaction endpoint