search
Your Paytm for business app is working and will keep working beyond March 15th, 2024. Click to know more

Wired ECR DLL

Overview

 

The Paytm POS Machine and billing system will remain connected through a USB wire. For establishing this connection, the Paytm wired ECR library is used as an interface between the Merchant's POS and Paytm POS Machine. Merchant's POS needs to be integrated with this library and once it is done, library methods can be invoked to accept payment. Everything starting from communicating with a terminal via serial port comm., sending payment requests, getting a response from the device, and then sending it back to the Merchants POS will be taken care by this library. 

 

 Note:

  • The supported .net framework versions are 3.5, 4.0, 4.6, 4.2.  
  • Download wired DLL Library by clicking here.

 

Usage - How to add dLL / library in the project and sample code

 

  1.  C# -

     

    •  Add the C# library (.dll) in any C# application by reference or reflection.
    • Create an object of the class Payments.
    • Now, call the required methods on the created object with the specified arguments.

     

     

    Example:

     

       Payments payments = new Payments( );
         //  To initiate a transaction on terminal with provided transaction amount
         payments . Sale( portName,  baudRate, parity, dataBits, stopBits, debugMode, merchantId, orderId, paymentMode, amount, subWalletInfo, extendInfo,
         printInfo, gstInformation, cardReadMode); 

     

  2. VB.Net+
  3. Visual Basic 6+
  4. Java+
  5. Python 3+

Library Methods

 

S.No. Methods Description Return Type
1 Sale(String portName, int baudRate, int parity, int dataBits, int stopBits, int debugMode, string merchantId,
string OrderId , string paymentMode, string amount, string subWalletInfo, string extendInfo, string printInfo, string gstInformation, string cardReadMode, string tipAmount, string totalAmount)
To initiate a transaction on the terminal with the provided transaction amount. string (JSON)
2 Void(String portName, int baudRate, int parity, int dataBits, int stopBits, int debugMode, string merchantId, string OrderId, string extendInfo) To Initiate refund of processed transactions. string (JSON)
3 Cancel(String portName,int baudRate, int parity, int dataBits, int stopBits, int debugMode,string merchantId, string OrderId) To cancel an ongoing transaction on the terminal. string (JSON)
4 Status(String portName, int baudRate,int parity, int dataBits, int stopBits, int debugMode,string merchantId, string OrderId) To get the transaction status. string (JSON)
5 ConnectionCheck(String portName, int baudRate, int parity, int dataBits, int stopBits, int debugMode)  To check terminal connection status. string (JSON)
6 PrintReceipt(String portName, int baudRate, int parity, int dataBits, int stopBits, int debugMode, string merchantId, string OrderId) To print the paper receipt of the provided orderId from the terminal. string (JSON)

 

Sample Request and Response

 

Below are sample Request and Response parameters for all Library Methods:

 

 

S.No.

Method

Request

Response

1.

Sale

 

 

 

 

 

 

 

 

 

 

 

 

 

If StatusCheckOnSaleRequestEnabled is Enabled in Configurations on Sale request

(Since the Wired ECR library is configuration-driven, if the merchant has enabled this "StatusCheckOnSaleRequestEnabled" flag in configurations then on Sale Request itself, this library will start checking the status of the transaction after a certain interval of time (configurable), and then will send the final status response of transaction to the merchant in JSON string (all these status check start time, interval, and sale request timeout is configurable)).

("COM1", 115200, 0, 8, 1, 1, "MID","order1" ,"All", "10000" , "FOOD:2|GIFT:6", "extendInfo://values?productValidationValue=12764874894894898&merchantTxnId=82938938983&
caNumber=34567777","printInfo://values?merchantTxnId=82938938983&caNumber=34567777&billNumber=xyz123","gstInformation://values?gstIn=08TESTF0078P1ZP&gstBrkUp=CGST:10|SGST:10| IGST:10| CESS:10| GSTIncentive:10| GSTPCT:10&invoiceNo=Invoice34234321&invoiceDate=2019-06-11T13:21:50+05:30", "ALL", "100", "1000")

{

"merchantId": "YOUR_MID_HERE",

"orderId": "order1",

"amount": "10000",

"statusCode": "001",

"statusMessage": "Process Transaction has been Initiated",

"extendInfo": "extendInfo://values?productValidationValue=12764874894894898&merchantTxnId=82938938983&

caNumber=34567777",

"printInfo": "printInfo://values?merchantTxnId=82938938983&caNumber=34567777&billNumber=xyz123"

}

 

{
"merchantId": "YOUR_MID_HERE",
"orderId": "order1",
"txnId": "20201229111212800110168957300518436",
"authCode": "000179",
"txnDate": "29 Dec 2020, 06:52:55 PM",
"rrn": "000011386153",
"cardNo": "402985******4207",
"issuingBank": "Bank of Bahrain and Kuwait",
"amount": "10000",
"txnType": "CARD",
"invoiceNumber": "000002",
"extendInfo": "extendInfo://values?productValidationValue=12764874894894898&merchantTxnId=82938938983&
caNumber=34567777",
"printInfo": "printInfo://values?merchantTxnId=82938938983&caNumber=34567777&billNumber=xyz123" ,
"tid": "12349162",
"aid": "A0000000031010",
"payMethod": "DEBIT_CARD",
"cardType": "DEBIT_CARD",
"cardScheme": "VISA",
"bankResponseCode": "00",
"bankMid": "5PT000000000878",
"bankTid": "5P004052",
"productManufacturer": "",
"productCategory": "",
"productSerialNoType": "",
"productSerialNoValue": "",
"productName": "",
"emiTxnType": "",
"emiTenure": "",
"emiInterestRate": "",
"emiMonthlyAmount": "",
"emiTotalAmount": "",
"bankOfferApplied": "false",
"bankOfferType": "",
"bankOfferAmount": "",
"subventionCreated": "false",
"subventionType": "",
"subventionOfferAmount": "",
"acquiringBank" : "ICICI",
"virtualPaymentAddress":"9650*****0@paytm",                        "tipAmount":"100",                                                  "totalAmount":"1000",
"statusCode": "101",
"statusMessage": "Transaction was successful"
}

2.

Void

("COM1", 115200, 0, 8, 1, 1, "MID", "order1", "extendinfo://values?merchantTxnId=82938938983&caNumber=34567777")

{

"merchantId": "YOUR_MID_HERE",

"orderId": "order1",

"statusCode": "000",

"statusMessage": "Command Initiated Successfully"

}

3.

Cancel

("COM1", 115200, 0, 8, 1, 1, "MID", "order1")

{

"merchantId": "YOUR_MID_HERE",

"orderId": "order1",

"statusCode": "000",

"statusMessage": "Command Initiated Successfully"

}

4. 

Status

("COM1", 115200, 0, 8, 1, 1,"MID", "order1" )

{
"merchantId": "YOUR_MID_HERE",
"orderId": "order1",
"txnId": "20201229111212800110168957300518436",
"authCode": "000179",
"txnDate": "29 Dec 2020, 06:52:55 PM",
"rrn": "000011386153",
"cardNo": "402985******4207",
"issuingBank": "Bank of Bahrain and Kuwait",
"amount": "10000",
"txnType": "CARD",
"invoiceNumber": "000002",
"extendInfo": "extendInfo://values?productValidationValue=12764874894894898&merchantTxnId=82938938983&
caNumber=34567777",
"printInfo": "printInfo://values?merchantTxnId=82938938983&caNumber=34567777&billNumber=xyz123"
"tid": "12349162",
"aid": "A0000000031010",
"payMethod": "DEBIT_CARD",
"cardType": "DEBIT_CARD",
"cardScheme": "VISA",
"bankResponseCode": "00",
"bankMid": "5PT000000000878",
"bankTid": "5P004052",
"productManufacturer": "",
"productCategory": "",
"productSerialNoType": "",
"productSerialNoValue": "",
"productName": "",
"emiTxnType": "",
"emiTenure": "",
"emiInterestRate": "",
"emiMonthlyAmount": "",
"emiTotalAmount": "",
"bankOfferApplied": "false",
"bankOfferType": "",
"bankOfferAmount": "",
"subventionCreated": "false",
"subventionType": "",
"subventionOfferAmount": "",
"acquiringBank" : "ICICI",
"virtualPaymentAddress":"9650*****0@paytm",                                              "tipAmount":"100",                                                                                    "totalAmount":"1000",
"statusCode": "101",
"statusMessage": "Transaction was successful"
}

5.

ConnectionCheck

("COM1", 115200, 0, 8, 1, 1)

{

"statusCode": "000",

"statusMessage": "Command Initiated Successfully"

}

6.

PrintReceipt

("COM1", 115200, 0, 8, 1, 1, "MID", "order1")

{

"merchantId": "YOUR_MID_HERE",

"orderId": "order1",

"statusCode": "000",

"statusMessage": "Command Initiated Successfully"

}

 

Mandatory Arguments

 

S.No. Name Description
1 merchantId Unique Merchant ID ( Paytm Merchant Id )
2 OrderId The unique id of the order ( Merchant Txn Id )
3 amount The Order amount (in Paise)
4 paymentMode paymentMode for sale request (CARD / QR / ALL)
5 portName Name of the COM port the device is connected to
6 baudRate Maximum number of bits the serial port is capable of transferring (default is 115200)
7 dataBits Data bits to use per word (default is 8)
8 stopBits Number of stop bits (default is 1)
9 parity Specifies how error detection is carried out (default is 0)
10 debugMode 0 for ignoring the logs or 1 for printing the logs
11 RequestId Unique request id that will be generated in the library for each request made to the Paytm POS Machine.

 

Optional Arguments

 

S.No. Name Description
1 extendInfo

extendInfo parameter can be used by merchants to pass any number of extra parameters in a SALE request or VOID request, the extendInfo parameter should be in a valid uri form and merchants can add any parameters in the query in the uri.

 

Example: 

 

"extendInfo://values?productValidationValue=12764874894894898&merchantTxnId=82938938983&caNumber=34567777"

 

If the format of extendInfo is not correct, it will be ignored. All the params in extended Info will be passed as it is to Paytm Middleware in the corresponding API calls.

2 printInfo

printInfo parameter can be used by merchants to pass any number of extra parameters in SALE request that need to be printed on the SALE receipt. The printInfo parameter should be in a valid uri form and merchants can add any parameters in query in the uri.

 

Example: 

 

"printInfo://values?merchantTxnId=82938938983&caNumber=34567777&billNumber=xyz123"

 

If the format of printInfo is not correct, it will be ignored.

3 gstInformation

gstInformation parameter can be used by merchants to pass gst Info in SALE request. The gstInformation parameter should be in a valid uri form and merchants need to pass all valid gst Info params as given below:

 

Example: 

 

"gstInformation://values?gstIn=08TESTF0078P1ZP&gstBrkUp=CGST:10|SGST:10|IGST:10|CESS:10|GSTIncentive:10|GSTPCT:10&invoiceNo=Invoice34234321&invoiceDate=20210512142919"

 

If the format of gstInformation is not correct or any param is missing, it will be ignored.
Mandatory params in gstInfo: gstIn, gstBrkUp, invoiceNo & invoiceDate

 

 Note:  invoiceDate parameter in gstInformation should be in IST format (yyyyMMddHHmmss)

4 subWalletInfo

Optional parameter for enabling users to pay through different types of Paytm wallet in case of QR payment. Make sure that the sum of amounts in this parameter is less than or equal to the total transaction amount. Two types of wallets are supported: FOOD & GIFT.

The parameter should be in the format "FOOD:2000|GIFT:3000" only. Amounts are in Paise.

5 cardReadMode cardReadMode for sale request (SWIPE / INSERT / TAP / ALL) (Method to be used for Card Reading)
6 autoAccept Optional Parameter, can be sent in extednInfo with string value true. This param is to be used for unattended Paytm POS machines where user confirmation for Void functionality is not required.
7 tipAmount Optional Parameter, the parameter should be in paisa. The tip amount should not be more than the maximum allowed amount for the Merchant.
8 totalAmount If tipAmount is present in the Request, then totalAmount must be present in the request otherwise this request will be rejected by the Payments app. Sum of tipAmount field and amount field of the request must equal totalAmount field otherwise the request will be rejected.

 

 Note: All the parameters having the form of URI (extendInfo, printInfo, gstInformation) should have proper escape sequence for all the special characters, in case the values of query parameters contain special characters, otherwise the data may not be interpreted correctly by the devices.