It all depends on which machine you are interfacing with as there is no universal standard that we could tell you "how to do it". Each manufacturer has its own method and each method is totally different from the other methods.
Check the SDK for the device you are planning to use as a card processor to see and figure out what you need to do to communicate with it.