Library Reference
The Nami ECR .NET SDK enables a .NET-based Merchant Application to communicate with a Nami Payment Terminal. The SDK provides APIs for terminal registration, session management, payment processing, and communication over TCP/IP or Serial (COM) interfaces.
For integration steps, refer to .Net Integration.
The SDK abstracts low-level communication and allows applications to initiate payment transactions and receive transaction responses through standardized protocols.
Prerequisites
Ensure that the following requirements are met before integrating the SDK.
| Requirement | Description |
|---|---|
| .NET Framework | .NET Framework 4.8 or compatible version |
| Development Environment | Microsoft Visual Studio |
| Programming Knowledge | Basic knowledge of C# and .NET development |
| Payment Terminal | Compatible Nami Payment Terminal |
| Connectivity | TCP/IP network access or Serial (COM) connection |
Installation Requirements
Add Managed Library
Add the CoreSkybandECR library to the project.
- Open Visual Studio.
- Open the project solution.
- Right-click References.
- Select Add Reference.
- Browse and select CoreSkybandECR.dll.
Add Native Library
Add the ECR native library to the project.
- Right-click the project.
- Select Add > Existing Item.
- Browse and select ECR.dll.
Configure Output Directory
Select ECR.dll and set:
Copy to Output Directory = Always
The ECR.dll file must be available in the application output directory during runtime.
Required Libraries
| Library | Description |
|---|---|
| CoreSkybandECR.dll | Primary .NET SDK library |
| ECR.dll | Native communication library dependency |
Supported Communication Methods
| Communication Type | Supported |
|---|---|
| TCP/IP | Yes |
| Serial (COM) | Yes |
Architecture Overview
The Merchant Application communicates with the Payment Terminal through the SDK.
Merchant Application
↓
CoreSkybandECR SDK
↓
Nami Payment Terminal
All terminal communication is performed through the InteroperableService class.
Core Namespace
Include the following namespace before using the SDK.
using CoreSkybandECR;
Core Class Reference
InteroperableService
The InteroperableService class provides all communication and transaction APIs.
Use the following code to create an SDK instance:
InteroperableService ecr = new InteroperableService();
API Summary
| Method | Description |
|---|---|
| doTCPIPConnection() | Connects to a terminal over TCP/IP |
| doTCPIPTransaction() | Sends a transaction over TCP/IP |
| doTCPIPDisconnection() | Disconnects a TCP/IP session |
| doCOMConnection() | Connects to a terminal through a COM port |
| doCOMTransaction() | Sends a transaction through a COM port |
| doCOMDisconnection() | Disconnects a COM port session |
| ComputeSha256Hash() | Generates a SHA-256 signature |
Method Reference
doTCPIPConnection()
Establishes a TCP/IP connection with the Payment Terminal.
int doTCPIPConnection(string ipAddress, int portNumber);
Parameters
| Parameter | Type | Description |
|---|---|---|
| ipAddress | string | Terminal IP address |
| portNumber | int | Terminal port number |
Return Value
| Value | Description |
|---|---|
| 0 | Connection successful |
| Non-zero | Connection failed |
doTCPIPTransaction()
Sends a transaction request through an established TCP/IP connection.
int doTCPIPTransaction(
string ipAddress,
int portNumber,
string inputReqData,
int transactionType,
string szSignature,
out string res
);
Parameters
| Parameter | Type | Description |
|---|---|---|
| ipAddress | string | Terminal IP address |
| portNumber | int | Terminal port number |
| inputReqData | string | Formatted transaction request payload |
| transactionType | int | Transaction operation code |
| szSignature | string | SHA-256 signature value |
| res | out string | Terminal response |
Return Value
Returns a transaction processing status code.
doTCPIPDisconnection()
Disconnects the active TCP/IP connection.
int doTCPIPDisconnection();
Return Value
| Value | Description |
|---|---|
| 0 | Disconnection successful |
| Non-zero | Disconnection failed |
doCOMConnection()
Establishes a Serial (COM) connection with the Payment Terminal.
int doCOMConnection(
int Port,
string baudRate,
string parity,
int dataBits,
int stopBits
);
Return Value
| Value | Description |
|---|---|
| 0 | Connection successful |
| Non-zero | Connection failed |
doCOMTransaction()
Sends a transaction request through a Serial (COM) connection.
int doCOMTransaction(
int Port,
string baudRate,
string parity,
int dataBits,
int stopBits,
string inputReqData,
int transactionType,
string szSignature,
out string res
);
Return Value
Returns a transaction processing status code.
doCOMDisconnection()
Disconnects the active COM port session.
int doCOMDisconnection();
Return Value
| Value | Description |
|---|---|
| 0 | Disconnection successful |
| Non-zero | Disconnection failed |
ComputeSha256Hash()
Generates a SHA-256 hash value.
string ComputeSha256Hash(string input);
Parameters
| Parameter | Type | Description |
|---|---|---|
| input | string | Input value to hash |
Return Value
Returns a SHA-256 hash string.
COM Communication Parameters
| Parameter | Type | Description |
|---|---|---|
| Port | int | COM port number (for example, COM3 = 3) |
| baudRate | string | Communication speed |
| parity | string | Parity configuration |
| dataBits | int | Data bit count |
| stopBits | int | Stop bit count |
COM Connection Return Values
| Return Value | Meaning |
|---|---|
| 0 | Connection established successfully |
| Non-zero | Connection failed |
COM Disconnection Return Values
| Return Value | Meaning |
|---|---|
| 0 | Disconnected successfully |
| Non-zero | Disconnection failed |
Transaction Type Codes
| Transaction Type | Description |
|---|---|
| 17 | Terminal Registration |
| 18 | Session Start |
| 0 | Purchase Transaction |
Terminal Registration
Transaction Type 17 identifies the Merchant Application and terminal to the Payment Terminal.
Session Start
Transaction Type 18 starts a secure session after registration.
Purchase Transaction
Transaction Type 0 performs a payment transaction.
Request Payload Formats
Registration and Session Request
This payload format is used for:
- Terminal Registration (Transaction Type 17)
- Session Start (Transaction Type 18)
Format
DDMMYYHHMMSS;TerminalID!
Components
| Component | Description |
|---|---|
| DDMMYYHHMMSS | Transaction timestamp |
| ; | Field separator |
| TerminalID | Terminal identifier |
| ! | End-of-request marker |
Example
250720114240;12345678!
Purchase Transaction Request
Format
DDMMYYHHMMSS;AmountMinor;0;TerminalIDEcrRef!
Components
| Component | Description |
|---|---|
| DDMMYYHHMMSS | Transaction timestamp |
| AmountMinor | Transaction amount |
| 0 | Reserved protocol field |
| TerminalIDEcrRef | Terminal ID and ECR reference |
| ! | End-of-request marker |
Amount Format
For TCP/IP transactions:
33.00 → 3300
For COM transactions, the documentation specifies the raw amount format:
33
Example
250720114732;3300;0;12345678000002!
Response Handling
Transaction responses are returned through:
out string res
The response contains the raw data returned by the Payment Terminal.
Applications are responsible for parsing and processing the response.
Security & Signatures
Purchase transactions require SHA-256 signature validation.
Registration and Session Start transactions do not require signatures.
Signature Generation
Use the following method:
string signature = ComputeSha256Hash(input);
Signature Format
SHA256(EcrRef + TerminalID)
Signature Rules
The signature is generated by concatenating the EcrRef value and TerminalID value.
EcrRef must:
- Be unique for each transaction
- Increment from the previous transaction
- Be zero-padded to six digits
Example:
000002
The generated SHA-256 value must be passed through the szSignature parameter.
Transactions Requiring Signatures
| Transaction Type | Signature Required |
|---|---|
| Registration (17) | No |
| Session Start (18) | No |
| Purchase (0) | Yes |
Configuration Persistence
The SDK does not provide APIs for configuration storage.
Applications are responsible for storing and retrieving:
- Terminal IP address
- Port number
- COM port settings
- Terminal ID
- Merchant-specific configuration
Configuration values must be supplied when invoking SDK APIs.
Runtime Behaviors
SDK Instance
All SDK operations are performed through the InteroperableService class.
InteroperableService ecr = new InteroperableService();
Communication Modes
The SDK supports:
- TCP/IP communication
- Serial (COM) communication
Response Processing
Transaction responses are returned through:
out string res
Applications are responsible for processing the returned response.
Connection Lifecycle
A typical SDK communication lifecycle is:
Connect
↓
Execute Transaction
↓
Receive Response
↓
Disconnect
Error Handling
All SDK methods return integer status values.
Connection Errors
The following methods return connection status codes:
- doTCPIPConnection()
- doCOMConnection()
| Return Value | Description |
|---|---|
| 0 | Operation successful |
| Non-zero | Operation failed |
Transaction Errors
The following methods return transaction status codes:
- doTCPIPTransaction()
- doCOMTransaction()
Applications should verify:
- Method return values
- Response data returned by the SDK
Disconnection Errors
The following methods return disconnection status codes:
- doTCPIPDisconnection()
- doCOMDisconnection()
A non-zero return value indicates that the disconnection operation failed.
Transaction Flow
The SDK supports the following transaction sequence:
Terminal Registration (17)
↓
Session Start (18)
↓
Purchase Transaction (0)
↓
Receive Terminal Response
↓
Process Response
↓
Disconnect
