Template:Using Card Readers

From 360Works Product Documentation Wiki
Revision as of 18:33, 4 November 2013 by Sarah (talk | contribs)
Jump to navigation Jump to search

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 swipe information is sent as a string with two tracks: Track 1 and Track 2. Depending on your particular swiping device, it may return either raw data or parsed tracks. 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 data formats with Track 1 and 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 the track parameters. You do not need to pass in card numbers and expiration dates.