extract pay function.