beginning of payment controller and API --KW