iOS SDK
Use the NamiECRSDK framework to integrate your iOS/iPadOS application with the NamiPay terminal over TCP/IP (Wi‑Fi). iOS integrations are SDK‑driven and use callback‑based communication, not raw socket handling like desktop SDKs.
Supported Connections
| Connection Type | Supported | Notes |
|---|---|---|
| TCP/IP (Wi‑Fi) | ✔ | Recommended |
| Bluetooth (Limited support) | ⚠️ | Limited / SDK‑dependent. Restrictions disclosed |
| Serial (COM) | ❌ | Not supported |
TCP/IP (Wi‑Fi)
Sample Application Flow
Step 1: Prepare Your App
- Open Xcode on your Mac.
- Create a new iOS project.
- Choose “App” as the template.
- Ensure your system supports iOS 13 or later.
Step 2: Add the Nami SDK
- Drag the file
NamiECRSDK.frameworkinto your project. - Confirm it appears under Frameworks, Libraries & Embedded Content.
- Set it to Embed & Sign.
Step 3: Configure Terminal Settings
- In SDK settings, choose
TCP/IP (Wi‑Fi). - Enter your Cash Register Number (for example:
ECR001).
Step 4: Connect to the Terminal
- Enter the terminal’s IP address and port (for example:
192.168.0.102:8888). - Tap Connect.
- Wait for the app to confirm “Connected to terminal.”
Step 5: Register Terminal (Legacy only)
- Send Register request
(txnType = 17). - Expect success response.
Important: Registration is required only for legacy ECR integrations. Local and Cloud Middleware integrations do not require this step.
Step 6: Start Session (Legacy only)
- Send Start Session request
(txnType = 18). - Expect confirmation.
Important: This step applies only to legacy ECR integrations. It is not required for Local or Cloud Middleware integrations.
Step 7: Perform a Transaction
- Enter the transaction details:
- Date (format:
ddMMyyHHmmss) - ECR Reference Number
- Amount (in halalas, e.g.,
100 = SAR 1.00)`
- Date (format:
- Tap Purchase.
- The amount will appear on the terminal screen.
Step 8: Review the Response
- App shows Approved/Failed status.
- The app displays the approval code and receipt details.
Step 9: Disconnect (Optional)
- If you don’t need to keep the connection open, tap Disconnect.
Bluetooth (Limited Support)
⚠️Bluetooth Limitations
- Supported only on iOS 13 and later.
- Requires successful device pairing before SDK connection.
- Only one terminal can be paired per iOS device at a time.
- Sessions may drop under poor signal conditions; TCP/IP is recommended for production.
- Advanced flows (refunds, reversals) are not supported over Bluetooth.
- Some terminals require updated firmware for stable Bluetooth sessions.
Sample Application Flow
Step 1: Pair Terminal with iOS Device
- Go to Settings → Bluetooth on your iPhone/iPad.
- Enable Bluetooth.
- Select Nami payment terminal.
- Confirm successful pairing.
Step 2: Initialize Bluetooth in SDK
- Enable Bluetooth mode in
NamiECRSDK. - Set connection type to Bluetooth.
- Ensure SDK recognizes paired device.
Step 3: Connect to Terminal
- Call SDK’s
connect()with paired device address. - Wait for confirmation message: Connected to terminal
Step 4: Perform Transaction
- Build request (amount, CRN, date, reference number).
- Call
doTransaction()via SDK - Amount appears on terminal screen
Step 5: Handle Response
- Parse response string using SDK parser.
- Extract: Response Code, Approval Code, Receipt Data.
- Display Approved/Failed status in your app.
Note: Bluetooth support is limited and SDK‑dependent. Availability may vary by terminal firmware.
Updated 12 days ago
