C Libraries
C/C++ Windows Library
Lowest-level integration with two headers: SBCoreECR.h and EcrApi.h.
Core Functions (SBCoreECR.h)
int pack(const char* inputReqData, int transactionType, const char* szSignature, unsigned char* szEcrBuffer);
int parse(const unsigned char* respData, unsigned char* szRespFields);
High-Level API (EcrApi.h)
int doTCPIPTransaction(char* ip, int port, char* request, int txnType, char* signature, char* response);
int doCOMTransaction(char* port, int baud, int parity, int databit, int stopbit, char* request, int txnType, char* signature, char* response);
int doBlueToothTransaction(char* btaddr, char* request, int txnType, char* signature, char* response);
Usage Example
#include "EcrApi.h"
int main() {
char response[4096] = {0};
int status = doTCPIPConnection("192.168.0.102", 8888);
if (status != 0) return -1;
doTCPIPTransaction("192.168.0.102", 8888, requestData, 17, signature, response); // Register
doTCPIPTransaction("192.168.0.102", 8888, requestData, 18, signature, response); // Session
doTCPIPTransaction("192.168.0.102", 8888, requestData, 0, signature, response); // Purchase
printf("Response: %s\n", response);
doDisConnection();
return 0;
}
Transaction Type Codes
| Code | Transaction Type |
|---|---|
| 0 | Purchase |
| 1 | Purchase with Naqd/Cashback |
| 2 | Refund |
| 3 | Authorization |
| 4 | Purchase Advice (Full) |
| 5 | Purchase Advice (Partial) |
| 6 | Auth Extension |
| 7 | Auth Void |
| 9 | Cash Advance |
| 10 | Reconciliation |
| 11 | Reversal |
| 15 | Bill Payment |
| 17 | Register |
| 18 | Start Session |
| 19 | End Session |
| 23 | Duplicate / Previous Txn |
| 24 | Check Status |
| 25 | Health Check |
Updated 4 days ago