Using a Credit Card Reader

J

Jerry Camel

Not sure if this is a good place to post this... I'm writing and ASP.net
app using vb .net. I need to interact with a credit card reader. I have
one that sits inline with the keyboard. Works great, except for the fact
that no matter what field the user is in on the transaction page (Name,
Address, Credit Card number) the reader will dump the data at the cursor.
So, if the user is in the name field and they happen to swipe the card,
that's where the info goes.

has anyone worked with this type of thing before? Is there a way to disable
the card reader or detect that the info is coming from the reader? So I can
only enable it when the user is in the proper field, or move the data to the
proper field when it's detected... Thanks.

J
 
C

Chris

make sure that you are on the credit card field before you enable that
keypress. If the credit card reader is on the keyboard it self then make
sure that it is eather disabled untill that field has focus.. or make sure
that the credit card keypress is bypassed unless the credit card field has
focus
 
J

Jerry Camel

That's what I can't figure out how to do. There doesn't seem to be a way to
programatically interact with the card reader.
 
J

james

Jerry Camel said:
Not sure if this is a good place to post this... I'm writing and ASP.net
app using vb .net. I need to interact with a credit card reader. I have
one that sits inline with the keyboard. Works great, except for the fact
that no matter what field the user is in on the transaction page (Name,
Address, Credit Card number) the reader will dump the data at the cursor.
So, if the user is in the name field and they happen to swipe the card,
that's where the info goes.

has anyone worked with this type of thing before? Is there a way to disable
the card reader or detect that the info is coming from the reader? So I can
only enable it when the user is in the proper field, or move the data to the
proper field when it's detected... Thanks.

J

I did a quick Google search on this subject and there seems to not be any real info out there to do this in VB.NET. Maybe, the
manufacturer of the reader you are using has a SDK for their reader. It might not be for VB.NET, but, might be something that
you could convert.
Sorry I could not offer a better suggestion.
james
 
G

Guest

The keyboard reader should send characters to the KeyPress Event of whatever
control has the focus at the time the card is read. You should be able to
use the Form.KeyPreview set to True and then in the KeyPress Event of the
Form that is active, intercept the characters as they are sent. I suspect
that the first character sent to the Keypress event will be a special
character to signal that a string of characters from the card reader is being
sent. You can then add the characters in a string in the KeyPress event
until the ending special character is sent. Not sure about this but might
work.
 
D

Darrin

I have been working on a project using a magnetic swipe card reader
(basically a credit card reader) with vb.net for the last few months.
It sounds like the type of reader you have is what is called a
"keyboard wedge". That type emualtes a keyboard. So, when a card is
passed through the reader, what it reads off of the card is passed back
as if someone were manually typing it in on the keyboard. So, whatever
control has focus, the text property will be set to that value.

I am using the type of reader that is not a "keyboard wedge". With it,
I am able to raise an event when the reader detects that a card has
been passed through it and pass the value read from the card along with
the event. I am then able to do what I want with the value.

When I researched the hardware, the prices were basically the same for
the "keyboard wedge" style and the other style.

So, unless you can get the manufacturer to assist in how to disable the
credit card reader, you may want to look at the other type of reader.
In my situation, we did not want the reader mounted on the keyboard, it
is connected to the PC via USB connection and then mounted near the PC.

Hope this helps.
 
J

Jerry Camel

Thanks, Darrin. This is what I figured... I'll have to search for a
different card reader. Can you give me the make/model of what you're using?
Thanks.

J
 
G

Guest

You don't have to get a separate card reader...see my previous note on this
thread. If you use a separate card reader, then you will have to read from a
serial, USB, Parallel, etc. port. I've used one and it's a PAIN!
 
B

BW

I had this problem a few years back at another company.

We had Cherry (yes, that was the name) keyboards and the reader was built
into the keyboard.

What these keyboards do, and I suspect your reader does the same thing, is
send a control character at the start of the input and a control character
at the end of the input, basically they were acting as a delimiter to the
card information. In the keypress event of the form we would look for the
control character (much like you would if you were looking for say ctrl+l)
then we would change focus to where we needed it, in our case it was a
hidden textbox and read in the string. When the text box read in the ending
control character we would stop reading into our hidden text box and put
focus back to the original control.

The control character could be set through some dip switches under a panel
on the bottom of the keyboard. You could even have it not send control
characters (this was fairly pointless).

Do you have any documentation for the reader at all? This should tell you
how to set the control characters. If you don't have docs, check with then
manufacturer or look on the internet for the make and model of the device.

HTH
BW
 
S

stand__sure

off the top of my head a less than elegant work-around comes to mind -- it
seems that this problem could be resolved by either capturing keyboard
events at the form level or by limiting other fields to non-numeric data --
granted, not a perfect solution, but it is better than the current
situation...
 
D

Dick Grier

Hi,

This is the main reason that I find keyboard wedge devices to be next to
useless. I use either a serial card reader or a USB reader that DOES NOT
act as a keyboard device. The only USB reader that I have found that meets
this description is from Magtek (model 21040102 or equivalent).

Serial readers allow you to parse the data as it arrives, and to place it in
the appropriate fields. Likewise, the USB reader (which employs the Windows
USB APIs, so is more complex to implement) from Magtek permits this
operation.

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
www.mabry.com/vbpgser4 to order.
 
R

Rlrcstr

Thanks for the thoughts everyone...

I think I may have to go with a different reader. This is an .ASP app...
Mostly javascript at the client side. I don't really have a keypress event
to capture with. And now I'm being told that I may have to run on a
weblogic server, so .ASP may not be involved at all.

Thanks, again.

Jerry
 
B

BW

You should have said so in the first place, you could have saved everyone a
lot of typing ;-)

IMHO it's unreasonable to expect a card reader to be used with a web-based
app, since you can get the kind of control you need with server-side code.

Since this _is_ as web-based app you are seriously going to have to consider
and ActiveX control or a Java applet (not javascript) to get the kind of
control you require.

Good luck with that.

BW
 
T

Tony H

It may be kind of cheesy but there is one possibly simple answer..

Use javascript to copy from the current field to the cc field since no
field's value should resemble anything like a credit card number.. you can
use isNaN() and check the length for >= 13 (I think 13 is the lowest card
number length).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top