@tonder.io/rn-sdk 0.1.0-beta.DEV1355.1 → 0.1.0-beta.DEV1355.3
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 +1302 -13
- package/lib/commonjs/core/3DSHandler.js +5 -3
- package/lib/commonjs/core/3DSHandler.js.map +1 -1
- package/lib/commonjs/core/BaseCheckout/index.js +6 -3
- package/lib/commonjs/core/BaseCheckout/index.js.map +1 -1
- package/lib/commonjs/core/PaymentInlineContainer/index.js +1 -1
- package/lib/commonjs/core/PaymentInlineContainer/index.js.map +1 -1
- package/lib/commonjs/core/PaymentLiteContainer/index.js +1 -1
- package/lib/commonjs/core/PaymentLiteContainer/index.js.map +1 -1
- package/lib/commonjs/core/Tonder/index.js +1 -3
- package/lib/commonjs/core/Tonder/index.js.map +1 -1
- package/lib/commonjs/services/CardService.js +5 -4
- package/lib/commonjs/services/CardService.js.map +1 -1
- package/lib/commonjs/types/base.js.map +1 -1
- package/lib/commonjs/ui/components/Input/CardCVVInput.js +2 -1
- package/lib/commonjs/ui/components/Input/CardCVVInput.js.map +1 -1
- package/lib/commonjs/ui/components/Input/CardExpirationMonthInput.js +2 -1
- package/lib/commonjs/ui/components/Input/CardExpirationMonthInput.js.map +1 -1
- package/lib/commonjs/ui/components/Input/CardExpirationYearInput.js +2 -1
- package/lib/commonjs/ui/components/Input/CardExpirationYearInput.js.map +1 -1
- package/lib/commonjs/ui/components/Input/CardHolderInput.js +2 -1
- package/lib/commonjs/ui/components/Input/CardHolderInput.js.map +1 -1
- package/lib/commonjs/ui/components/Input/CardNumberInput.js +2 -1
- package/lib/commonjs/ui/components/Input/CardNumberInput.js.map +1 -1
- package/lib/commonjs/ui/providers/TonderProvider/uiWrapper.js +2 -1
- package/lib/commonjs/ui/providers/TonderProvider/uiWrapper.js.map +1 -1
- package/lib/module/core/3DSHandler.js +5 -3
- package/lib/module/core/3DSHandler.js.map +1 -1
- package/lib/module/core/BaseCheckout/index.js +7 -4
- package/lib/module/core/BaseCheckout/index.js.map +1 -1
- package/lib/module/core/PaymentInlineContainer/index.js +1 -1
- package/lib/module/core/PaymentInlineContainer/index.js.map +1 -1
- package/lib/module/core/PaymentLiteContainer/index.js +1 -1
- package/lib/module/core/PaymentLiteContainer/index.js.map +1 -1
- package/lib/module/core/Tonder/index.js +1 -3
- package/lib/module/core/Tonder/index.js.map +1 -1
- package/lib/module/services/CardService.js +5 -4
- package/lib/module/services/CardService.js.map +1 -1
- package/lib/module/types/base.js.map +1 -1
- package/lib/module/ui/components/Input/CardCVVInput.js +2 -1
- package/lib/module/ui/components/Input/CardCVVInput.js.map +1 -1
- package/lib/module/ui/components/Input/CardExpirationMonthInput.js +2 -1
- package/lib/module/ui/components/Input/CardExpirationMonthInput.js.map +1 -1
- package/lib/module/ui/components/Input/CardExpirationYearInput.js +2 -1
- package/lib/module/ui/components/Input/CardExpirationYearInput.js.map +1 -1
- package/lib/module/ui/components/Input/CardHolderInput.js +2 -1
- package/lib/module/ui/components/Input/CardHolderInput.js.map +1 -1
- package/lib/module/ui/components/Input/CardNumberInput.js +2 -1
- package/lib/module/ui/components/Input/CardNumberInput.js.map +1 -1
- package/lib/module/ui/providers/TonderProvider/uiWrapper.js +2 -1
- package/lib/module/ui/providers/TonderProvider/uiWrapper.js.map +1 -1
- package/lib/typescript/commonjs/src/core/3DSHandler.d.ts +1 -1
- package/lib/typescript/commonjs/src/core/3DSHandler.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/core/BaseCheckout/index.d.ts +3 -2
- package/lib/typescript/commonjs/src/core/BaseCheckout/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/core/Tonder/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/services/CardService.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/base.d.ts +0 -1
- package/lib/typescript/commonjs/src/types/base.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/baseCheckout.d.ts +2 -3
- package/lib/typescript/commonjs/src/types/baseCheckout.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/inlineCheckout.d.ts +1 -2
- package/lib/typescript/commonjs/src/types/inlineCheckout.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/liteCheckout.d.ts +0 -1
- package/lib/typescript/commonjs/src/types/liteCheckout.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/threeDSHandler.d.ts +1 -1
- package/lib/typescript/commonjs/src/types/threeDSHandler.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/components/Input/CardCVVInput.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/components/Input/CardExpirationMonthInput.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/components/Input/CardExpirationYearInput.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/components/Input/CardHolderInput.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/components/Input/CardNumberInput.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/providers/TonderProvider/uiWrapper.d.ts.map +1 -1
- package/lib/typescript/module/src/core/3DSHandler.d.ts +1 -1
- package/lib/typescript/module/src/core/3DSHandler.d.ts.map +1 -1
- package/lib/typescript/module/src/core/BaseCheckout/index.d.ts +3 -2
- package/lib/typescript/module/src/core/BaseCheckout/index.d.ts.map +1 -1
- package/lib/typescript/module/src/core/Tonder/index.d.ts.map +1 -1
- package/lib/typescript/module/src/services/CardService.d.ts.map +1 -1
- package/lib/typescript/module/src/types/base.d.ts +0 -1
- package/lib/typescript/module/src/types/base.d.ts.map +1 -1
- package/lib/typescript/module/src/types/baseCheckout.d.ts +2 -3
- package/lib/typescript/module/src/types/baseCheckout.d.ts.map +1 -1
- package/lib/typescript/module/src/types/inlineCheckout.d.ts +1 -2
- package/lib/typescript/module/src/types/inlineCheckout.d.ts.map +1 -1
- package/lib/typescript/module/src/types/liteCheckout.d.ts +0 -1
- package/lib/typescript/module/src/types/liteCheckout.d.ts.map +1 -1
- package/lib/typescript/module/src/types/threeDSHandler.d.ts +1 -1
- package/lib/typescript/module/src/types/threeDSHandler.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/components/Input/CardCVVInput.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/components/Input/CardExpirationMonthInput.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/components/Input/CardExpirationYearInput.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/components/Input/CardHolderInput.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/components/Input/CardNumberInput.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/providers/TonderProvider/uiWrapper.d.ts.map +1 -1
- package/package.json +1 -4
- package/src/core/3DSHandler.ts +8 -2
- package/src/core/BaseCheckout/index.ts +39 -25
- package/src/core/PaymentInlineContainer/index.ts +1 -1
- package/src/core/PaymentLiteContainer/index.ts +1 -1
- package/src/core/Tonder/index.ts +0 -4
- package/src/services/CardService.ts +5 -4
- package/src/types/base.ts +0 -1
- package/src/types/baseCheckout.ts +2 -1
- package/src/types/inlineCheckout.ts +1 -2
- package/src/types/liteCheckout.ts +0 -1
- package/src/types/threeDSHandler.ts +1 -0
- package/src/ui/components/Input/CardCVVInput.tsx +2 -1
- package/src/ui/components/Input/CardExpirationMonthInput.tsx +2 -1
- package/src/ui/components/Input/CardExpirationYearInput.tsx +2 -1
- package/src/ui/components/Input/CardHolderInput.tsx +2 -1
- package/src/ui/components/Input/CardNumberInput.tsx +2 -1
- package/src/ui/providers/TonderProvider/uiWrapper.ts +8 -1
- package/lib/commonjs/hooks/useTonder/index-old.js +0 -37
- package/lib/commonjs/hooks/useTonder/index-old.js.map +0 -1
- package/lib/module/hooks/useTonder/index-old.js +0 -37
- package/lib/module/hooks/useTonder/index-old.js.map +0 -1
- package/lib/typescript/commonjs/src/hooks/useTonder/index-old.d.ts +0 -1
- package/lib/typescript/commonjs/src/hooks/useTonder/index-old.d.ts.map +0 -1
- package/lib/typescript/module/src/hooks/useTonder/index-old.d.ts +0 -1
- package/lib/typescript/module/src/hooks/useTonder/index-old.d.ts.map +0 -1
- package/src/hooks/useTonder/index-old.ts +0 -35
package/README.md
CHANGED
|
@@ -1,33 +1,1322 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Tonder React Native SDK
|
|
2
2
|
|
|
3
|
-
Tonder
|
|
3
|
+
Tonder React Native SDK helps integrate Tonder's payment services into your React Native application, providing secure and flexible payment processing capabilities.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Installation](#installation)
|
|
8
|
+
- [Requirements](#requirements)
|
|
9
|
+
- [Features](#features)
|
|
10
|
+
- [Secure token](#secure-token)
|
|
11
|
+
- [Usage](#usage)
|
|
12
|
+
- [Provider Setup](#provider-setup)
|
|
13
|
+
- [Full Payment Integration](#full-payment-integration)
|
|
14
|
+
- [Lite Payment Integration](#lite-payment-integration)
|
|
15
|
+
- [Card Enrollment Integration](#card-enrollment-integration)
|
|
16
|
+
- [Configuration](#configuration)
|
|
17
|
+
- [Components](#components)
|
|
18
|
+
- [API Reference](#api-reference)
|
|
19
|
+
- [Styling](#styling)
|
|
20
|
+
- [Inline and Enrollment Styling](#inline--enrollment-styling)
|
|
21
|
+
- [Lite Styling](#lite-styling)
|
|
22
|
+
- [Examples](#examples)
|
|
4
23
|
|
|
5
24
|
## Installation
|
|
6
25
|
|
|
7
|
-
```
|
|
26
|
+
```bash
|
|
8
27
|
npm install @tonder.io/rn-sdk
|
|
28
|
+
# OR
|
|
29
|
+
yarn add @tonder.io/rn-sdk
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Requirements
|
|
33
|
+
- React Native >= 0.70
|
|
34
|
+
- React >= 16.8
|
|
35
|
+
|
|
36
|
+
## Features
|
|
37
|
+
|
|
38
|
+
The SDK supports three integration types:
|
|
39
|
+
|
|
40
|
+
- `SDKType.INLINE`: Full payment UI with built-in components and features
|
|
41
|
+
- Pre-built UI components
|
|
42
|
+
- Saved cards management
|
|
43
|
+
- Multiple payment methods support
|
|
44
|
+
- Built-in error handling and validation
|
|
45
|
+
- Customizable styling and layout
|
|
46
|
+
|
|
47
|
+
- `SDKType.LITE`: Individual components for custom UI implementations
|
|
48
|
+
- Secure input components for custom payment forms
|
|
49
|
+
- Card enrollment and management
|
|
50
|
+
- Payment method handling
|
|
51
|
+
- Card tokenization and storage
|
|
52
|
+
- Card deletion capabilities
|
|
53
|
+
- Manual payment flow control
|
|
54
|
+
- Flexible UI customization
|
|
55
|
+
- Direct access to all SDK features:
|
|
56
|
+
- Payment processing
|
|
57
|
+
- Card saving
|
|
58
|
+
- Card listing
|
|
59
|
+
- Card deletion
|
|
60
|
+
- Payment methods retrieval
|
|
61
|
+
|
|
62
|
+
- `SDKType.ENROLLMENT`: Card saving functionality
|
|
63
|
+
- Card tokenization
|
|
64
|
+
- Card validation
|
|
65
|
+
- Secure storage
|
|
66
|
+
|
|
67
|
+
Each type can be specified when initializing the SDK through the TonderProvider:
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
// Full Payment UI
|
|
71
|
+
<TonderProvider
|
|
72
|
+
config={{
|
|
73
|
+
type: SDKType.INLINE,
|
|
74
|
+
mode: 'development',
|
|
75
|
+
apiKey: 'your-api-key',
|
|
76
|
+
}}
|
|
77
|
+
>
|
|
78
|
+
<YourApp />
|
|
79
|
+
</TonderProvider>
|
|
80
|
+
|
|
81
|
+
// Custom UI with Individual Components
|
|
82
|
+
<TonderProvider
|
|
83
|
+
config={{
|
|
84
|
+
type: SDKType.LITE,
|
|
85
|
+
mode: 'development',
|
|
86
|
+
apiKey: 'your-api-key',
|
|
87
|
+
}}
|
|
88
|
+
>
|
|
89
|
+
<YourApp />
|
|
90
|
+
</TonderProvider>
|
|
91
|
+
|
|
92
|
+
// Card Enrollment
|
|
93
|
+
<TonderProvider
|
|
94
|
+
config={{
|
|
95
|
+
type: SDKType.ENROLLMENT,
|
|
96
|
+
mode: 'development',
|
|
97
|
+
apiKey: 'your-api-key',
|
|
98
|
+
}}
|
|
99
|
+
>
|
|
100
|
+
<YourApp />
|
|
101
|
+
</TonderProvider>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Secure token
|
|
105
|
+
For card-related operations (save, list, delete), you need a secure token. This should be obtained through your backend for security:
|
|
106
|
+
|
|
107
|
+
Environment URLs:
|
|
108
|
+
- Staging: https://stage.tonder.io
|
|
109
|
+
- Production: Contact Tonder team
|
|
110
|
+
|
|
111
|
+
**Important**: Never expose your API secret key in frontend code. It is recommended to implement token generation in your backend.
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
const getSecureToken = async (apiSecretKey: string) => {
|
|
115
|
+
const response = await fetch(
|
|
116
|
+
`${TONDER_ENVIRONMENT_URL}/api/secure-token/`,
|
|
117
|
+
{
|
|
118
|
+
method: 'POST',
|
|
119
|
+
headers: {
|
|
120
|
+
'Authorization': `Token ${'YOUR-SECRET-API-KEY'}`,
|
|
121
|
+
'Content-Type': 'application/json',
|
|
122
|
+
},
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
const data = await response.json();
|
|
127
|
+
return data.access;
|
|
128
|
+
};
|
|
9
129
|
```
|
|
10
130
|
|
|
131
|
+
|
|
11
132
|
## Usage
|
|
12
133
|
|
|
134
|
+
### Provider Setup
|
|
135
|
+
|
|
136
|
+
First, wrap your application or payment screen with the `TonderProvider`:
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
import { TonderProvider, SDKType } from '@tonder.io/rn-sdk';
|
|
140
|
+
|
|
141
|
+
function App() {
|
|
142
|
+
return (
|
|
143
|
+
<TonderProvider
|
|
144
|
+
config={{
|
|
145
|
+
type: SDKType.INLINE, // or SDKType.LITE or SDKType.ENROLLMENT
|
|
146
|
+
mode: 'development', // or production
|
|
147
|
+
apiKey: 'your-api-key',
|
|
148
|
+
}}
|
|
149
|
+
>
|
|
150
|
+
<YourApp />
|
|
151
|
+
</TonderProvider>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
### Full Payment Integration
|
|
156
|
+
|
|
157
|
+
The Full Payment integration provides a complete pre-built UI for payment processing
|
|
158
|
+
Before create the mobile SDK, your checkout page should:
|
|
159
|
+
- Obtain the security token for card functionalities (save, delete, list).
|
|
160
|
+
- Show the products being purchased and the total amount
|
|
161
|
+
- Collect any required customer information
|
|
162
|
+
|
|
163
|
+
```tsx
|
|
164
|
+
import {
|
|
165
|
+
TonderPayment,
|
|
166
|
+
useTonder,
|
|
167
|
+
SDKType,
|
|
168
|
+
IBaseProcessPaymentRequest
|
|
169
|
+
} from '@tonder.io/rn-sdk';
|
|
170
|
+
|
|
171
|
+
export default function FullPaymentScreen() {
|
|
172
|
+
const { create, reset } = useTonder<SDKType.INLINE>();
|
|
173
|
+
|
|
174
|
+
const paymentData: IBaseProcessPaymentRequest = {
|
|
175
|
+
customer: {
|
|
176
|
+
email: 'test@example.com',
|
|
177
|
+
firstName: 'John',
|
|
178
|
+
lastName: 'Doe',
|
|
179
|
+
},
|
|
180
|
+
cart: {
|
|
181
|
+
total: 399,
|
|
182
|
+
items: [{
|
|
183
|
+
name: 'Product',
|
|
184
|
+
amount_total: 399,
|
|
185
|
+
description: 'Description',
|
|
186
|
+
price_unit: 399,
|
|
187
|
+
quantity: 1,
|
|
188
|
+
}]
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
useEffect(() => {
|
|
193
|
+
initializePayment();
|
|
194
|
+
}, []);
|
|
195
|
+
|
|
196
|
+
const initializePayment = async () => {
|
|
197
|
+
const { error } = await create({
|
|
198
|
+
secureToken: 'your-secure-token',
|
|
199
|
+
paymentData,
|
|
200
|
+
callbacks: {
|
|
201
|
+
onFinishPayment: handlePaymentFinish
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
if (error) {
|
|
206
|
+
console.error('SDK initialization error:', error);
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const callbackFinish = async (response) => {
|
|
211
|
+
console.log('FINISH PAYMENT ===== ', response);
|
|
212
|
+
|
|
213
|
+
// Reset the state and regenerate the SDK to use it again.
|
|
214
|
+
reset();
|
|
215
|
+
await initializePayment();
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
return (
|
|
219
|
+
<SafeAreaView>
|
|
220
|
+
<TonderPayment />
|
|
221
|
+
</SafeAreaView>
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Lite Payment Integration
|
|
227
|
+
|
|
228
|
+
The Lite Payment integration provides individual components for a custom payment UI.
|
|
229
|
+
Before create the mobile SDK, your checkout page should:
|
|
230
|
+
- Obtain the security token for card functionalities (save, delete, list).
|
|
231
|
+
- Show the products being purchased and the total amount
|
|
232
|
+
- Collect any required customer information
|
|
233
|
+
|
|
234
|
+
```tsx
|
|
235
|
+
import {
|
|
236
|
+
CardHolderInput,
|
|
237
|
+
CardNumberInput,
|
|
238
|
+
CardExpirationMonthInput,
|
|
239
|
+
CardExpirationYearInput,
|
|
240
|
+
CardCVVInput,
|
|
241
|
+
useTonder,
|
|
242
|
+
SDKType
|
|
243
|
+
} from '@tonder.io/rn-sdk';
|
|
244
|
+
|
|
245
|
+
export default function LitePaymentScreen() {
|
|
246
|
+
const { create, payment } = useTonder<SDKType.LITE>();
|
|
247
|
+
|
|
248
|
+
const paymentData = {
|
|
249
|
+
customer: {
|
|
250
|
+
email: 'test@example.com',
|
|
251
|
+
firstName: 'John',
|
|
252
|
+
lastName: 'Doe',
|
|
253
|
+
},
|
|
254
|
+
cart: {
|
|
255
|
+
total: 399,
|
|
256
|
+
items: [{
|
|
257
|
+
name: 'Product',
|
|
258
|
+
amount_total: 399,
|
|
259
|
+
description: 'Description',
|
|
260
|
+
price_unit: 399,
|
|
261
|
+
quantity: 1,
|
|
262
|
+
}]
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
useEffect(() => {
|
|
267
|
+
initializePayment();
|
|
268
|
+
}, []);
|
|
269
|
+
|
|
270
|
+
const initializePayment = async () => {
|
|
271
|
+
const { error } = await create({
|
|
272
|
+
secureToken: 'your-secure-token',
|
|
273
|
+
paymentData,
|
|
274
|
+
customization: {
|
|
275
|
+
saveCards: {
|
|
276
|
+
autoSave: false,
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
if (error) {
|
|
282
|
+
console.error('SDK initialization error:', error);
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
const handlePayment = async () => {
|
|
287
|
+
const { response, error } = await payment();
|
|
288
|
+
if (error) {
|
|
289
|
+
console.error('Payment error:', error);
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
console.log('Payment success:', response);
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
return (
|
|
296
|
+
<SafeAreaView>
|
|
297
|
+
<CardHolderInput />
|
|
298
|
+
<CardNumberInput />
|
|
299
|
+
<CardExpirationMonthInput />
|
|
300
|
+
<CardExpirationYearInput />
|
|
301
|
+
<CardCVVInput />
|
|
302
|
+
<TouchableOpacity onPress={handlePayment}>
|
|
303
|
+
<Text>Pay</Text>
|
|
304
|
+
</TouchableOpacity>
|
|
305
|
+
</SafeAreaView>
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Card Enrollment Integration
|
|
311
|
+
|
|
312
|
+
For saving cards without processing payments.
|
|
313
|
+
Before create the mobile SDK, your checkout page should:
|
|
314
|
+
- Obtain the security token for card functionalities (save, delete, list).
|
|
315
|
+
- Collect any required customer information
|
|
316
|
+
|
|
317
|
+
```tsx
|
|
318
|
+
import {
|
|
319
|
+
TonderEnrollment,
|
|
320
|
+
useTonder,
|
|
321
|
+
SDKType,
|
|
322
|
+
ICustomer
|
|
323
|
+
} from '@tonder.io/rn-sdk';
|
|
324
|
+
|
|
325
|
+
export default function EnrollmentScreen() {
|
|
326
|
+
const { create, reset } = useTonder<SDKType.ENROLLMENT>();
|
|
327
|
+
|
|
328
|
+
const customerData: ICustomer = {
|
|
329
|
+
email: 'test@example.com',
|
|
330
|
+
firstName: 'John',
|
|
331
|
+
lastName: 'Doe'
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
useEffect(() => {
|
|
335
|
+
initializeEnrollment();
|
|
336
|
+
}, []);
|
|
337
|
+
|
|
338
|
+
const initializeEnrollment = async () => {
|
|
339
|
+
const { error } = await create({
|
|
340
|
+
secureToken: 'your-secure-token',
|
|
341
|
+
customer: customerData,
|
|
342
|
+
callbacks: {
|
|
343
|
+
onFinishSave: handleSaveFinish
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
if (error) {
|
|
348
|
+
console.error('Enrollment initialization error:', error);
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
const handleSaveFinish = async (response) => {
|
|
353
|
+
console.log('Card saved successfully:', response);
|
|
354
|
+
// Reset the state and regenerate the SDK to use it again
|
|
355
|
+
reset();
|
|
356
|
+
await initializeEnrollment();
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
return (
|
|
360
|
+
<SafeAreaView>
|
|
361
|
+
<TonderEnrollment />
|
|
362
|
+
</SafeAreaView>
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### Card Enrollment Lite Integration
|
|
368
|
+
|
|
369
|
+
For saving cards with individual components, before create the mobile SDK, your checkout page should:
|
|
370
|
+
- Obtain the security token for card functionalities (save, delete, list).
|
|
371
|
+
- Collect any required customer information:
|
|
372
|
+
|
|
373
|
+
```tsx
|
|
374
|
+
import {
|
|
375
|
+
CardHolderInput,
|
|
376
|
+
CardNumberInput,
|
|
377
|
+
CardExpirationMonthInput,
|
|
378
|
+
CardExpirationYearInput,
|
|
379
|
+
CardCVVInput,
|
|
380
|
+
useTonder,
|
|
381
|
+
SDKType,
|
|
382
|
+
ICustomer
|
|
383
|
+
} from '@tonder.io/rn-sdk';
|
|
384
|
+
|
|
385
|
+
export default function EnrollmentLiteScreen() {
|
|
386
|
+
const { create, saveCustomerCard, reset } = useTonder<SDKType.ENROLLMENT>();
|
|
387
|
+
|
|
388
|
+
const customerData: ICustomer = {
|
|
389
|
+
email: 'test@example.com',
|
|
390
|
+
firstName: 'John',
|
|
391
|
+
lastName: 'Doe'
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
useEffect(() => {
|
|
395
|
+
initializeEnrollment();
|
|
396
|
+
}, []);
|
|
397
|
+
|
|
398
|
+
const initializeEnrollment = async () => {
|
|
399
|
+
const { error } = await create({
|
|
400
|
+
secureToken: 'your-secure-token',
|
|
401
|
+
customer: customerData,
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
if (error) {
|
|
405
|
+
console.error('Enrollment initialization error:', error);
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
const handleSaveCard = async () => {
|
|
410
|
+
try {
|
|
411
|
+
const { response, error } = await saveCustomerCard();
|
|
412
|
+
if (error) {
|
|
413
|
+
console.error('Error saving card:', error);
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
console.log('Card saved successfully:', response);
|
|
417
|
+
|
|
418
|
+
// Reset and reinitialize for next use
|
|
419
|
+
reset();
|
|
420
|
+
await initializeEnrollment();
|
|
421
|
+
} catch (e) {
|
|
422
|
+
console.error('Unexpected error:', e);
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
return (
|
|
427
|
+
<SafeAreaView>
|
|
428
|
+
<CardHolderInput />
|
|
429
|
+
<CardNumberInput />
|
|
430
|
+
<CardExpirationMonthInput />
|
|
431
|
+
<CardExpirationYearInput />
|
|
432
|
+
<CardCVVInput />
|
|
433
|
+
<TouchableOpacity
|
|
434
|
+
onPress={handleSaveCard}
|
|
435
|
+
>
|
|
436
|
+
<Text>Save Card</Text>
|
|
437
|
+
</TouchableOpacity>
|
|
438
|
+
</SafeAreaView>
|
|
439
|
+
);
|
|
440
|
+
}
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
## Configuration
|
|
445
|
+
|
|
446
|
+
### Base Configuration
|
|
447
|
+
|
|
448
|
+
| Property | Type | Required | Description |
|
|
449
|
+
|-----------|--------------------------------------------|----------|-------------------------------------------------|
|
|
450
|
+
| mode | 'development' \| 'production' \| 'sandbox' | Yes | Environment mode for the SDK |
|
|
451
|
+
| apiKey | string | Yes | Your Tonder Public API key |
|
|
452
|
+
| type | SDKType | Yes | Integration type (INLINE or LITE or ENROLLMENT) |
|
|
453
|
+
| returnURL | string | No | URL for 3DS redirect completion |
|
|
454
|
+
|
|
455
|
+
<details>
|
|
456
|
+
<summary>View Interface Definition</summary>
|
|
457
|
+
|
|
458
|
+
```typescript
|
|
459
|
+
interface ISDKBaseConfig {
|
|
460
|
+
mode: 'development' | 'production' | 'sandbox';
|
|
461
|
+
apiKey: string;
|
|
462
|
+
type: SDKType;
|
|
463
|
+
returnURL?: string;
|
|
464
|
+
}
|
|
465
|
+
```
|
|
466
|
+
</details>
|
|
467
|
+
|
|
468
|
+
### Inline Options
|
|
469
|
+
Provide this information when calling the create function.
|
|
470
|
+
|
|
471
|
+
| Option | Type | Required | Description |
|
|
472
|
+
|---------------|-----------------------------|----------|------------------------------------------------------|
|
|
473
|
+
| paymentData | IBaseProcessPaymentRequest | Yes | Payment information including customer and cart data |
|
|
474
|
+
| customization | IInlineCustomizationOptions | No | UI customization options |
|
|
475
|
+
| callbacks | IInlineCallbacks | No | Payment process callback functions |
|
|
476
|
+
| returnURL | string | No | URL for 3D Secure redirect completion |
|
|
477
|
+
|
|
478
|
+
<details>
|
|
479
|
+
<summary>View IInlineCheckoutOptions Interface</summary>
|
|
480
|
+
|
|
481
|
+
```typescript
|
|
482
|
+
interface IInlineCheckoutOptions extends IBaseCreateOptions {
|
|
483
|
+
paymentData: IBaseProcessPaymentRequest;
|
|
484
|
+
customization?: IInlineCustomizationOptions;
|
|
485
|
+
callbacks?: IInlineCallbacks;
|
|
486
|
+
returnURL?: string;
|
|
487
|
+
}
|
|
488
|
+
```
|
|
489
|
+
</details>
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
### Lite Options
|
|
493
|
+
Provide this information when calling the create function.
|
|
494
|
+
|
|
495
|
+
| Option | Type | Required | Description |
|
|
496
|
+
|---------------|---------------------------|----------|------------------------------------------------------|
|
|
497
|
+
| paymentData | IProcessPaymentRequest | Yes | Payment information including customer and cart data |
|
|
498
|
+
| customization | ILiteCustomizationOptions | No | UI customization options |
|
|
499
|
+
| callbacks | ILiteCallbacks | No | Payment process callback functions |
|
|
500
|
+
| returnURL | string | No | URL for 3D Secure redirect completion |
|
|
13
501
|
|
|
14
|
-
|
|
15
|
-
|
|
502
|
+
<details>
|
|
503
|
+
<summary>View IInlineCheckoutOptions Interface</summary>
|
|
16
504
|
|
|
17
|
-
|
|
505
|
+
```typescript
|
|
506
|
+
interface ILiteCheckoutOptions extends IBaseCreateOptions {
|
|
507
|
+
paymentData: IProcessPaymentRequest;
|
|
508
|
+
customization?: ILiteCustomizationOptions;
|
|
509
|
+
callbacks?: ILiteCallbacks;
|
|
510
|
+
returnURL?: string;
|
|
511
|
+
}
|
|
512
|
+
```
|
|
513
|
+
</details>
|
|
514
|
+
|
|
515
|
+
### Enrollment Options
|
|
516
|
+
Provide this information when calling the create function.
|
|
517
|
+
|
|
518
|
+
| Option | Type | Required | Description |
|
|
519
|
+
|---------------|---------------------------------|----------|---------------------------------------|
|
|
520
|
+
| customer | ICustomer | Yes | Customer information |
|
|
521
|
+
| customization | IEnrollmentCustomizationOptions | No | UI customization options |
|
|
522
|
+
| callbacks | IEnrollmentCallbacks | No | Enrollment process callback functions |
|
|
523
|
+
|
|
524
|
+
<details>
|
|
525
|
+
<summary>View IInlineCheckoutOptions Interface</summary>
|
|
526
|
+
|
|
527
|
+
```typescript
|
|
528
|
+
export interface IEnrollmentOptions extends IBaseCreateOptions {
|
|
529
|
+
customer?: ICustomer;
|
|
530
|
+
customization?: IEnrollmentCustomizationOptions;
|
|
531
|
+
callbacks?: IEnrollmentCallbacks;
|
|
532
|
+
}
|
|
533
|
+
```
|
|
534
|
+
</details>
|
|
535
|
+
|
|
536
|
+
### Inline Callbacks Structure
|
|
537
|
+
|
|
538
|
+
| Callback | Parameters | Description | Return |
|
|
539
|
+
|----------------------|-----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
|
|
540
|
+
| `beforePayment` | none | Called before the payment process begins. You can use this to show a loading state, validate additional data, or perform any pre-payment tasks. | Promise<void> |
|
|
541
|
+
| `onFinishPayment` | `response: IBaseResponse<ITransaction>` | Called when the payment process completes (success or error). Provides the transaction result or error details. | Promise<void> |
|
|
542
|
+
| `beforeDeleteCard` | none | Called before the delete card process begins. You can use this to show a loading state, validate additional data, or perform any pre-delete tasks. | Promise<void> |
|
|
543
|
+
| `onFinishDeleteCard` | `response: IBaseResponse<string>` | Called when the delete card process completes (success or error). | Promise<void> |
|
|
544
|
+
|
|
545
|
+
<details>
|
|
546
|
+
<summary>View Callback Interface</summary>
|
|
547
|
+
|
|
548
|
+
```typescript
|
|
549
|
+
|
|
550
|
+
export interface IInlineCallbacks {
|
|
551
|
+
beforePayment?: () => Promise<void>;
|
|
552
|
+
onFinishPayment?: (response: IBaseResponse<ITransaction>) => Promise<void>;
|
|
553
|
+
beforeDeleteCard?: () => Promise<void>;
|
|
554
|
+
onFinishDeleteCard?: (response: IBaseResponse<string>) => Promise<void>;
|
|
555
|
+
}
|
|
556
|
+
```
|
|
557
|
+
</details>
|
|
558
|
+
|
|
559
|
+
### Lite Callbacks Structure
|
|
560
|
+
|
|
561
|
+
| Callback | Parameters | Description | Return |
|
|
562
|
+
|----------------------|-----------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
|
|
563
|
+
| `beforePayment` | none | Called before the payment process begins. You can use this to show a loading state, validate additional data, or perform any pre-payment tasks. | Promise<void> |
|
|
564
|
+
| `onFinishPayment` | `response: IBaseResponse<ITransaction>` | Called when the payment process completes (success or error). Provides the transaction result or error details. | Promise<void> |
|
|
18
565
|
|
|
19
|
-
|
|
566
|
+
<details>
|
|
567
|
+
<summary>View Callback Interface</summary>
|
|
568
|
+
|
|
569
|
+
```typescript
|
|
570
|
+
|
|
571
|
+
export interface ILiteCallbacks {
|
|
572
|
+
beforePayment?: () => Promise<void>;
|
|
573
|
+
onFinishPayment?: (response: IBaseResponse<ITransaction>) => Promise<void>;
|
|
574
|
+
}
|
|
575
|
+
```
|
|
576
|
+
</details>
|
|
577
|
+
|
|
578
|
+
### Enrollment Callbacks Structure
|
|
579
|
+
|
|
580
|
+
| Callback | Parameters | Description | Return |
|
|
581
|
+
|----------------|----------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
|
|
582
|
+
| `beforeSave` | none | Called before the save card process begins. You can use this to show a loading state, validate additional data, or perform any pre-save-card tasks. | Promise<void> |
|
|
583
|
+
| `onFinishSave` | `response: IBaseResponse<ISaveCardResponse>` | Called when the save card process completes (success or error). Provides the transaction result or error details. | Promise<void> |
|
|
584
|
+
|
|
585
|
+
<details>
|
|
586
|
+
<summary>View Callback Interface</summary>
|
|
587
|
+
|
|
588
|
+
```typescript
|
|
589
|
+
|
|
590
|
+
export interface IEnrollmentCallbacks {
|
|
591
|
+
beforeSave?: () => Promise<void>;
|
|
592
|
+
onFinishSave?: (response: IBaseResponse<ISaveCardResponse>) => Promise<void>;
|
|
593
|
+
}
|
|
20
594
|
```
|
|
595
|
+
</details>
|
|
596
|
+
|
|
597
|
+
### Payment Data Structure
|
|
598
|
+
|
|
599
|
+
#### Customer Information
|
|
600
|
+
|
|
601
|
+
| Field | Type | Required | Description |
|
|
602
|
+
|-----------|--------|----------|---------------------------------|
|
|
603
|
+
| email | string | Yes | Customer's email address |
|
|
604
|
+
| firstName | string | Yes | Customer's first name |
|
|
605
|
+
| lastName | string | Yes | Customer's last name |
|
|
606
|
+
| phone | string | No | Customer's contact phone number |
|
|
607
|
+
| address | string | No | Customer's street address |
|
|
608
|
+
| city | string | No | Customer's city |
|
|
609
|
+
| state | string | No | Customer's state/province |
|
|
610
|
+
| country | string | No | Customer's country |
|
|
611
|
+
| postCode | string | No | Customer's postal/ZIP code |
|
|
612
|
+
|
|
613
|
+
#### Cart Information
|
|
614
|
+
|
|
615
|
+
| Field | Type | Required | Description |
|
|
616
|
+
|----------|---------------------|----------|--------------------------------------------|
|
|
617
|
+
| total | number | Yes | Total amount of the transaction |
|
|
618
|
+
| items | Array<IItem> | Yes | Array of items in the cart |
|
|
619
|
+
| metadata | Record<string, any> | No | Additional custom data for the transaction |
|
|
620
|
+
| currency | string | No | Currency code (default: MXN) |
|
|
621
|
+
|
|
622
|
+
#### Cart Item Structure
|
|
21
623
|
|
|
624
|
+
| Field | Type | Required | Description |
|
|
625
|
+
|-------------------|--------|----------|-----------------------------------------------|
|
|
626
|
+
| name | string | Yes | Product name |
|
|
627
|
+
| amount_total | number | Yes | Total amount for this item (quantity × price) |
|
|
628
|
+
| description | string | Yes | Product description |
|
|
629
|
+
| price_unit | number | Yes | Unit price of the product |
|
|
630
|
+
| product_reference | string | Yes | Unique identifier for the product |
|
|
631
|
+
| quantity | number | Yes | Number of units |
|
|
632
|
+
| discount | number | No | Discount amount applied |
|
|
633
|
+
| taxes | number | No | Tax amount applied |
|
|
22
634
|
|
|
23
|
-
## Contributing
|
|
24
635
|
|
|
25
|
-
|
|
636
|
+
#### Additional fields for LITE VERSION
|
|
26
637
|
|
|
27
|
-
|
|
638
|
+
| Field | Type | Required | Description |
|
|
639
|
+
|----------------|--------|----------|------------------------------------------|
|
|
640
|
+
| card | string | no | The ID of the card selected by the user. |
|
|
641
|
+
| payment_method | string | no | The payment method selected by the user. |
|
|
28
642
|
|
|
29
|
-
|
|
643
|
+
<details>
|
|
644
|
+
|
|
645
|
+
<summary>View Complete Payment Data Interface</summary>
|
|
646
|
+
|
|
647
|
+
```typescript
|
|
648
|
+
// FOR INLINE VERSION
|
|
649
|
+
interface IBaseProcessPaymentRequest {
|
|
650
|
+
customer: {
|
|
651
|
+
email: string;
|
|
652
|
+
firstName: string;
|
|
653
|
+
lastName: string;
|
|
654
|
+
phone?: string;
|
|
655
|
+
address?: string;
|
|
656
|
+
city?: string;
|
|
657
|
+
state?: string;
|
|
658
|
+
country?: string;
|
|
659
|
+
postCode?: string;
|
|
660
|
+
};
|
|
661
|
+
cart: {
|
|
662
|
+
total: number;
|
|
663
|
+
items: Array<{
|
|
664
|
+
name: string;
|
|
665
|
+
amount_total: number;
|
|
666
|
+
description: string;
|
|
667
|
+
price_unit: number;
|
|
668
|
+
product_reference: string;
|
|
669
|
+
quantity: number;
|
|
670
|
+
discount?: number;
|
|
671
|
+
taxes?: number;
|
|
672
|
+
}>;
|
|
673
|
+
};
|
|
674
|
+
metadata?: Record<string, any>;
|
|
675
|
+
currency?: string;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
// FOR LITE VERSION
|
|
679
|
+
interface IProcessPaymentRequest {
|
|
680
|
+
customer: {
|
|
681
|
+
email: string;
|
|
682
|
+
firstName: string;
|
|
683
|
+
lastName: string;
|
|
684
|
+
phone?: string;
|
|
685
|
+
address?: string;
|
|
686
|
+
city?: string;
|
|
687
|
+
state?: string;
|
|
688
|
+
country?: string;
|
|
689
|
+
postCode?: string;
|
|
690
|
+
};
|
|
691
|
+
cart: {
|
|
692
|
+
total: number;
|
|
693
|
+
items: Array<{
|
|
694
|
+
name: string;
|
|
695
|
+
amount_total: number;
|
|
696
|
+
description: string;
|
|
697
|
+
price_unit: number;
|
|
698
|
+
product_reference: string;
|
|
699
|
+
quantity: number;
|
|
700
|
+
discount?: number;
|
|
701
|
+
taxes?: number;
|
|
702
|
+
}>;
|
|
703
|
+
};
|
|
704
|
+
metadata?: Record<string, any>;
|
|
705
|
+
currency?: string;
|
|
706
|
+
card?: string;
|
|
707
|
+
payment_method?: string;
|
|
708
|
+
}
|
|
709
|
+
```
|
|
710
|
+
</details>
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
### Customization Options for Inline Version
|
|
714
|
+
|
|
715
|
+
| Option | Type | Default | Description |
|
|
716
|
+
|------------------------------|---------|---------|-------------------------------------------------------------------------------------------|
|
|
717
|
+
| **saveCards** |
|
|
718
|
+
| saveCards.showSaveCardOption | boolean | true | Shows a checkbox allowing users to choose whether to save their card for future purchases |
|
|
719
|
+
| saveCards.showSaved | boolean | true | Displays a list of previously saved cards for the customer |
|
|
720
|
+
| saveCards.autoSave | boolean | false | Automatically saves the card without showing the save option to the user |
|
|
721
|
+
| saveCards.showDeleteOption | boolean | true | Shows a delete button for each saved card in the list |
|
|
722
|
+
| **paymentButton** |
|
|
723
|
+
| paymentButton.show | boolean | true | Controls the visibility of the payment button |
|
|
724
|
+
| paymentButton.text | string | 'Pagar' | Custom text to display on the payment button |
|
|
725
|
+
| paymentButton.showAmount | boolean | true | Shows the payment amount on the button (e.g., "Pay $100") |
|
|
726
|
+
| **paymentMethods** |
|
|
727
|
+
| paymentMethods.show | boolean | true | Controls the visibility of alternative payment methods section |
|
|
728
|
+
| **cardForm** |
|
|
729
|
+
| cardForm.show | boolean | true | Controls the visibility of the card input form |
|
|
730
|
+
| **General** |
|
|
731
|
+
| showMessages | boolean | true | Controls the visibility of error and success messages |
|
|
732
|
+
| labels | object | - | Custom labels for form fields (see Form Labels) |
|
|
733
|
+
| placeholders | object | - | Custom placeholder text for form inputs (see Form Placeholders) |
|
|
734
|
+
| styles | object | - | Custom styles for UI components (see Styling section) |
|
|
735
|
+
|
|
736
|
+
<details>
|
|
737
|
+
<summary>View Interface Definition</summary>
|
|
738
|
+
|
|
739
|
+
```typescript
|
|
740
|
+
interface IInlineCustomizationOptions {
|
|
741
|
+
saveCards?: {
|
|
742
|
+
showSaveCardOption?: boolean;
|
|
743
|
+
showSaved?: boolean;
|
|
744
|
+
autoSave?: boolean;
|
|
745
|
+
showDeleteOption?: boolean;
|
|
746
|
+
};
|
|
747
|
+
paymentButton?: {
|
|
748
|
+
show?: boolean;
|
|
749
|
+
text?: string;
|
|
750
|
+
showAmount?: boolean;
|
|
751
|
+
};
|
|
752
|
+
paymentMethods?: {
|
|
753
|
+
show?: boolean;
|
|
754
|
+
};
|
|
755
|
+
cardForm?: {
|
|
756
|
+
show?: boolean;
|
|
757
|
+
};
|
|
758
|
+
showMessages?: boolean;
|
|
759
|
+
labels?: IFormLabels;
|
|
760
|
+
placeholders?: IFormPlaceholder;
|
|
761
|
+
styles?: IStyles;
|
|
762
|
+
}
|
|
763
|
+
```
|
|
764
|
+
</details>
|
|
765
|
+
|
|
766
|
+
|
|
767
|
+
### Customization Options for Lite Version
|
|
768
|
+
|
|
769
|
+
| Option | Type | Default | Description |
|
|
770
|
+
|------------------------------|---------|---------|-------------------------------------------------------------------------------------------|
|
|
771
|
+
| **saveCards** |
|
|
772
|
+
| saveCards.autoSave | boolean | false | Automatically saves the card without showing the save option to the user |
|
|
773
|
+
|
|
774
|
+
<details>
|
|
775
|
+
<summary>View Interface Definition</summary>
|
|
776
|
+
|
|
777
|
+
```typescript
|
|
778
|
+
interface ILiteCustomizationOptions {
|
|
779
|
+
saveCards?: {
|
|
780
|
+
autoSave?: boolean;
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
```
|
|
784
|
+
</details>
|
|
785
|
+
|
|
786
|
+
### Customization Options for Enrollment Version
|
|
787
|
+
|
|
788
|
+
| Option | Type | Default | Description |
|
|
789
|
+
|-----------------|---------|-----------|-----------------------------------------------------------------|
|
|
790
|
+
| **saveButton** |
|
|
791
|
+
| saveButton.show | boolean | true | Controls the visibility of the save button |
|
|
792
|
+
| saveButton.text | string | 'Guardar' | Custom text to display on the save button |
|
|
793
|
+
| **General** |
|
|
794
|
+
| showMessages | boolean | true | Controls the visibility of error and success messages |
|
|
795
|
+
| labels | object | - | Custom labels for form fields (see Form Labels) |
|
|
796
|
+
| placeholders | object | - | Custom placeholder text for form inputs (see Form Placeholders) |
|
|
797
|
+
| styles | object | - | Custom styles for UI components (see Styling section) |
|
|
798
|
+
|
|
799
|
+
<details>
|
|
800
|
+
<summary>View Interface Definition</summary>
|
|
801
|
+
|
|
802
|
+
```typescript
|
|
803
|
+
interface IEnrollmentCustomizationOptions {
|
|
804
|
+
paymentButton?: {
|
|
805
|
+
show?: boolean;
|
|
806
|
+
text?: string;
|
|
807
|
+
};
|
|
808
|
+
showMessages?: boolean;
|
|
809
|
+
labels?: IFormLabels;
|
|
810
|
+
placeholders?: IFormPlaceholder;
|
|
811
|
+
styles?: IStyles;
|
|
812
|
+
}
|
|
813
|
+
```
|
|
814
|
+
</details>
|
|
815
|
+
|
|
816
|
+
### Form Labels & Placeholders
|
|
817
|
+
|
|
818
|
+
These options allow you to customize the text of the labels and placeholders for the form fields.
|
|
819
|
+
> **Note:** For the Lite version, you can pass the respective values directly when using Tonder's inputs.
|
|
820
|
+
|
|
821
|
+
|
|
822
|
+
#### Form Labels
|
|
823
|
+
Customization of field labels:
|
|
824
|
+
|
|
825
|
+
| Property | Type | Default | Description |
|
|
826
|
+
|------------|--------|-------------------------|----------------------------------------|
|
|
827
|
+
| name | string | "Titular de la tarjeta" | Label for the cardholder's name field. |
|
|
828
|
+
| cardNumber | string | "Número de tarjeta" | Label for the card number field. |
|
|
829
|
+
| cvv | string | "CVV" | Label for the security code field. |
|
|
830
|
+
| expiryDate | string | "Fecha de expiración" | Label for the expiration date fields. |
|
|
831
|
+
| expiryDate | string | "Fecha de expiración" | Label for the expiration date fields. |
|
|
832
|
+
|
|
833
|
+
<details>
|
|
834
|
+
<summary>View Form Labels Interface</summary>
|
|
835
|
+
|
|
836
|
+
```typescript
|
|
837
|
+
interface IFormLabels {
|
|
838
|
+
name?: string;
|
|
839
|
+
cardNumber?: string;
|
|
840
|
+
cvv?: string;
|
|
841
|
+
expiryDate?: string;
|
|
842
|
+
}
|
|
843
|
+
```
|
|
844
|
+
</details>
|
|
845
|
+
|
|
846
|
+
#### Form Placeholders
|
|
847
|
+
Customization of field placeholder:
|
|
848
|
+
|
|
849
|
+
| Property | Type | Default | Description |
|
|
850
|
+
|-------------|--------|-------------------------------------|----------------------------------------------|
|
|
851
|
+
| name | string | "Nombre como aparece en la tarjeta" | Placeholder for the cardholder's name field. |
|
|
852
|
+
| cardNumber | string | "1234 1234 1234 1234" | Placeholder for the card number field. |
|
|
853
|
+
| cvv | string | "3-4 dígitos" | Placeholder for the security code field. |
|
|
854
|
+
| expiryMonth | string | "MM" | Placeholder for the expiration month field. |
|
|
855
|
+
| expiryYear | string | "AA" | Placeholder for the expiration year field. |
|
|
856
|
+
|
|
857
|
+
<details>
|
|
858
|
+
<summary>View Form Placeholders Interface</summary>
|
|
859
|
+
|
|
860
|
+
```typescript
|
|
861
|
+
interface IFormPlaceholder {
|
|
862
|
+
name?: string;
|
|
863
|
+
cardNumber?: string;
|
|
864
|
+
cvv?: string;
|
|
865
|
+
expiryMonth?: string;
|
|
866
|
+
expiryYear?: string;
|
|
867
|
+
|
|
868
|
+
}
|
|
869
|
+
```
|
|
870
|
+
</details>
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
## Components
|
|
874
|
+
|
|
875
|
+
### Pre-built Components
|
|
876
|
+
|
|
877
|
+
The SDK provides two main pre-built components for full integrations:
|
|
878
|
+
|
|
879
|
+
- **TonderPayment**: Complete payment form with built-in card management, payment methods, and validations (INLINE)
|
|
880
|
+
- **TonderEnrollment**: Complete card enrollment form for saving cards (ENROLLMENT)
|
|
881
|
+
|
|
882
|
+
### Individual Components
|
|
883
|
+
|
|
884
|
+
All individual components are available for LITE integrations. Each component includes built-in validations and secure data handling:
|
|
885
|
+
- CardCVVInput
|
|
886
|
+
- CardHolderInput
|
|
887
|
+
- CardNumberInput
|
|
888
|
+
- CardExpirationDateInput
|
|
889
|
+
- CardExpirationMonthInput
|
|
890
|
+
- CardExpirationYearInput
|
|
891
|
+
|
|
892
|
+
## API Reference
|
|
893
|
+
|
|
894
|
+
### Hook: useTonder
|
|
895
|
+
The SDK provides a custom hook for accessing SDK functionality based on the integration type.
|
|
896
|
+
|
|
897
|
+
```typescript
|
|
898
|
+
const sdk = useTonder<SDKType>();
|
|
899
|
+
```
|
|
900
|
+
|
|
901
|
+
### Common Methods
|
|
902
|
+
|
|
903
|
+
All SDK integrations (INLINE, LITE, ENROLLMENT) share these base methods:
|
|
904
|
+
|
|
905
|
+
- create: Initializes the SDK with configuration.
|
|
906
|
+
- reset: Resets the SDK state to its initial values and cleans up resources.
|
|
907
|
+
|
|
908
|
+
```typescript
|
|
909
|
+
const {create, reset} = useTonder<SDKType>();
|
|
910
|
+
```
|
|
911
|
+
|
|
912
|
+
### INLINE SDK Methods
|
|
913
|
+
The INLINE integration provides methods for handling full payment processing with built-in UI components.
|
|
914
|
+
- payment: Processes a payment using the configured payment data.
|
|
915
|
+
```typescript
|
|
916
|
+
const {create, payment, reset } = useTonder<SDKType.INLINE>();
|
|
917
|
+
```
|
|
918
|
+
|
|
919
|
+
> **Note:** The payment function It is only necessary when you want to control the payment button on your own.
|
|
920
|
+
> **Additionally, if there are any changes to the payment or customer data, you can pass the updated data again when calling the function**.
|
|
921
|
+
|
|
922
|
+
> **Note:** For card methods, it is necessary to obtain and use your secure token when calling the create function.
|
|
923
|
+
|
|
924
|
+
#### Example with custom payment button
|
|
925
|
+
|
|
926
|
+
```tsx
|
|
927
|
+
export default function FullPaymentButtonScreen() {
|
|
928
|
+
const { create, payment } = useTonder<SDKType.INLINE>();
|
|
929
|
+
|
|
930
|
+
useEffect(() => {
|
|
931
|
+
createSDK()
|
|
932
|
+
}, [])
|
|
933
|
+
|
|
934
|
+
const createSDK = async () => {
|
|
935
|
+
const { error } = await create({
|
|
936
|
+
secureToken: 'your-secure-token',
|
|
937
|
+
paymentData: { ...paymentData },
|
|
938
|
+
customization: {
|
|
939
|
+
paymentButton: {
|
|
940
|
+
show: false, // hide default button
|
|
941
|
+
},
|
|
942
|
+
},
|
|
943
|
+
});
|
|
944
|
+
|
|
945
|
+
if (error) {
|
|
946
|
+
// Manage error
|
|
947
|
+
console.error('Error creating SDK', error);
|
|
948
|
+
}
|
|
949
|
+
};
|
|
950
|
+
|
|
951
|
+
const handlePayment = async () => {
|
|
952
|
+
const { response, error } = await payment();
|
|
953
|
+
|
|
954
|
+
if (error) {
|
|
955
|
+
console.error('Error payment: ', error);
|
|
956
|
+
return;
|
|
957
|
+
}
|
|
958
|
+
console.log('Response payment: ', response);
|
|
959
|
+
};
|
|
960
|
+
|
|
961
|
+
return (
|
|
962
|
+
<SafeAreaView>
|
|
963
|
+
<ScrollView>
|
|
964
|
+
<TonderPayment />
|
|
965
|
+
{/*Custom button*/}
|
|
966
|
+
<TouchableOpacity onPress={handlePayment}>
|
|
967
|
+
<Text>Pagar</Text>
|
|
968
|
+
</TouchableOpacity>
|
|
969
|
+
</ScrollView>
|
|
970
|
+
</SafeAreaView>
|
|
971
|
+
);
|
|
972
|
+
}
|
|
973
|
+
```
|
|
974
|
+
|
|
975
|
+
### LITE SDK Methods
|
|
976
|
+
|
|
977
|
+
The LITE integration provides full control over the payment flow with individual components and direct access to all SDK functionalities.
|
|
978
|
+
|
|
979
|
+
- payment: Processes a payment using the configured payment data.
|
|
980
|
+
- saveCustomerCard: Tokenizes and saves the current card information.
|
|
981
|
+
- getCustomerCards: Retrieves the list of saved cards for the customer.
|
|
982
|
+
- getPaymentMethods: Retrieves available payment methods.
|
|
983
|
+
- removeCustomerCard: Deletes a saved card.
|
|
984
|
+
|
|
985
|
+
> **Note**: If there are any changes to the payment or customer data, you can pass the updated data again when calling the payment function**.
|
|
986
|
+
|
|
987
|
+
> **Note:** For card methods, it is necessary to obtain and use your secure token when calling the create function.
|
|
988
|
+
|
|
989
|
+
```typescript
|
|
990
|
+
const { create, payment, saveCustomerCard, getCustomerCards,
|
|
991
|
+
removeCustomerCard, getPaymentMethods, reset } = useTonder<SDKType.LITE>();
|
|
992
|
+
```
|
|
993
|
+
|
|
994
|
+
### Enrollment SDK Methods
|
|
995
|
+
|
|
996
|
+
The ENROLLMENT integration provides methods for handling full enrollment with built-in UI components.
|
|
997
|
+
|
|
998
|
+
- saveCustomerCard: Tokenizes and saves the current card information.
|
|
999
|
+
|
|
1000
|
+
> **Note:** The saveCustomerCard It is only necessary when you want to control the enrollment button on your own.
|
|
1001
|
+
|
|
1002
|
+
> **Note:** For card methods, it is necessary to obtain and use your secure token when calling the create function.
|
|
1003
|
+
|
|
1004
|
+
```typescript
|
|
1005
|
+
const { create, saveCustomerCard, reset } = useTonder<SDKType.LITE>();
|
|
1006
|
+
```
|
|
1007
|
+
#### Example with custom button
|
|
1008
|
+
```tsx
|
|
1009
|
+
|
|
1010
|
+
export default function EnrollmentButtonScreen() {
|
|
1011
|
+
const { create, saveCustomerCard } = useTonder<SDKType.ENROLLMENT>();
|
|
1012
|
+
|
|
1013
|
+
useEffect(() => {
|
|
1014
|
+
createSDK()
|
|
1015
|
+
}, [])
|
|
1016
|
+
|
|
1017
|
+
const createSDK = async (token) => {
|
|
1018
|
+
const { error } = await create({
|
|
1019
|
+
secureToken: token,
|
|
1020
|
+
customer: { ...customerData },
|
|
1021
|
+
customization: {
|
|
1022
|
+
saveButton: {
|
|
1023
|
+
show: false, // hidde default button
|
|
1024
|
+
},
|
|
1025
|
+
},
|
|
1026
|
+
});
|
|
1027
|
+
|
|
1028
|
+
if (error) {
|
|
1029
|
+
// Manage error
|
|
1030
|
+
console.error('Error creating SDK', error);
|
|
1031
|
+
}
|
|
1032
|
+
};
|
|
1033
|
+
|
|
1034
|
+
const handleSaveCard = async () => {
|
|
1035
|
+
const { response, error } = await saveCustomerCard();
|
|
1036
|
+
if (error) {
|
|
1037
|
+
//Manage error
|
|
1038
|
+
console.error('Error save: ', error);
|
|
1039
|
+
return;
|
|
1040
|
+
}
|
|
1041
|
+
console.log('Response save: ', response);
|
|
1042
|
+
};
|
|
1043
|
+
|
|
1044
|
+
return (
|
|
1045
|
+
<SafeAreaView style={styles.safeArea}>
|
|
1046
|
+
<TonderEnrollment />
|
|
1047
|
+
{/*Custom button*/}
|
|
1048
|
+
<TouchableOpacity
|
|
1049
|
+
onPress={handleSaveCard}
|
|
1050
|
+
>
|
|
1051
|
+
<Text>Guardar</Text>
|
|
1052
|
+
</TouchableOpacity>
|
|
1053
|
+
</SafeAreaView>
|
|
1054
|
+
);
|
|
1055
|
+
}
|
|
1056
|
+
```
|
|
1057
|
+
|
|
1058
|
+
|
|
1059
|
+
### Styling
|
|
1060
|
+
|
|
1061
|
+
The SDK provides flexible styling options to customize the appearance of the components.
|
|
1062
|
+
|
|
1063
|
+
> **Note:** For the Lite version, you can pass the respective values directly when using Tonder's inputs.
|
|
1064
|
+
|
|
1065
|
+
<details>
|
|
1066
|
+
<summary>View Interface</summary>
|
|
1067
|
+
|
|
1068
|
+
```typescript
|
|
1069
|
+
export interface IStyles {
|
|
1070
|
+
sdkCard?: StylesBaseVariant;
|
|
1071
|
+
cardForm?: StylesBaseVariant & IElementStyle;
|
|
1072
|
+
paymentMethods?: StylesSelectVariant;
|
|
1073
|
+
savedCards?: StylesSavedCardsVariant;
|
|
1074
|
+
paymentRadio?: StylesSelectVariant;
|
|
1075
|
+
paymentButton?: StylesBaseVariant;
|
|
1076
|
+
errorMessage?: StylesBaseVariant;
|
|
1077
|
+
successMessage?: StylesBaseVariant;
|
|
1078
|
+
}
|
|
1079
|
+
```
|
|
1080
|
+
</details>
|
|
1081
|
+
|
|
1082
|
+
### Inline & Enrollment Styling
|
|
1083
|
+
|
|
1084
|
+
The style customization for Full integrations (INLINE and ENROLLMENT) is done through a styles object in the SDK configuration.
|
|
1085
|
+
|
|
1086
|
+
| Component | Description | Properties |
|
|
1087
|
+
|--------------------|---------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
1088
|
+
| **sdkCard** | Main container of the SDK | `base`: StylesBaseVariant |
|
|
1089
|
+
| **cardForm** | Card form section | - `base`: StylesBaseVariant<br>- `inputStyles`: CollectInputStylesVariant<br>- `labelStyles`: CollectInputStylesVariant<br>- `errorStyles`:StylesBaseVariant |
|
|
1090
|
+
| **savedCards** | Saved cards list section | - `base`: StylesBaseVariant<br>- `radioBase`: ViewStyle<br>- `radioInner`: ViewStyle<br>- `radioSelected`: ViewStyle<br>- `cardIcon`: ViewStyle<br>- `deleteButton`: ViewStyle<br>-`deteleIcon`: ViewStyle |
|
|
1091
|
+
| **paymentMethods** | Payment methods section | - `base`: StylesBaseVariant<br>- `radioBase`: ViewStyle<br>- `radioInner`: ViewStyle<br>- `radioSelected`: ViewStyle<br> |
|
|
1092
|
+
| **paymentRadio** | Payment method selector | - `base`: StylesBaseVariant<br>- `radioBase`: ViewStyle<br>- `radioInner`: ViewStyle<br>- `radioSelected`: ViewStyle<br> |
|
|
1093
|
+
| **paymentButton** | Payment button | `base`: ViewStyle |
|
|
1094
|
+
| **errorMessage** | Error message display | `base`: TextStyle |
|
|
1095
|
+
| **successMessage** | Success message display | `base`: TextStyle |
|
|
1096
|
+
|
|
1097
|
+
#### Full customization example
|
|
1098
|
+
|
|
1099
|
+
```typescript
|
|
1100
|
+
const styles = {
|
|
1101
|
+
sdkCard: {
|
|
1102
|
+
base: {
|
|
1103
|
+
backgroundColor: '#f9f9f9',
|
|
1104
|
+
borderRadius: 10,
|
|
1105
|
+
padding: 16,
|
|
1106
|
+
boxShadow: '0px 4px 12px rgba(0, 0, 0, 0.1)',
|
|
1107
|
+
},
|
|
1108
|
+
},
|
|
1109
|
+
cardForm: {
|
|
1110
|
+
base: {
|
|
1111
|
+
backgroundColor: '#ffffff',
|
|
1112
|
+
borderRadius: 10,
|
|
1113
|
+
padding: 16,
|
|
1114
|
+
borderWidth: 1,
|
|
1115
|
+
borderColor: '#e3e3e3',
|
|
1116
|
+
marginVertical: 8,
|
|
1117
|
+
},
|
|
1118
|
+
inputStyles: {
|
|
1119
|
+
base: {
|
|
1120
|
+
borderWidth: 1,
|
|
1121
|
+
borderColor: '#cccccc',
|
|
1122
|
+
borderRadius: 6,
|
|
1123
|
+
padding: 12,
|
|
1124
|
+
fontSize: 16,
|
|
1125
|
+
marginBottom: 10,
|
|
1126
|
+
color: '#333',
|
|
1127
|
+
},
|
|
1128
|
+
},
|
|
1129
|
+
labelStyles: {
|
|
1130
|
+
base: {
|
|
1131
|
+
fontSize: 14,
|
|
1132
|
+
color: '#666',
|
|
1133
|
+
marginBottom: 6,
|
|
1134
|
+
},
|
|
1135
|
+
},
|
|
1136
|
+
},
|
|
1137
|
+
savedCards: {
|
|
1138
|
+
base: {
|
|
1139
|
+
backgroundColor: '#f9f9f9',
|
|
1140
|
+
borderRadius: 8,
|
|
1141
|
+
padding: 10,
|
|
1142
|
+
marginVertical: 6,
|
|
1143
|
+
borderWidth: 1,
|
|
1144
|
+
borderColor: '#e3e3e3',
|
|
1145
|
+
},
|
|
1146
|
+
},
|
|
1147
|
+
paymentRadio: {
|
|
1148
|
+
base: {
|
|
1149
|
+
flexDirection: 'row',
|
|
1150
|
+
alignItems: 'center',
|
|
1151
|
+
padding: 10,
|
|
1152
|
+
backgroundColor: '#f9f9f9',
|
|
1153
|
+
borderRadius: 8,
|
|
1154
|
+
borderWidth: 1,
|
|
1155
|
+
borderColor: '#e3e3e3',
|
|
1156
|
+
},
|
|
1157
|
+
},
|
|
1158
|
+
paymentButton: {
|
|
1159
|
+
base: {
|
|
1160
|
+
backgroundColor: '#007AFF',
|
|
1161
|
+
paddingVertical: 15,
|
|
1162
|
+
paddingHorizontal: 20,
|
|
1163
|
+
borderRadius: 8,
|
|
1164
|
+
alignItems: 'center',
|
|
1165
|
+
fontSize: 18,
|
|
1166
|
+
color: '#fff',
|
|
1167
|
+
fontWeight: '600',
|
|
1168
|
+
},
|
|
1169
|
+
},
|
|
1170
|
+
paymentMethods: {
|
|
1171
|
+
base: {
|
|
1172
|
+
paddingVertical: 10,
|
|
1173
|
+
backgroundColor: '#f9f9f9',
|
|
1174
|
+
},
|
|
1175
|
+
radioBase: {
|
|
1176
|
+
width: 20,
|
|
1177
|
+
height: 20,
|
|
1178
|
+
borderRadius: 10,
|
|
1179
|
+
borderWidth: 2,
|
|
1180
|
+
borderColor: '#007AFF',
|
|
1181
|
+
marginHorizontal: 10,
|
|
1182
|
+
},
|
|
1183
|
+
},
|
|
1184
|
+
successMessage: {
|
|
1185
|
+
base: {
|
|
1186
|
+
color: '#28a745',
|
|
1187
|
+
fontWeight: '600',
|
|
1188
|
+
fontSize: 16,
|
|
1189
|
+
textAlign: 'center',
|
|
1190
|
+
marginTop: 20,
|
|
1191
|
+
},
|
|
1192
|
+
},
|
|
1193
|
+
errorMessage: {
|
|
1194
|
+
base: {
|
|
1195
|
+
color: '#dc3545',
|
|
1196
|
+
fontSize: 14,
|
|
1197
|
+
marginTop: 4,
|
|
1198
|
+
},
|
|
1199
|
+
},
|
|
1200
|
+
};
|
|
1201
|
+
|
|
1202
|
+
const { create } = useTonder<SDKType.INLINE>();
|
|
1203
|
+
|
|
1204
|
+
const { error } = await create({
|
|
1205
|
+
secureToken: 'your-secure-token',
|
|
1206
|
+
paymentData: { ...paymentData },
|
|
1207
|
+
customization: {
|
|
1208
|
+
saveCards: {
|
|
1209
|
+
showSaveCardOption: true,
|
|
1210
|
+
showSaved: true,
|
|
1211
|
+
},
|
|
1212
|
+
paymentButton: {
|
|
1213
|
+
show: true,
|
|
1214
|
+
showAmount: false,
|
|
1215
|
+
},
|
|
1216
|
+
labels: {
|
|
1217
|
+
name: 'Cardholder Name',
|
|
1218
|
+
cvv: 'CVV',
|
|
1219
|
+
cardNumber: 'Card Number',
|
|
1220
|
+
expiryDate: 'Expiration Date',
|
|
1221
|
+
},
|
|
1222
|
+
placeholders: {
|
|
1223
|
+
cvv: '123',
|
|
1224
|
+
name: 'John Doe',
|
|
1225
|
+
cardNumber: '4242 4242 4242 4242',
|
|
1226
|
+
expiryMonth: 'MM',
|
|
1227
|
+
expiryYear: 'YY',
|
|
1228
|
+
},
|
|
1229
|
+
styles: styles,
|
|
1230
|
+
},
|
|
1231
|
+
callbacks: {
|
|
1232
|
+
onFinishPayment: callbackFinish,
|
|
1233
|
+
},
|
|
1234
|
+
});
|
|
1235
|
+
```
|
|
1236
|
+
|
|
1237
|
+
### Lite Styling
|
|
1238
|
+
|
|
1239
|
+
The individual components of the LITE integration accept custom styles through the style prop. Each component can be styled independently
|
|
1240
|
+
|
|
1241
|
+
<details>
|
|
1242
|
+
<summary>View Interface</summary>
|
|
1243
|
+
|
|
1244
|
+
```typescript
|
|
1245
|
+
export interface InputProps {
|
|
1246
|
+
label?: string;
|
|
1247
|
+
placeholder?: string;
|
|
1248
|
+
style?: IElementStyle;
|
|
1249
|
+
}
|
|
1250
|
+
interface IElementStyle {
|
|
1251
|
+
inputStyles: {
|
|
1252
|
+
base?: ViewStyle & TextStyle;
|
|
1253
|
+
focus?: Record<string, any>;
|
|
1254
|
+
complete?: Record<string, any>;
|
|
1255
|
+
invalid?: Record<string, any>;
|
|
1256
|
+
empty?: Record<string, any>;
|
|
1257
|
+
container?: Record<string, any>;
|
|
1258
|
+
};
|
|
1259
|
+
labelStyles: {
|
|
1260
|
+
base?: TextStyle;
|
|
1261
|
+
requiredAsterisk?: Record<string, any>;
|
|
1262
|
+
focus?: Record<string, any>;
|
|
1263
|
+
};
|
|
1264
|
+
errorStyles?: {
|
|
1265
|
+
base: TextStyle;
|
|
1266
|
+
};
|
|
1267
|
+
}
|
|
1268
|
+
```
|
|
1269
|
+
</details>
|
|
1270
|
+
|
|
1271
|
+
#### Lite customization example
|
|
1272
|
+
|
|
1273
|
+
```tsx
|
|
1274
|
+
<CardNumberInput
|
|
1275
|
+
placeholder="1234 5678 9012 3456"
|
|
1276
|
+
style={{
|
|
1277
|
+
inputStyles,
|
|
1278
|
+
labelStyles,
|
|
1279
|
+
errorStyles
|
|
1280
|
+
}}
|
|
1281
|
+
/>
|
|
1282
|
+
|
|
1283
|
+
const inputStyles = {
|
|
1284
|
+
base: {
|
|
1285
|
+
backgroundColor: 'transparent',
|
|
1286
|
+
borderBottomColor: '#cbd5e1',
|
|
1287
|
+
borderBottomWidth: 1,
|
|
1288
|
+
paddingVertical: 8,
|
|
1289
|
+
fontSize: 16,
|
|
1290
|
+
color: '#111827',
|
|
1291
|
+
marginBottom: 15,
|
|
1292
|
+
},
|
|
1293
|
+
focus: {
|
|
1294
|
+
borderBottomColor: '#0ea5e9',
|
|
1295
|
+
boxShadow: '0 0 0 4px rgba(14, 165, 233, 0.2)',
|
|
1296
|
+
},
|
|
1297
|
+
};
|
|
1298
|
+
|
|
1299
|
+
const labelStyles = {
|
|
1300
|
+
base: {
|
|
1301
|
+
fontSize: 14,
|
|
1302
|
+
color: '#6b7280',
|
|
1303
|
+
marginBottom: 5,
|
|
1304
|
+
},
|
|
1305
|
+
};
|
|
1306
|
+
|
|
1307
|
+
const errorStyles = {
|
|
1308
|
+
base: {
|
|
1309
|
+
color: '#ef4444',
|
|
1310
|
+
fontSize: 12,
|
|
1311
|
+
marginTop: 4,
|
|
1312
|
+
},
|
|
1313
|
+
};
|
|
1314
|
+
```
|
|
30
1315
|
|
|
31
|
-
|
|
1316
|
+
## Examples
|
|
1317
|
+
Check the /example directory in the repository for complete implementation examples:
|
|
1318
|
+
- Full Payment Implementation
|
|
1319
|
+
- Lite Payment Implementation
|
|
1320
|
+
- Card Enrollment Implementation
|
|
1321
|
+
- Examples with custom configurations and styles
|
|
32
1322
|
|
|
33
|
-
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
|