change this to:
JSONObject cookie = getPayload().getJSONObject("cookie");

then change the references below to just cookie