.Net SDK
Supported Connections
| Connection Type | Supported | Notes |
|---|---|---|
| TCP/IP (Wi‑Fi) | ✔ | Recommended |
| Bluetooth | ✔ | Supported via paired device |
| Serial (COM/USB) | ✔ | Supported using SerialPort class. Device‑specific USB options apply. |
Serial Connection (USB)
Sample Application Flow
Read the Prerequisites chapter, then follow these steps to connect the POS system to the Smart Peak/N86/UN20 terminal using serial (USB CDC mode).
Step 1: Launch ECR Application
- Open the .NET ECR application on the POS/ERP system.
Step 2: Select Connection Type
- Choose COM connection mode for direct cable (USB/Serial).

Communication Mode and COM Setting
Step 3: Enable USB Mode on Nami Terminal
- Nexgo N86/UN20 → USB CDC mode
- Smartpeak Android 9 → Qualcomm drivers (visible in Device Manager)
- Smartpeak Android 13 → Microsoft drivers (firmware upgrade may be required)
This allows the device to be recognized as a COM port.

Enable CDC Mode
Step 4: Connect the Device
- Attach the POS/ERP system to the Nami payment terminal via USB cable.
Step 5: Verify COM Port
- Open Device Manager → Ports (COM & LPT).
- Note the COM port (e.g., USB Serial Device COM3).
Step 6: Configure Communication Parameters
In the ECR application, enter the following details. See Figure - Communication Mode and COM Setting
- COM port (for example, COM3)
- Baud speed
- Data bits
- Stop bits
Step 7: Establish Connection
- Click Connect in the ECR application. Confirm success before proceeding.
Code Integration Flow
SerialPort port = new SerialPort("COM3", 9600, Parity.None, 8, StopBits.One);
port.Open();
byte[] buffer = PrepareRequest(amount, reference, date);
port.Write(buffer, 0, buffer.Length);
byte[] response = new byte[1024];
port.Read(response, 0, response.Length);
ParseResponse(response);
Bluetooth Connection
Sample Application Flow
Step 1: Power On Terminal
Switch on the Nami payment terminal and enable Bluetooth.
Step 2: Enable Bluetooth on POS/ERP Device
Turn on Bluetooth, ensure visibility.
Step 3: Pair Terminal
Select terminal (e.g., NamiPay Terminal), confirm pairing code.
Step 4: Initialize SDK Connection
Call SDK’s Bluetooth connect method with paired device details.
Step 5: Perform Transaction
Prepare transaction data (Amount, Reference, Date). Send request.
Step 6: Process Response
Receive response, parse with SDK utilities. Extract approval code, status, receipt.
Code Integration Flow
BluetoothDevice device = FindDevice("NamiPay Terminal");
sdk.Connect(device.Address);
TransactionResponse resp = sdk.PerformTransaction(amount, reference, date);
Console.WriteLine("Response Code: " + resp.Code);
Console.WriteLine("Approval Code: " + resp.ApprovalCode);
Console.WriteLine("Receipt: " + resp.Receipt);
TCP/IP (Wi‑Fi)
Sample Application Flow
Step 1: Power On Terminal
Ensure terminal is on and connected to Wi‑Fi/LAN.
Step 2: Identify Terminal IP Address
Navigate to Network Settings. Note IP (e.g., 192.168.0.102) and port (default: 8888).
Step 3: Configure POS/ERP Device
Ensure same network, firewall allows communication.
Step 4: Initialize SDK Connection
Use Socket class to connect.
Step 5: Register Terminal (Legacy Only).
Send pack() with txnType = 17. Skip for adapter integrations.
Step 6: Start Session (Legacy Only)
Send pack() with txnType = 18. Skip for adapter integrations..
Step 7: Perform Transaction
Prepare transaction data (Amount, Reference, Date). Send request.
Step 8: Process Response
Read response, parse with SDK utilities. Extract response code, approval code, receipt.
Code Integration Flow
Connect (IP + Port) → [Register] → [Start Session] → Perform Transaction → Parse Response
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Connect("192.168.0.102", 8888);
pack(requestData, txnType, signature, buffer);
socket.Send(buffer);
byte[] response = new byte[1024];
socket.Receive(response);
parse(response);
Common Transactions (Centralized)
- Register Terminal (Legacy Only) →
txnType = 17 - Start Session (Legacy Only) →
txnType = 18 - Purchase Transaction → Amount (Integer), Reference (String), Date (
ddMMyyHHmmss) - Process Response → Response code (String), Approval code (String), Receipt (String)
Request/Response Example
| Field | Type | Example Value |
|---|---|---|
| Date | String | 2504261430 (ddMMyyHHmmss) |
| Amount | Integer | 100 (SAR 1.00) |
| Reference Number | String | ECR001 |
| Response Code | String | 00 (Approved) |
| Approval Code | String | A12345 |
| Receipt Data | String | Merchant + Customer copy |
Updated 12 days ago
