See: Point of Sale.
It's just the hardware that makes the magic happen. Some form of reader digests the data on the mag stripe on your card. Your name. Address. Safeway club card member. What brand of dog food you bought last time, maybe, if that data is kept by the store or another competitor and then regurgitated back to you. Your history of purchases is kept. Security things are on there. And, of course, your bank account number from which your credit or ACH card is backed.
The machines connect wirelessly to a server at the back of the store, and just crawl along the twisted set of pipes that comprise the internet, and tickle the server at the bank asking, "Is it okay for Joe Bleau to spend $212.39 from his account to buy all this food?" And if it says yes, i.e. he has enough dough to buy the, um, dough, then a light flashes and the transaction is greenlit as a go, thankyouforshopping.