Template:Using Card Readers
Certain types of merchant accounts are set up for reading physical card swipes, instead of taking orders via the web or over the phone. If you account is a card present account, like a retail store, then you will need to also send the data included on the magnetic stripe of a card. It is important to pass in swipe data if you have it, as your transaction may be downgraded to a more expensive rate if you simply type a card number.
First, set the gateway with card present parameter
To process a card present transaction, first call CCSetGateway with the parameter cardPresent=true. If CCSetGateway returns a 1, then you can perform a card present transaction.
Second, determine your Track 1 and 2 formats
To process a payment using card present accounts, you'll need the information in the magnetic stripe of the credit card. In Plastic, this information may be obtained from a keyboard-emulating card reader, which essentially dumps text into a text field when the card is swiped, as if the text had been entered via a keyboard.
While some card readers will contain software that parses that raw data from the magnetic stripe before dumping it to a field, this documentation refers to those keyboard-emulating readers that dump raw data. Raw swipe data contains two delimited pieces of information: Track 1 and Track 2.
Raw data would look something like this:
%B1234123412341234^LAST/FIRSTM^1112101000000000011100111000000?;1234123412341234=11121010000000000111?
Track 1 is delimited by a percent symbol and a question mark, so in the previous example Track 1 would be:
%B1234123412341234^LAST/FIRST/^1112101000000000011100111000000?
Track 2 is delimited by a semicolon and question mark, so in the previous example Track 2 would be:
;1234123412341234=11121010000000000111?
See http://www.exeba.com/comm40/creditcardformat.htm for more information about Track 1 and Track 2.
Note: As a convenience, the Plastic function CCTrackData will parse either Track 1 or Track 2 data as a return-separated string containing account code, cardholder name, expiration date (YYMM), and optional discretionary data.
Process the payment with CCProcessPayment
Finally, call CCProcessPayment and pass in raw swipe or track data. When processing a card-present transaction, a gateway will typically require you to pass in either the full raw swipe, Track 1 or Track 2. In most cases, you do not need to pass in card numbers and expiration dates.