Flutter SDK
Supported Connections
| Connection Type | Supported | Notes |
|---|---|---|
| TCP/IP (Wi‑Fi)* | ✔ (Android & iOS) | Recommended for stable and fast setup. Uses terminal IP + port. |
| Bluetooth | ✔ (Android only) | Requires pairing with Android device first. Not supported on iOS. |
| App‑to‑App* | ✔ (Android only) | Uses Intent/WebSocket communication with NamiPay app installed. |
| Serial (USB CDC) | ❌ | Not supported on mobile platforms. Limited to desktop SDKs (Java, .NET). |
Step 1: Initialize SDK
config = await ConfigManager.getConfiguration();
Step 2: Connect to Terminal
- TCP/IP (Wi‑Fi)
await tcpSocket.connectTCP(ip, port, cashRegisterNumber);
- Bluetooth (Android only)
await _bluetoothService.connectDevice(device, cashRegisterNumber);
- App‑to‑App (Android only)
await _webSocketService.connect(cashRegisterNumber);
Step 3: Prepare Transaction
final String ecrRef =
"${config.cashRegisterNumber}${EncryptionUtil.getSixDigitUniqueNumber()}";
String signature = EncryptionUtil.getSha256Hash(
config.ecrUnique,
config.terminalId!,
);
Step 4: Create Request
final String reqData =
"${EncryptionUtil.getFormattedDateTime()};${amount};$printFlag!;$ecrRef!";
Step 5: Convert to HEX
final String hexReqData = EncryptionUtil.stringToHex(reqData);
Step 6: Perform Transaction
await tcpSocket.doTransaction(
reqData: hexReqData,
txnType: txnType,
signature: signature,
listener: this,
);
Step 7: Handle Response
- TCP/IP → handled via
tcpSocket.connectTCP - Bluetooth → handled via
_bluetoothService.connectDevice - App‑to‑App → handled via
_webSocketService.connect
Flow Summary
Initialize SDK → Connect (Wi‑Fi / Bluetooth / App‑to‑App) → Prepare Transaction → Create Request → Convert to HEX → Perform Transaction → Handle Response
Updated 16 days ago
