Demo 12 Project (Credit Card Reader)

Receives credit card data from a magnetic stripe reader. This implementation supports the ID Tech iMag and iMag Pro readers (

What you will see

If one of the supported readers is plug in, you should see a view on your iOS device as shown above (1). On the other hand, if the reader is absent, you should see a view as shown below (2). Swipe a credit card and it will tell you the type of card (3 below, Visa, Master, Discovery, etc.) you just swiped on your iOS device and display card data on the Windows application Demo12.exe (4, below).


What you should do

Launch demo 12.exe and iQuipment PC. If you need help on this, review the demo 1 help chapter.

Plug the credit card reader* into your iOS device.

*iQuipment currently supports iMag / iMag Pro reader from ID Tech* (
iMag Pro: iPhone, iPod Touch, iPad
iMag: iPhone, some generations of iPod Touch

1. Enable HTTPS: Go to iQuipment PC, Security menu and select "Enable HTTPS (SSL)" (1, above).

2. Setup x509 SSL certificate: On the pop-up dialog box, following the steps to generate or reuse an X509 certificate (2, above), select a port (3, above), bind certificate* (4, above) to the port, and test the port binding (5, above). If every thing goes as it should, you will see a warning on your default browser saying "the site's security certificate is not trusted!" as shown below (6). Don't worry about this warning**. This is a good sign. It is because the self certified x509 certificate has not been blessed by Verisign or other major CA. But it is free and it is just as effective for use in communication encryption. Click "Proceed anyway" (6, below) and you should see a message saying "Hello, iQuipment PC services are now available to your iPhone". At this point everything works as it should. Restart the application (5, above) to take effect.

* If you receive an error tring to bind the certificate to the port, a certificate has been bind to the port before. Delete the certificate (button on the right) and click the "Bind Certificate to Port" button again.
** If you don't see the warning message, the binding was not successful. Make sure the certificate is in place (2, above); delete the certificate then repeat above steps starting from binding certificate.


3. Register in Windows FireWall. Go to Control Panel, Windows Firewall and enter the port in the exception list.
4. Enter https url: Go to iQuipment PC, File menu to open the file "Demo12.xml." Identify the "viewUrl" node and its sub node "security https" (8, above). Enter the URL(9, above) carefully into your iQupiment iOS app (10, below).

If all goes well, you should see a credit card icon and a label saying "Card Reader Ready." Swipe a credit card and see the data of the credit card shown on the panel of demo 12.exe.

Highlights of the code

Launch Demo12 Visual Studio project from the SDK. Open Form1.cs and locate the line below:

void DataExchangeService_clientSetData_ID_Event(string clientIP, string viewName, string dataName, object dataValue, long processID)

This function is called whenever a credit card is swiped. An exposed variable called creditCardRowData carries the credit card track data. The format of the credit data can be found in the comment or Wikipedia.

Previous Lesson: Demo 11 Project (Alert Message) Table of Contents Next Lesson: Demo 13 Project (Knob Control)