search

Wired ECR SDK

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 min .net framework supported version is 3.5.

 

Download SDK

Paytm provides sdk for .NET / Java & Python languages. The corresponding library (.dll / .jar & .tar respectivel) can be downloaded from

  1. .NET 3.5
  2. .NET 4.0+
  3. Java
  4. Python3

Usage - How to add .dll / .jar / .tar 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:

     

    copy icon
       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+

SDK Methods

*Note :- Actual number of method and / or method parameters may slightly differ between .NET / JAVA & Python as the particular sdk may be behind in terms of new feature development.

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)
7 PreAuth(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 preAuthTxnType, string preAuthAmount) To initiate a preAuth transaction on the terminal with given amount and orderId. string (JSON)
8 PreAuthStatus(string portName, int baudRate, int parity, int dataBits, int stopBits, int debugMode, string merchantId, string orderId, string preAuthTxnType) To check the status of a preAuth transaction. string (JSON)
9

ReadCard(string portName, int baudRate, int parity, int dataBits, int stopBits, int debugMode, string merchantId, string orderId, string flowType, 
string cardBlockNumber, string cardMfType) 

To initiate a request to a pos device to read the card data for the closed loop card. string (JSON)
10 ReadCardStatus(string portName, int baudRate, int parity, int dataBits, int stopBits, int debugMode, string merchantId, string orderId) To get the information (card no, card block no) about the tapped closed loop card. string (JSON)
11 UpdateCard(string portName, int baudRate, int parity, int dataBits, int stopBits, int debugMode, string merchantId, string orderId, string flowType, string cardData, string cardBlockNumber, string cardMfType) To initiate a request to update the card data for the closed loop card. string (JSON)
12 UpdateCardStatusQuery(string portName, int baudRate, int parity, int dataBits, int stopBits, int debugMode, string merchantId, string orderId) To get the updated information (card no, card block no) about the tapped closed loop card. string (JSON)

 

Sample Request and Response

 

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

 

S.No.

Method

Request

Response

1. Sale

 ("COM1", 115200, 0, 8, 1, 1, "MID","order1" ,"All", "10000" , "FOOD:2|GIFT:6", "extendinfo://values?productValidationValue=12764874894894898&merchantTxnId=82938938983&caNumber=34567777&brandId=1707&modelId=43LF513A&ean=6666abCD&phoneNumber=9824871264&invoiceNumber=12347877&imei=199888887&emiTenures=3,6","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": "MID",
"orderId": "order1",
"amount": "10000",
"statusCode": "001",
"statusMessage": "Process Transaction has been Initiated",
"extendInfo": "extendinfo://values?productValidationValue=12764874894894898&merchantTxnId=82938938983&caNumber=34567777&brandId=1707&modelId=43LF513A&ean=6666abCD&phoneNumber=9824871264&invoiceNumber=12347877&imei=199888887&emiTenures=3,6",
"printInfo": "printInfo://values?merchantTxnId=82938938983&caNumber=34567777&billNumber=xyz123"
}
 

If StatusCheckOnSaleRequestEnabled is Enabled in Configurations on Sale request

 

(Since Wired ECR library is configuration-driven, if merchant has enabled this "StatusCheckOnSaleRequestEnabled" flag in configurations then on Sale Request itself, this library will start checking the status of the transaction after 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))

 

{
"merchantId": "MID",
"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",

"issuingBankId": "",
"amount": "10000",
"txnType": "CARD",
"invoiceNumber": "000002",
"extendInfo": "extendinfo://values?productValidationValue=12764874894894898&merchantTxnId=82938938983&caNumber=34567777&brandId=1707&modelId=43LF513A&ean=6666abCD&phoneNumber=9824871264&invoiceNumber=12347877&imei=199888887&emiTenures=3,6",
"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": "",

"bankOfferCampaignId": "",

"bankOfferType2": "",
"bankOfferAmount2": "",

"bankOfferCampaignId2": "",

"bankOfferType3": "",
"bankOfferAmount3": "",

"bankOfferCampaignId3": "",

"bankOfferType4": "",
"bankOfferAmount4": "",

"bankOfferCampaignId4": "",
"subventionCreated": "false",
"subventionType": "",
"subventionOfferAmount": "",

"subventionCampaignId":"",
"acquiringBank" : "ICICI",
"virtualPaymentAddress":"9650*****0@paytm",

"tipAmount":"100",

"totalAmount":"1000",

"responseExtendInfo": "responseExtendInfo://values?productPrice=880000&originalAmount=1000000&protectionPlanAmount=120000&protectionPlanDuration=1%20YEAR&protectionPlanProvider=OneAssist&protectionPlanName=ADLD&protectionPlanMembershipId=",
"statusCode": "101",
"statusMessage": "Transaction was successful"
}

2. Void  ("COM1", 115200, 0, 8, 1, 1, "MID", "order1", "extendinfo://values?merchantTxnId=82938938983&caNumber=34567777") {
"merchantId": "MID",
"orderId": "order1",
"statusCode": "000",
"statusMessage": "Command Initiated Successfully"
}
3. Cancel  ("COM1", 115200, 0, 8, 1, 1, "MID", "order1") {
"merchantId": "MID",
"orderId": "order1",
"statusCode": "000",
"statusMessage": "Command Initiated Successfully"
}
4.  Status  ("COM1", 115200, 0, 8, 1, 1,"MID", "order1" )

{
"merchantId": "MID",
"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",
 "version": "1.1.0"
}

6. PrintReceipt  ("COM1", 115200, 0, 8, 1, 1, "MID" , "order1") {
"merchantId": "MID",
"orderId": "order1",
"statusCode": "000",
"statusMessage": "Command Initiated Successfully"
}
7. PreAuth  ("COM1", 115200, 0, 8, 1, 1, "MID","order1" ,"All", "10000" , "FOOD:2|GIFT:6", "extendinfo://values?productValidationValue=12764874894894898&merchantTxnId=82938938983&caNumber=34567777&brandId=1707&modelId=43LF513A&ean=6666abCD&phoneNumber=9824871264&invoiceNumber=12347877&imei=199888887&emiTenures=3,6","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",  "PREAUTH", "10000")

{
"merchantId": "MID",
"orderId": "order1",
"amount": "10000",
"statusCode": "001",
"statusMessage": "Process Transaction has been Initiated",
"extendInfo": "extendinfo://values?productValidationValue=12764874894894898&merchantTxnId=82938938983&caNumber=34567777&brandId=1707&modelId=43LF513A&ean=6666abCD&phoneNumber=9824871264&invoiceNumber=12347877&imei=199888887&emiTenures=3,6",
"printInfo": "printInfo://values?merchantTxnId=82938938983&caNumber=34567777&billNumber=xyz123",
"preAuthTxnType" : "PREAUTH"
}

 

If StatusCheckOnSaleRequestEnabled is Enabled in Configurations on Sale request

 

(Since Wired ECR library is configuration-driven, if merchant has enabled this "StatusCheckOnSaleRequestEnabled" flag in configurations then on Sale Request itself, this library will start checking the status of the transaction after 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))

 

{
"merchantId": "MID",
"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",
"issuingBankId": "",
"amount": "10000",
"txnType": "CARD",
"invoiceNumber": "000002",
"extendInfo": "extendinfo://values?productValidationValue=12764874894894898&merchantTxnId=82938938983&caNumber=34567777&brandId=1707&modelId=43LF513A&ean=6666abCD&phoneNumber=9824871264&invoiceNumber=12347877&imei=199888887&emiTenures=3,6",
"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",
"acquiringBank" : "ICICI",
"preAuthTxnType" "PREAUTH"
"statusCode": "101",
"statusMessage": "Transaction was successful"
}

8. PreAuthStatus ("COM1", 115200, 0, 8, 1, 1,"MID", "order1", "CAPTURE" ) {
"merchantId": "MID",
"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",
"issuingBankId": "",
"amount": "10000",
"txnType": "CARD",
"invoiceNumber": "000002",
"extendInfo": "extendinfo://values?productValidationValue=12764874894894898&merchantTxnId=82938938983&caNumber=34567777&brandId=1707&modelId=43LF513A&ean=6666abCD&phoneNumber=9824871264&invoiceNumber=12347877&imei=199888887&emiTenures=3,6",
"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",
"acquiringBank" : "ICICI",
"preAuthTxnType" "PREAUTH"
"statusCode": "101",
"statusMessage": "Transaction was successful"
}
9.  ReadCard

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

{
"merchantId": "MID",
"orderId": "order1",
"statusCode": "001",
"statusMessage": "Process Transaction has been Initiated"
}
 

If ReadCardStatusCheckOnRequestEnabled is Enabled in Configurations on ReadCard request

 

(Since Wired ECR library is configuration-driven, if merchant has enabled this "ReadCardStatusCheckOnRequestEnabled" flag in configurations then on ReadCard Request itself, this library will start checking the status of the card data after 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 request timeout is configurable))

  {
"merchantId": "MID",
"orderId": "order1",
"cardNo": "E44F8D09",
"cardBlockValue": "0001111111110003",
"statusCode": "101",
"statusMessage": "Transaction was successful"
}
 10.   UpdateCard ("COM1", 115200, 0, 8, 1, 1, "MID" , "order1", "closed" , "0001111111110005" ,"1" , "MF") {
"merchantId": "MID",
"orderId": "order1",
"statusCode": "001",
"statusMessage": "Process Transaction has been Initiated"
}
   

If UpdateCardStatusCheckOnRequestEnabled is Enabled in Configurations on UpdateCard request

 

(Since Wired ECR library is configuration-driven, if merchant has enabled this "UpdateCardStatusCheckOnRequestEnabled" flag in configurations then on UpdateCard Request itself, this library will start checking the status of the card data after 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 request timeout is configurable))

  {
"merchantId": "MID",
"orderId": "order1",
"cardNo": "E44F8D09",
"statusCode": "101",
"statusMessage": "Transaction was successful" 
}

 

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 (defaults 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 library for each request made to EDC terminal.
12. preAuthTxnType Mandatory Parameter for PreAuth API, values can be PREAUTH / CAPTURE / RELEASE
13 preAuthAmount Mandatory Parameter for PreAuth API , in case of CAPTURE / RELEASE transaction, preAuthAmount is the amount
for which preAuth was done.
14. flowType Mandatory Parameter Only For Read / Write Card Feature
To read a closed loop card data, flowType must be present. Accepted value = "closed".
15. cardBlockNumber Mandatory Parameter Only For Read / Write Card Feature
To fetch the card block number data, merchant needs to pass which block no value he/she required, eg: "1" and now we can pass the multiple card block number with comma separated, eg: "1,2,4"
16. cardMfType  Mandatory Parameter Only For Read / Write Card Feature
Determines card manufacture type. Only three values are accepted as of now. ["MF, MFU, MFUC"]
17. cardData To Write a closed loop card, This param is to be used to write the block values in closed loop card eg: "12345678" and you can pass multiple block write values with comma separated as per the requested block numbers. eg: "12345678,87655432"

 

Optional Arguments

 

1. extendInfo

extendInfo parameter can be used by merchants to pass any numbers of extra parameters in SALE request or VOID request, the extendInfo parameter should be in a valid uri form and merchants can add any parameters in 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 numbers of extra parameters in SALE request which needs to be printed on 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 : gstIngstBrkUpinvoiceNo & 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 EDC devices where user confirmation for Void functionality is not required.

7.

tipAmount

Optional Parameter, the parameter should be in paisa. Tip amount should not be more than maximum allowed amount for the Merchant.

8.

totalAmount

If tipAmount is present Request, then totalAmount must have to be present in the request otherwise this request will be rejected by Payments app. Sum of tipAmount field and amount field of the request must equals totalAmount field otherwise request will be rejected.

9.

keyType

For read/write closed loop card block number, This param is to be used for card authentication (TYPE_A or TYPE_B) and the default value is TYPE_A.

10.

keysCsv

For read/write closed loop card block number, This param is to be used for card authentication and the default value is FFFFFFFFFFFF. You can pass multiple values with comma separated for multiple blocks eg: FFFFFFFFFFFF,FFFFFFFFFFFF etc.

 

 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.