Electronic Cash Register Simulator Tool

The Electronic Cash Register Tool (remote-serial-pay.py) is a test application installed on the host computer, which merchant developers can use to simulate ECR transactions to the Maya Terminal. This tool can be used for both terminal types, Sunmi P2 and PAX A920.

ℹ️ The Electronic Cash Register (ECR) Tool is only a simulator for testing requests between the Maya Terminal. The Electronic Cash Register application or Merchant ECR Plugin that will be used for your stores are developed by your team.

Learn about Maya’s Terminals, the pre-requisites and understand how Maya ECR Integration works.


Setting up the Tool

ℹ️ Reach out to your designated Maya Relationship Manager or email [email protected] ,for the latest ECR integration kit.

Step 1: Extract the remote-serial-pay.py

Click here to view full details

From the provided ECR Integration Kit, obtain the ECR Simulator under the ECR Tools directory.

Step 2: Install Python

Click here to view full details

Go to Download Python, and download the latest Python installer compatible to your computer. If your Python installation does not come with pip, install pip manually

Step 3: Install the dependencies

Click here to view full details

Install the following dependencies of remote-serial-pay.py:

  1. pythoncrc
pip install pythoncrc
  1. pyserial
pip install pyserial

ℹ️ Unable to find the dependecies?

Try installing pythoncrc instead of pycrc : pip install pythoncrc or create a virtual environment and install dependencies there.


Know the Simulator Commands

  1. Check the available serial ports in the Host PC.
python remote-serial-pay.py --list
  1. Quick connectivity check. ECR app responds with ACK.
python remote-serial-pay.py -t COM11 -c CHECK
  1. Run ECR commands using test script.
python remote-serial-pay.py -t COM11 -c SALE --amount 1000
  1. To list all supported commands, type in -h / --help option.
python remote-serial-pay.py --help
  1. To enable debug mode, type in -d / --debug option.
python remote-serial-pay.py -t COM11 -c SALE --amount 1000 -–debug

ECR Tool Sample Outputs

The ECR Tool simulates the request and responses between an ECR application and the Maya Terminal. For complete information regarding transaction types and requests, refer to the latest Electronic Cash Register (ECR) Specifications documentation.

ℹ️ Reach out to your designated Maya Relationship Manager or email [email protected] ,for the latest ECR integration kit.

⚠️ The codes in this section are only examples of the request and responses, to show the experience when using the simulator. Refer to Know the Simulator Commands for the commands you could use.

Basic Sale Transaction

Click here to view full details
$ python remote-serial-pay.py -t /dev/cu.usbmodem1423 -c SALE --amount 1000 --debug
REQUEST: {
 "dataType": "trans",
 "data": {
 "amt": "1000",
 "cmd": "sale",
 "detail": "Y"
 }
}
RAW REQUEST
0000004E7B226461746154797065223A20227472616E73222C202264617461223A207B22616D74223A2022313030302
22C2022636D64223A202273616C65222C202264657461696C223A202259227D7DCE4A
RAW RESPONSE 000000147B226461746154797065223A2261636B227DFA22
RESPONSE: {
 "dataType": "ack"
}
RAW RESPONSE
000001E97B2264617461223A7B22616964223A224130303030303030303331303130222C22617070223A22564953412
054455354222C22617463223A2230304532222C2261757468436F6465223A22303239323233222C2262617463684E6F
223A22303030303032222C226361726454797065223A2256495341222C22656E7465724D6F6465223A2254222C22656
E7465724D6F6465436F6465223A22303731222C226D65726368616E744964223A22454653313030303031313439222C
226E6F5369676E223A2259222C2270616E223A222A2A2A2A2A2A2A2A2A2A2A2A30303638222C227265666572656E636
54E6F223A22383332353036303830313330222C22726573706F6E7365436F6465223A223030222C22726573706F6E73
6554657874223A2254786E204163636570746564222C22737461747573223A2241222C22737474223A2259222C22746
5726D696E616C4964223A223132333435363738222C22747369223A2230303030222C22747672223A22303030303030
30303030222C2274786E44617465223A223230313831313231222C2274786E4964223A22303030303230222C2274786
E54696D65223A2231343038222C2274786E54797065223A2273616C65222C22616D74223A2231303030227D2C226461
746154797065223A227472616E73227D73C0
REQUEST {
 "data": {
 "aid": "A0000000031010",
 "app": "VISA TEST",
 "atc": "00E2",
 "authCode": "029223",
 "batchNo": "000002",
 "cardType": "VISA",
 "enterMode": "T",
 "enterModeCode": "071",
 "merchantId": "EFS100001149",
 "noSign": "Y",
 "pan": "************0068",
 "referenceNo": "832506080130",
 "responseCode": "00",
 "responseText": "Txn Accepted",
 "status": "A",
 "stt": "Y",
 "terminalId": "12345678",
 "tsi": "0000",
 "tvr": "0000000000",
 "txnDate": "20181121",
 "txnId": "000020",
 "txnTime": "1408",
 "txnType": "sale",
 "amt": "1000"
 },
 "dataType": "trans"
}
RESPONSE {
 "dataType": "ACK"
}
RAW REQUEST 000000157B226461746154797065223A202241434B227DE2BD

Sale Transaction with Status Monitoring

Click here to view full details
$ python remote-serial-pay.py -t /dev/cu.usbmodem1423 -c SALE --amount 1000 --debug --
subscribe
REQUEST: {
 "dataType": "trans",
 "data": {
 "amt": "1000",
 "subscribe": "Y",
 "cmd": "sale",
 "detail": "Y"
 }
}
RAW REQUEST
000000607B226461746154797065223A20227472616E73222C202264617461223A207B22616D74223A2022313030302
22C2022737562736372696265223A202259222C2022636D64223A202273616C65222C202264657461696C223A202259
227D7D1645
RAW RESPONSE 000000147B226461746154797065223A2261636B227DFA22
RESPONSE: {
 "dataType": "ack"
}
RAW RESPONSE
000000477B2264617461223A7B2274786E54797065223A2273616C65222C22737461747573223A22494E5055545F434
15244227D2C226461746154797065223A22737461747573227D3172
STATUS {
 "data": {
 "txnType": "sale",
 "status": "INPUT_CARD"
 },
 "dataType": "status"
}
RAW RESPONSE
000000467B2264617461223A7B2274786E54797065223A2273616C65222C22737461747573223A22434C53535F50524
F43227D2C226461746154797065223A22737461747573227D5F27
STATUS {
 "data": {
 "txnType": "sale",
 "status": "CLSS_PROC"
 },
 "dataType": "status"
}
RAW RESPONSE
0000004A7B2264617461223A7B2274786E54797065223A2273616C65222C22737461747573223A225052494E545F524
54345495054227D2C226461746154797065223A22737461747573227D48C3
STATUS {
 "data": {
 "txnType": "sale",
 "status": "PRINT_RECEIPT"
 },
 "dataType": "status"
}
RAW RESPONSE
000001E97B2264617461223A7B22616964223A224130303030303030303331303130222C22617070223A22564953412
054455354222C22617463223A2230304533222C2261757468436F6465223A22303737363535222C2262617463684E6F
223A22303030303033222C226361726454797065223A2256495341222C22656E7465724D6F6465223A2254222C22656
E7465724D6F6465436F6465223A22303731222C226D65726368616E744964223A22454653313030303031313439222C
226E6F5369676E223A2259222C2270616E223A222A2A2A2A2A2A2A2A2A2A2A2A30303638222C227265666572656E636
54E6F223A22383332353036313734383833222C22726573706F6E7365436F6465223A223030222C22726573706F6E73
6554657874223A2254786E204163636570746564222C22737461747573223A2241222C22737474223A2259222C22746
5726D696E616C4964223A223132333435363738222C22747369223A2230303030222C22747672223A22303030303030
30303030222C2274786E44617465223A223230313831313231222C2274786E4964223A22303030303232222C2274786
E54696D65223A2231343235222C2274786E54797065223A2273616C65222C22616D74223A2231303030227D2C226461
746154797065223A227472616E73227D0B0E
REQUEST {
 "data": {
 "aid": "A0000000031010",
 "app": "VISA TEST",
 "atc": "00E3",
 "authCode": "077655",
 "batchNo": "000003",
 "cardType": "VISA",
 "enterMode": "T",
 "enterModeCode": "071",
 "merchantId": "EFS100001149",
 "noSign": "Y",
 "pan": "************0068",
 "referenceNo": "832506174883",
 "responseCode": "00",
 "responseText": "Txn Accepted",
 "status": "A",
 "stt": "Y",
 "terminalId": "12345678",
 "tsi": "0000",
 "tvr": "0000000000",
 "txnDate": "20181121",
 "txnId": "000022",
 "txnTime": "1425",
 "txnType": "sale",
 "amt": "1000"
 },
 "dataType": "trans"
}
RESPONSE {
 "dataType": "ACK"
}
RAW REQUEST 000000157B226461746154797065223A202241434B227DE2BD

Void Sale Transaction

Click here to view full details
$ python remote-serial-pay.py -t /dev/cu.usbmodem1423 --debug -c VOID --txnId 22
REQUEST: {
 "dataType": "trans",
 "data": {
 "txnId": "22",
 "cmd": "void"
 }
}
RAW REQUEST
0000003F7B226461746154797065223A20227472616E73222C202264617461223A207B2274786E4964223A202232322
22C2022636D64223A2022766F6964227D7DEF03
RAW RESPONSE 000000147B226461746154797065223A2261636B227DFA22
RESPONSE: {
 "dataType": "ack"
}

Settle Transaction

Click here to view full details
$ python remote-serial-pay.py -t /dev/cu.usbmodem1423 --debug -c SETTLE
REQUEST: {
 "dataType": "trans",
 "data": {
 "cmd": "settle"
 }
}
RAW REQUEST
000000327B226461746154797065223A20227472616E73222C202264617461223A207B22636D64223A2022736574746
C65227D7DDF62
RAW RESPONSE
000000967B2264617461223A7B2262617463684E6F223A22303030303033222C22726573706F6E7365436F6465223A2
23030222C22726573706F6E736554657874223A2254786E204163636570746564222C22737461747573223A2241222C
2274786E54797065223A22736574746C65222C22626174636855706C6F6164223A224E227D2C2264617461547970652
23A227472616E73227DF56A
RESPONSE: {
 "data": {
 "batchNo": "000003",
 "responseCode": "00",
 "responseText": "Txn Accepted",
 "status": "A",
 "txnType": "settle",
 "batchUpload": "N"
 },
 "dataType": "trans"
}