React Native SDK
Supported Connections
| Connection Type | Supported | Notes |
|---|---|---|
| TCP/IP (Wi‑Fi) | ✔ (Android & iOS) | Recommended connection using terminal IP + Port. |
| Bluetooth | ✔ (Android only) | Requires pairing with Android device first. |
| App‑to‑App | ✔ (Android only) | Supported via native bridge using Intent/WebSocket. |
| Serial (USB CDC) | ❌ | Not supported on mobile platforms. |
TCP/IP (Wi‑Fi)
Step 1: Prepare Your App
- Create a new React Native project.
- Ensure your environment supports Android/iOS 13+ (for iOS).
Step 2: Add the SDK
- Install
react-native-ecr-sdkvia npm/yarn. - Link the SDK to your project.
Step 3: Configure Terminal Settings
- Choose TCP/IP (Wi‑Fi) as the connection mode.
- Enter your Cash Register Number (CRN).
Step 4: Connect to the Terminal
- Enter terminal IP + Port (e.g.,
192.168.0.102:8888). - Call the connect method.
- Wait for confirmation “Connected to terminal.”
Step 5: Perform a Transaction
- Enter transaction details (Date, CRN, Amount).
- Call
doTransaction(). - Amount appears on terminal.
Step 6: Review the Response
- SDK returns approval/decline status.
- Extract approval code, receipt details.
Step 7: Disconnect (Optional)
- Call disconnect method when done.
Flow Summary
Connect → doTransaction() → Review Response → Disconnect
Bluetooth (Android Only)
Step 1: Pair Terminal
- Pair the payment terminal with your Android device.
Step 2: Initialize Bluetooth Module
- Enable Bluetooth in SDK.
Step 3: Connect to Terminal
- Select paired device object.
- Call connect method.
Step 4: Perform Transaction
- Call
doTransaction().
Step 5: Review Response
- Handle approval/decline, receipt details.
App‑to‑App (Android Only)
Step 1: Prepare Environment
- Ensure NamiPay app is installed.
Step 2: Initialize SDK
- Configure SDK for App‑to‑App mode.
Step 3: Connect Using CRN
- Enter Cash Register Number.
Step 4: Trigger Transaction
- Call SDK → NamiPay app opens → Transaction processed.
Step 5: Receive Callback Response
- SDK returns transaction result via callback.
Flow Summary
App → SDK → NamiPay App → Transaction → Callback Response
Handling Response (All Connections)
Response fields include:
- Response Code, Response Message
- PAN, Transaction Amount, Cashback Amount, Total Amount
- RRN, Auth Code, TID, MID, Batch No
- Scheme Label, Merchant Info (English + Arabic)
- ECR Transaction Reference Number, Signature
Updated 16 days ago
