Dick, Philip K. Ubik

Philip K. Dick, Ubik (1969)

A snippet:
The door refused to open. It said, "Five cents, please." 
He searched his pockets. No more coins; nothing. 
"I'll pay you tomorrow," he told the door. Again it remained locked tight. "What I pay you," he informed it, "is in the nature of a gratuity; I don't have to pay you." 
"I think otherwise," the door said. "Look in the purchase contract you signed when you bought this conapt." 
...he found the contract. Sure enough; payment to his door for opening and shutting constituted a mandatory fee. Not a tip. 
"You discover I'm right," the door said. It sounded smug.