Cannot read property '0' of undefined

tag is just the iterator - so you probably want
payload: tags[tag].value[0]