4

I’m sending data through serial port to “Verifone VX520” payment device. It is my first trial to communicate with such devices

SerialObj.Open(); string input = "02hPUR.10.99._000000000004.634._4761739001010010FFFFF.0808.123456.
.03h"; byte[] asciiBytes = Encoding.ASCII.GetBytes(input); SerialObj.Write(asciiBytes, 0, asciiBytes.Length);

As per the structure this message should send some amount and appear it on the machine but what I got is only this message “Sending Ack” And when I tried to read acknowledgment I got only this character

enter image description here

it is like upside down "T"

So, is there any way to know what’s going wrong here.

Mohamed
  • 109
  • 1
  • 3
  • 12
  • Have you set the Baud rate, parity, and stop bits to match the device? – SteveFerg May 04 '15 at 06:24
  • yes, I did that before opening the port SerialObj = new System.IO.Ports.SerialPort( port, baudrate, parity, databits, stopbits); – Mohamed May 04 '15 at 06:27
  • Are you using a null modem cable? Also do you have another device you can try with this cable to sent/receive text? – SteveFerg May 04 '15 at 06:34
  • Other things to try is 8 databits no parity, and faster baud rates. Worse, comes to worse, send a Ctrl-Q. These are a few things that have worked for me in the past. – SteveFerg May 04 '15 at 06:43
  • Just out of curiosity, what are you trying to do with this serial connection? – David May 05 '15 at 04:24
  • I've a small financial system, a new module has been asked to develop for integration in the some payment forms to integrate with the payment device, I've received only the payment terminal with a brief document about the messages signature as the one I've provided in the code – Mohamed May 05 '15 at 05:06

1 Answers1

3

Most Verifone terminals use a special message formatting to transfer information between a PC and the software inside. Your payment string is wrong. The reply from the terminal is correct. 21 decimal is 15h NAK meaning message is wrong or crc wrong. Your string has to look like this "\02PUR.10.99._000000000004.634._4761739001010010FFFFF.0808.123456. .\03" but i really doubt that the dots are really dots and not Field Separators that code with a different character (1Ch). the message also misses the CRC character after ETX. The best way of communicating with the terminal first is obtaining the manual for the POS communication protocol you are trying to use from the device manufacturer or from the vendor. It also helps if you detail what you are trying to achieve with the POS device...Download software, use the ECR functionality,etc.

JD_GRINDER
  • 344
  • 2
  • 6
  • Yes, you're right I found it "Field Separator character" not dot, but still I don't know the best the right way to communicate this device, I have no manuals or any document to help except a brief one contains only the messages format, but I don't know how to attache it here, and what I'm trying to do is to communicate from my system to send the amount to the terminal and receive the acknowledgments from it – Mohamed May 05 '15 at 05:49
  • Copy the document data in here if you can. If not simply put the document on http://pastebin.com/ and share the link here. So as i assumed you are trying to use an ECR protocol most probably implemented by a vendor for your Verifone terminal application. Technically you have to replicate the messages in that document exactly first and see if the terminal responds. – JD_GRINDER May 06 '15 at 03:52
  • I've shared the first message in the document, Sorry I don't have a soft copy of the document – Mohamed May 06 '15 at 05:52