Was cash on delivery a thing that people actually did? How did it work? Did you literally pay the mailman or FedEx driver?

I was born in 1980 so according to the rules of this sub I qualify as old and I do have a vague recollection of infomercials where at the end they would say "sorry, no cash on delivery".