working payment functionality