Refactor payment protocol

These are the first two steps of a refactoring of payment protocol support.