@tapayadot/accept-react-native 1.1.0 → 1.2.1
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/README.md +143 -30
- package/android/build.gradle +3 -3
- package/android/src/main/java/com/tapaya/acceptsdkreactnative/AcceptSdkReactNativeModule.kt +256 -24
- package/build/AcceptSdkReactNative.types.d.ts +112 -15
- package/build/AcceptSdkReactNative.types.d.ts.map +1 -1
- package/build/AcceptSdkReactNative.types.js.map +1 -1
- package/build/AcceptSdkReactNativeModule.d.ts +10 -1
- package/build/AcceptSdkReactNativeModule.d.ts.map +1 -1
- package/build/AcceptSdkReactNativeModule.js.map +1 -1
- package/build/index.d.ts +94 -5
- package/build/index.d.ts.map +1 -1
- package/build/index.js +70 -2
- package/build/index.js.map +1 -1
- package/ios/AcceptSdkReactNativeModule.swift +271 -41
- package/package.json +4 -7
- package/plugin/withCustomRepoModule.js +1 -1
package/README.md
CHANGED
|
@@ -47,13 +47,13 @@ The iOS SDK is resolved via Swift Package Manager during `prebuild` / `pod insta
|
|
|
47
47
|
### Setup
|
|
48
48
|
|
|
49
49
|
```ts
|
|
50
|
-
import
|
|
50
|
+
import Accept from '@tapayadot/accept-react-native';
|
|
51
51
|
|
|
52
52
|
// Initialize once at app launch
|
|
53
|
-
await
|
|
53
|
+
await Accept.initialize(/* demo: */ false);
|
|
54
54
|
|
|
55
55
|
// Authenticate with your merchant token
|
|
56
|
-
await
|
|
56
|
+
await Accept.authenticate('your-merchant-token');
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
### UI Theming
|
|
@@ -61,7 +61,7 @@ await AcceptSDK.authenticate('your-merchant-token');
|
|
|
61
61
|
Customize colors and logos at initialization or any time after:
|
|
62
62
|
|
|
63
63
|
```ts
|
|
64
|
-
import
|
|
64
|
+
import Accept, { type AcceptThemeConfiguration } from '@tapayadot/accept-react-native';
|
|
65
65
|
import { assetToBase64 } from '@tapayadot/accept-react-native/utils';
|
|
66
66
|
|
|
67
67
|
const theme: AcceptThemeConfiguration = {
|
|
@@ -80,10 +80,10 @@ const theme: AcceptThemeConfiguration = {
|
|
|
80
80
|
};
|
|
81
81
|
|
|
82
82
|
// Pass at initialization
|
|
83
|
-
await
|
|
83
|
+
await Accept.initialize(false, theme);
|
|
84
84
|
|
|
85
85
|
// Or apply after initialization
|
|
86
|
-
await
|
|
86
|
+
await Accept.setTheme(theme);
|
|
87
87
|
```
|
|
88
88
|
|
|
89
89
|
Omit `colors` or `images` to keep SDK defaults for that slot. Images must be PNG or JPEG — SVG is not supported.
|
|
@@ -95,22 +95,22 @@ Omit `colors` or `images` to keep SDK defaults for that slot. Images must be PNG
|
|
|
95
95
|
Required before processing card payments (Tap-to-Pay):
|
|
96
96
|
|
|
97
97
|
```ts
|
|
98
|
-
await
|
|
98
|
+
await Accept.requestLocationPermission();
|
|
99
99
|
```
|
|
100
100
|
|
|
101
101
|
### Card Payment (Tap-to-Pay)
|
|
102
102
|
|
|
103
103
|
```ts
|
|
104
|
-
import
|
|
104
|
+
import Accept, { CardPaymentIntent } from '@tapayadot/accept-react-native';
|
|
105
105
|
|
|
106
106
|
const intent: CardPaymentIntent = {
|
|
107
107
|
paymentIntentId: 'pi_xxx',
|
|
108
108
|
amount: 1500,
|
|
109
|
-
requestedCurrency: 'CZK',
|
|
109
|
+
requestedCurrency: 'CZK', // ISO 4217 alpha-3
|
|
110
110
|
settlementCurrency: 'EUR',
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
-
const result = await
|
|
113
|
+
const result = await Accept.payments.startCardPayment(
|
|
114
114
|
intent,
|
|
115
115
|
(status) => console.log('Status update:', status),
|
|
116
116
|
(message, exception) => console.error('Error:', message, exception),
|
|
@@ -126,10 +126,28 @@ switch (result.status) {
|
|
|
126
126
|
}
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
+
### Refund a Card Payment
|
|
130
|
+
|
|
131
|
+
```ts
|
|
132
|
+
const refund = await Accept.payments.refund({
|
|
133
|
+
paymentToken: 'pi_xxx', // source payment intent id (or server payment UUID)
|
|
134
|
+
reason: 'customerRequest', // 'customerRequest' | 'duplicate' | 'fraudulent' | 'expiredCharge'
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
console.log(refund.status); // 'success' | 'pending' | 'cancelled' | 'refunded' | 'failed' | 'actionNeeded'
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Cancel an Active Payment
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
// Dismisses any payment UI and cancels the in-flight transaction.
|
|
144
|
+
await Accept.payments.cancelActivePayment();
|
|
145
|
+
```
|
|
146
|
+
|
|
129
147
|
### SEPA Instant Credit Transfer
|
|
130
148
|
|
|
131
149
|
```ts
|
|
132
|
-
const result = await
|
|
150
|
+
const result = await Accept.payments.startSepaPayment(
|
|
133
151
|
{
|
|
134
152
|
paymentIntentId: 'pi_xxx',
|
|
135
153
|
amount: 1000,
|
|
@@ -148,7 +166,7 @@ if (result.status === 'verified') {
|
|
|
148
166
|
### Certis (Czech Instant Transfer)
|
|
149
167
|
|
|
150
168
|
```ts
|
|
151
|
-
const result = await
|
|
169
|
+
const result = await Accept.payments.startCertisPayment(
|
|
152
170
|
{
|
|
153
171
|
paymentIntentId: 'pi_xxx',
|
|
154
172
|
amount: 10000,
|
|
@@ -160,11 +178,26 @@ const result = await AcceptSDK.payments.startCertisPayment(
|
|
|
160
178
|
);
|
|
161
179
|
```
|
|
162
180
|
|
|
181
|
+
### Onboarding Status
|
|
182
|
+
|
|
183
|
+
```ts
|
|
184
|
+
// Aggregate status across all payment methods
|
|
185
|
+
const onboarding = await Accept.identity.getOnboardingStatus();
|
|
186
|
+
console.log(onboarding.isOnboarded);
|
|
187
|
+
onboarding.paymentMethods.forEach((m) =>
|
|
188
|
+
console.log(m.method, m.status), // e.g. 'CARD', 'ACTIVE'
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
// Single-method status
|
|
192
|
+
const cardStatus = await Accept.identity.getPaymentMethodStatus('CARD');
|
|
193
|
+
// 'NOT_STARTED' | 'PENDING' | 'ACTIVE' | 'ATTENTION_NEEDED' | 'ACTION_REQUIRED' | 'BLOCKED'
|
|
194
|
+
```
|
|
195
|
+
|
|
163
196
|
### KYB Onboarding
|
|
164
197
|
|
|
165
198
|
```ts
|
|
166
199
|
// Check if onboarding is needed before launching the KYB flow
|
|
167
|
-
await
|
|
200
|
+
await Accept.identity.presentKyb({
|
|
168
201
|
businessType: 'company',
|
|
169
202
|
legalName: 'Acme s.r.o.',
|
|
170
203
|
businessEmail: 'billing@acme.com',
|
|
@@ -185,13 +218,34 @@ await AcceptSDK.identity.presentKyb({
|
|
|
185
218
|
|
|
186
219
|
```ts
|
|
187
220
|
// Check current SDK status
|
|
188
|
-
const status = await
|
|
221
|
+
const status = await Accept.getStatus(); // 'IDLE' | 'INITIALIZED' | 'LOGGED_IN'
|
|
189
222
|
|
|
190
223
|
// Query the result of a previous payment
|
|
191
|
-
const result = await
|
|
224
|
+
const result = await Accept.getPaymentStatus('pi_xxx');
|
|
192
225
|
|
|
193
226
|
// Log out
|
|
194
|
-
await
|
|
227
|
+
await Accept.logOut();
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Demo Mode
|
|
231
|
+
|
|
232
|
+
```ts
|
|
233
|
+
await Accept.demo.enable(); // simulate payments without real terminals
|
|
234
|
+
const isDemo = await Accept.demo.isEnabled();
|
|
235
|
+
await Accept.demo.disable();
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### UI Behavior (Android only)
|
|
239
|
+
|
|
240
|
+
```ts
|
|
241
|
+
await Accept.setUiBehavior({
|
|
242
|
+
resultScreenDurationSeconds: 5,
|
|
243
|
+
showResultScreen: true,
|
|
244
|
+
nfcZone: {
|
|
245
|
+
indicator: 'BELOW', // 'DEFAULT' | 'ABOVE' | 'BELOW' | 'FRONT' | 'BEHIND'
|
|
246
|
+
position: { xBias: 0.5, yBias: 0.7 }, // omit to use terminal default
|
|
247
|
+
},
|
|
248
|
+
});
|
|
195
249
|
```
|
|
196
250
|
|
|
197
251
|
### Companion App (iOS only)
|
|
@@ -199,14 +253,14 @@ await AcceptSDK.logOut();
|
|
|
199
253
|
The Tapaya companion app is required for card payments on iOS:
|
|
200
254
|
|
|
201
255
|
```ts
|
|
202
|
-
const installed = await
|
|
256
|
+
const installed = await Accept.isCompanionAppInstalled();
|
|
203
257
|
|
|
204
258
|
if (!installed) {
|
|
205
259
|
// Prompt user to install via App Store sheet
|
|
206
|
-
await
|
|
260
|
+
await Accept.presentCompanionAppSheet();
|
|
207
261
|
} else {
|
|
208
262
|
// Pair with the companion app
|
|
209
|
-
await
|
|
263
|
+
await Accept.pairWithCompanionApp();
|
|
210
264
|
}
|
|
211
265
|
```
|
|
212
266
|
|
|
@@ -218,6 +272,7 @@ if (!installed) {
|
|
|
218
272
|
|---|---|
|
|
219
273
|
| `initialize(demo?, theme?)` | Initialize the SDK. Pass `true` for sandbox mode. Optionally provide a UI theme. |
|
|
220
274
|
| `setTheme(theme)` | Apply a UI theme after initialization. |
|
|
275
|
+
| `setUiBehavior(behavior)` | Android only. Configure result screen + NFC zone. |
|
|
221
276
|
| `authenticate(token)` | Authenticate with a merchant JWT token. |
|
|
222
277
|
| `getStatus()` | Returns `'IDLE' \| 'INITIALIZED' \| 'LOGGED_IN'`. |
|
|
223
278
|
| `getPaymentStatus(paymentIntentId)` | Retrieve the result of a previous payment. |
|
|
@@ -227,30 +282,44 @@ if (!installed) {
|
|
|
227
282
|
| `presentCompanionAppSheet()` | iOS only. Show App Store sheet for companion app. |
|
|
228
283
|
| `pairWithCompanionApp()` | iOS only. Pair with the installed companion app. |
|
|
229
284
|
|
|
230
|
-
### `
|
|
285
|
+
### `Accept.payments`
|
|
231
286
|
|
|
232
287
|
| Method | Description |
|
|
233
288
|
|---|---|
|
|
234
289
|
| `startCardPayment(intent, onStatus, onError)` | Start a card/Tap-to-Pay payment. |
|
|
235
290
|
| `startSepaPayment(intent, onStatus, onError)` | Start a SEPA Instant payment. |
|
|
236
291
|
| `startCertisPayment(intent, onStatus, onError)` | Start a Certis Instant payment. |
|
|
292
|
+
| `refund(intent)` | Refund a previously completed card payment (headless, no UI). |
|
|
293
|
+
| `cancelActivePayment()` | Dismiss in-flight payment UI and cancel the transaction. |
|
|
237
294
|
|
|
238
|
-
### `
|
|
295
|
+
### `Accept.identity`
|
|
239
296
|
|
|
240
297
|
| Method | Description |
|
|
241
298
|
|---|---|
|
|
242
299
|
| `presentKyb(prefilling?)` | Launch the KYB onboarding UI with optional prefill data. |
|
|
300
|
+
| `getOnboardingStatus()` | Returns aggregate merchant onboarding status across payment methods. |
|
|
301
|
+
| `getPaymentMethodStatus(method)` | Returns onboarding status for a single payment method. |
|
|
302
|
+
|
|
303
|
+
### `Accept.demo`
|
|
304
|
+
|
|
305
|
+
| Method | Description |
|
|
306
|
+
|---|---|
|
|
307
|
+
| `enable()` | Enable demo mode — payments are simulated, no real terminal required. |
|
|
308
|
+
| `disable()` | Return to real terminal flows. |
|
|
309
|
+
| `isEnabled()` | Whether demo mode is currently enabled. |
|
|
243
310
|
|
|
244
311
|
## Types
|
|
245
312
|
|
|
246
|
-
|
|
247
|
-
|
|
313
|
+
Currency and country fields are plain ISO strings:
|
|
314
|
+
- Currency — ISO 4217 alpha-3 (`'CZK'`, `'EUR'`, `'GBP'`, …)
|
|
315
|
+
- Country — ISO 3166-1 alpha-2 (`'CZ'`, `'GB'`, …)
|
|
248
316
|
|
|
317
|
+
```ts
|
|
249
318
|
type CardPaymentIntent = {
|
|
250
319
|
paymentIntentId: string
|
|
251
320
|
amount: number // smallest currency unit (e.g. hellers)
|
|
252
|
-
requestedCurrency:
|
|
253
|
-
settlementCurrency?:
|
|
321
|
+
requestedCurrency: string // ISO 4217 alpha-3
|
|
322
|
+
settlementCurrency?: string // defaults to requestedCurrency
|
|
254
323
|
}
|
|
255
324
|
|
|
256
325
|
type CardPaymentResult = {
|
|
@@ -260,20 +329,54 @@ type CardPaymentResult = {
|
|
|
260
329
|
authorizationCode?: string
|
|
261
330
|
terminalId?: string
|
|
262
331
|
companyName?: string
|
|
332
|
+
companyAddress1?: string
|
|
333
|
+
companyAddress2?: string
|
|
334
|
+
companyCity?: string
|
|
335
|
+
companyCountry?: string // ISO 3166-1 alpha-2
|
|
263
336
|
reason?: string
|
|
264
337
|
receiptUrl?: string
|
|
338
|
+
refundToken?: string // present when this card payment was refunded
|
|
265
339
|
}
|
|
266
340
|
|
|
267
|
-
type SepaPaymentIntent = { paymentIntentId: string; amount: number; requestedCurrency:
|
|
341
|
+
type SepaPaymentIntent = { paymentIntentId: string; amount: number; requestedCurrency: string; settlementCurrency?: string }
|
|
268
342
|
type SepaPaymentResult = { status: 'pending' | 'verified' | 'aborted' | 'refunded' | 'declined'; postponed: boolean; receivedAt: string; receivedFromIban: string; receiptUrl?: string }
|
|
269
343
|
|
|
270
|
-
type CertisPaymentIntent = { paymentIntentId: string; amount: number; requestedCurrency:
|
|
344
|
+
type CertisPaymentIntent = { paymentIntentId: string; amount: number; requestedCurrency: string; settlementCurrency?: string }
|
|
271
345
|
type CertisPaymentResult = { status: 'pending' | 'verified' | 'aborted' | 'refunded' | 'declined'; postponed: boolean; receivedAt: string; receivedFromIban: string; receiptUrl?: string }
|
|
272
346
|
|
|
347
|
+
type RefundReason = 'customerRequest' | 'duplicate' | 'fraudulent' | 'expiredCharge'
|
|
348
|
+
type TransactionStatus = 'pending' | 'success' | 'cancelled' | 'refunded' | 'failed' | 'actionNeeded'
|
|
349
|
+
|
|
350
|
+
type RefundIntent = {
|
|
351
|
+
paymentToken: string // source payment UUID or original paymentIntentId
|
|
352
|
+
refundToken?: string // idempotency token, pass same value on retry
|
|
353
|
+
reason: RefundReason
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
type RefundResult = {
|
|
357
|
+
refundToken?: string
|
|
358
|
+
status: TransactionStatus
|
|
359
|
+
refundReason: RefundReason
|
|
360
|
+
paymentMethod?: PaymentMethod
|
|
361
|
+
requestedAmount?: number
|
|
362
|
+
requestedCurrency?: string
|
|
363
|
+
settlementAmount?: number
|
|
364
|
+
settlementCurrency?: string
|
|
365
|
+
fxRate?: number
|
|
366
|
+
createdAt?: string // ISO 8601 UTC
|
|
367
|
+
processedAt?: string // ISO 8601 UTC
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
type PaymentMethod = 'CARD' | 'SEPA' | 'CERTIS' | 'CRYPTO'
|
|
371
|
+
type PaymentMethodStatus = 'NOT_STARTED' | 'PENDING' | 'ACTIVE' | 'ATTENTION_NEEDED' | 'ACTION_REQUIRED' | 'BLOCKED'
|
|
372
|
+
|
|
373
|
+
type AcceptPaymentMethodStatus = { method: PaymentMethod; status: PaymentMethodStatus }
|
|
374
|
+
type AcceptOnboardingStatus = { isOnboarded: boolean; paymentMethods: AcceptPaymentMethodStatus[] }
|
|
375
|
+
|
|
273
376
|
type GradientColors = { start: string; end: string }
|
|
274
377
|
|
|
275
378
|
type AcceptColorTheme = {
|
|
276
|
-
accent: string
|
|
379
|
+
accent: string // #RRGGBB or #AARRGGBB
|
|
277
380
|
error: string
|
|
278
381
|
warning: string
|
|
279
382
|
success: string
|
|
@@ -282,7 +385,7 @@ type AcceptColorTheme = {
|
|
|
282
385
|
}
|
|
283
386
|
|
|
284
387
|
type AcceptImageTheme = {
|
|
285
|
-
brandLogo: string
|
|
388
|
+
brandLogo: string // base64 PNG/JPEG
|
|
286
389
|
toolbarLogo: string
|
|
287
390
|
solidLogo: string
|
|
288
391
|
}
|
|
@@ -292,9 +395,19 @@ type AcceptThemeConfiguration = {
|
|
|
292
395
|
images?: AcceptImageTheme
|
|
293
396
|
}
|
|
294
397
|
|
|
398
|
+
// Android-only
|
|
399
|
+
type NfcIndicator = 'DEFAULT' | 'ABOVE' | 'BELOW' | 'FRONT' | 'BEHIND'
|
|
400
|
+
type NfcPosition = { xBias: number; yBias: number } // 0..1 normalized; omit position for terminal default
|
|
401
|
+
type NfcZone = { indicator: NfcIndicator; position?: NfcPosition }
|
|
402
|
+
type AcceptUiBehavior = {
|
|
403
|
+
resultScreenDurationSeconds?: number
|
|
404
|
+
showResultScreen?: boolean
|
|
405
|
+
nfcZone?: NfcZone
|
|
406
|
+
}
|
|
407
|
+
|
|
295
408
|
type KybPrefillData = {
|
|
296
409
|
businessType?: 'individual' | 'company' | 'nonProfit' | 'governmentEntity'
|
|
297
|
-
countryCode?: string
|
|
410
|
+
countryCode?: string // ISO 3166-1 alpha-2
|
|
298
411
|
registrationNumber?: string
|
|
299
412
|
vatNumber?: string
|
|
300
413
|
legalName?: string
|
package/android/build.gradle
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
apply plugin: 'com.android.library'
|
|
2
2
|
|
|
3
3
|
group = 'com.tapaya.acceptsdkreactnative'
|
|
4
|
-
version = '1.
|
|
4
|
+
version = '1.2.0'
|
|
5
5
|
|
|
6
6
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
7
7
|
apply from: expoModulesCorePlugin
|
|
@@ -35,7 +35,7 @@ android {
|
|
|
35
35
|
namespace "com.tapaya.acceptsdkreactnative"
|
|
36
36
|
defaultConfig {
|
|
37
37
|
versionCode 1
|
|
38
|
-
versionName "1.
|
|
38
|
+
versionName "1.2.0"
|
|
39
39
|
}
|
|
40
40
|
lintOptions {
|
|
41
41
|
abortOnError false
|
|
@@ -43,7 +43,7 @@ android {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
dependencies {
|
|
46
|
-
implementation 'com.tapaya:accept:1.
|
|
46
|
+
implementation 'com.tapaya:accept:1.2.0'
|
|
47
47
|
implementation 'com.google.code.gson:gson:2.13.2'
|
|
48
48
|
implementation 'androidx.appcompat:appcompat:1.7.1'
|
|
49
49
|
implementation 'androidx.compose.ui:ui:1.8.2'
|