refactor billing api