@netappsng/react-native-pay 0.1.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Netappspay.podspec +1 -1
- package/README.md +70 -12
- package/android/build.gradle +1 -1
- package/package.json +1 -1
package/Netappspay.podspec
CHANGED
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ yarn add @netappsng/react-native-pay
|
|
|
16
16
|
cd ios && pod install
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
The SDK uses the native [NetAppsPaySDK](https://
|
|
19
|
+
The SDK uses the native [NetAppsPaySDK](https://cocoapods.org/pods/NetAppsPaySDK) which is resolved automatically via CocoaPods.
|
|
20
20
|
|
|
21
21
|
### Android
|
|
22
22
|
|
|
@@ -187,25 +187,58 @@ Tap to Pay lets customers pay by tapping their contactless card on the Android d
|
|
|
187
187
|
|
|
188
188
|
> **Not supported on iOS.** If you include `'tap_to_pay'` in `paymentChannels` on iOS, it is silently ignored.
|
|
189
189
|
|
|
190
|
-
### Step 1 —
|
|
190
|
+
### Step 1 — Set minSdk to 28
|
|
191
|
+
|
|
192
|
+
The NFC contactless SDK requires Android API 28+. Open your React Native project's Android build file and set `minSdkVersion`:
|
|
193
|
+
|
|
194
|
+
```groovy
|
|
195
|
+
// android/app/build.gradle
|
|
196
|
+
|
|
197
|
+
android {
|
|
198
|
+
defaultConfig {
|
|
199
|
+
minSdkVersion 28 // Required for NFC contactless SDK
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Step 2 — Add the taptopay module dependency
|
|
191
205
|
|
|
192
206
|
In your React Native project's **Android** build files, add the `taptopay` module alongside the payment SDK:
|
|
193
207
|
|
|
194
|
-
```
|
|
195
|
-
// android/app/build.gradle
|
|
208
|
+
```groovy
|
|
209
|
+
// android/app/build.gradle
|
|
196
210
|
|
|
197
211
|
dependencies {
|
|
198
212
|
// The core payment SDK (already added by the RN package)
|
|
199
|
-
implementation
|
|
213
|
+
implementation "ng.netapps:netappspay:1.1.0"
|
|
200
214
|
|
|
201
215
|
// Tap to Pay NFC plugin — add this line
|
|
202
|
-
implementation
|
|
216
|
+
implementation "ng.netapps:taptopay:1.0.0"
|
|
203
217
|
}
|
|
204
218
|
```
|
|
205
219
|
|
|
206
220
|
Then sync your Gradle project (Android Studio will prompt you, or run `cd android && ./gradlew sync`).
|
|
207
221
|
|
|
208
|
-
### Step
|
|
222
|
+
### Step 3 — Fix the manifest merger conflict
|
|
223
|
+
|
|
224
|
+
The POS SDK includes its own theme which conflicts with your app's theme. Add `tools:replace="android:theme"` to your `<application>` tag:
|
|
225
|
+
|
|
226
|
+
```xml
|
|
227
|
+
<!-- android/app/src/main/AndroidManifest.xml -->
|
|
228
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
229
|
+
xmlns:tools="http://schemas.android.com/tools">
|
|
230
|
+
|
|
231
|
+
<application
|
|
232
|
+
android:theme="@style/AppTheme"
|
|
233
|
+
tools:replace="android:theme">
|
|
234
|
+
<!-- your activities -->
|
|
235
|
+
</application>
|
|
236
|
+
</manifest>
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
> If your manifest already has an `<application>` tag with a theme, just add `xmlns:tools="http://schemas.android.com/tools"` to the `<manifest>` tag and `tools:replace="android:theme"` to the `<application>` tag.
|
|
240
|
+
|
|
241
|
+
### Step 4 — Register the NFC provider in your Android app
|
|
209
242
|
|
|
210
243
|
Open your `MainApplication.kt` (or `MainApplication.java`) file — this is usually at:
|
|
211
244
|
|
|
@@ -258,7 +291,7 @@ public class MainApplication extends Application implements ReactApplication {
|
|
|
258
291
|
|
|
259
292
|
That's all the native code you need. The `taptopay` module's `AndroidManifest.xml` automatically adds the NFC permission with `android:required="false"`, so your app still installs on devices without NFC.
|
|
260
293
|
|
|
261
|
-
### Step
|
|
294
|
+
### Step 5 — Include `'tap_to_pay'` in your payment channels
|
|
262
295
|
|
|
263
296
|
Now in your React Native / TypeScript code, add `'tap_to_pay'` to the `paymentChannels` array:
|
|
264
297
|
|
|
@@ -297,15 +330,40 @@ presentPayment(config, {
|
|
|
297
330
|
1. When the payment sheet opens, the SDK checks if a Tap to Pay provider is registered via `TapToPayRegistry`
|
|
298
331
|
2. If registered **and** the device has NFC hardware enabled, the "Tap to Pay" tab appears
|
|
299
332
|
3. If no provider is registered or the device lacks NFC, the tab is automatically hidden — no errors, no crashes
|
|
300
|
-
4. The
|
|
333
|
+
4. The user selects their **Account Type** and **Device Type** using the chip controls on the Tap to Pay screen
|
|
334
|
+
5. The customer taps their contactless card on the device to complete payment
|
|
335
|
+
|
|
336
|
+
### Account Type
|
|
337
|
+
|
|
338
|
+
The Tap to Pay screen presents a segmented chip control for account type selection:
|
|
339
|
+
|
|
340
|
+
| Chip | Value |
|
|
341
|
+
|------|-------|
|
|
342
|
+
| **Default** | `DEFAULT_UNSPECIFIED` — the issuer's default account |
|
|
343
|
+
| **Savings** | `SAVINGS` |
|
|
344
|
+
| **Current** | `CURRENT` |
|
|
345
|
+
| **Credit** | `CREDIT` |
|
|
346
|
+
|
|
347
|
+
### Device Type
|
|
348
|
+
|
|
349
|
+
A second chip control lets the user choose how the NFC card is read:
|
|
350
|
+
|
|
351
|
+
| Chip | Description |
|
|
352
|
+
|------|-------------|
|
|
353
|
+
| **Internal NFC** | Uses the device's built-in NFC antenna (most common) |
|
|
354
|
+
| **External** | Uses an external NFC reader connected to the device |
|
|
355
|
+
| **NFC Kit** | Uses a third-party NFC kit module |
|
|
356
|
+
|
|
357
|
+
The selected device type is **persisted automatically** — the SDK remembers the user's last choice across sessions so they don't have to re-select each time.
|
|
301
358
|
|
|
302
359
|
### Requirements
|
|
303
360
|
|
|
304
361
|
| Requirement | Value |
|
|
305
362
|
|---|---|
|
|
306
|
-
| Min Android SDK | **
|
|
307
|
-
| NFC hardware | Required on the device |
|
|
363
|
+
| Min Android SDK | **28** (Android 9.0) |
|
|
364
|
+
| NFC hardware | Required on the device (for Internal NFC) |
|
|
308
365
|
| `taptopay` module | Must be added as a dependency |
|
|
366
|
+
| Manifest fix | `tools:replace="android:theme"` on `<application>` |
|
|
309
367
|
| Provider registration | Must call `TapToPayRegistry.register()` before payment |
|
|
310
368
|
|
|
311
369
|
### Unregister (optional)
|
|
@@ -321,7 +379,7 @@ TapToPayRegistry.unregister()
|
|
|
321
379
|
This package bridges the native NetAppsPay SDKs:
|
|
322
380
|
|
|
323
381
|
- **iOS**: [NetAppsPaySDK](https://github.com/nicenapp/NetAppsPaySDK) (Swift Package)
|
|
324
|
-
- **Android**: `ng.netapps:netappspay:1.
|
|
382
|
+
- **Android**: `ng.netapps:netappspay:1.1.0` (Maven Central)
|
|
325
383
|
|
|
326
384
|
## License
|
|
327
385
|
|
package/android/build.gradle
CHANGED