@tonder.io/ionic-full-sdk 0.0.25-beta → 0.0.26-beta
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/.gitlab-ci.yml +18 -18
- package/README.md +448 -448
- package/cypress.config.js +9 -9
- package/dist/classes/inlineCheckout.d.ts +6 -1
- package/dist/helpers/template.d.ts +2 -1
- package/dist/index.js +1 -1
- package/index.js.example +49 -49
- package/package.json +27 -27
- package/rollup.config.js +14 -14
- package/src/classes/3dsHandler.ts +237 -237
- package/src/classes/checkout.ts +147 -147
- package/src/classes/inlineCheckout.ts +734 -622
- package/src/helpers/skyflow.ts +358 -358
- package/src/helpers/styles.ts +60 -60
- package/src/helpers/template.ts +520 -492
- package/src/helpers/utils.ts +148 -148
- package/src/index-dev.js +120 -120
- package/src/index.html +57 -57
- package/src/index.ts +6 -6
- package/src/types/commons.ts +42 -42
- package/src/types/skyflow.ts +40 -40
- package/tsconfig.json +22 -22
- package/dist/data/api.d.ts +0 -18
- package/dist/types/commons-ds.d.ts +0 -40
- package/dist/types/skyflow.ds.d.ts +0 -39
package/README.md
CHANGED
|
@@ -1,448 +1,448 @@
|
|
|
1
|
-
# Tonder Ionic Full SDK
|
|
2
|
-
|
|
3
|
-
Tonder SDK to integrate checkout form
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
You can install using NPM
|
|
8
|
-
```bash
|
|
9
|
-
npm i @tonder.io/ionic-full-sdk
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
Add dependencies to the root of the app (index.html)
|
|
13
|
-
```html
|
|
14
|
-
<script src="https://openpay.s3.amazonaws.com/openpay.v1.min.js"></script>
|
|
15
|
-
<script src="https://openpay.s3.amazonaws.com/openpay-data.v1.min.js"></script>
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Usage
|
|
19
|
-
On HTML view
|
|
20
|
-
```html
|
|
21
|
-
<div>
|
|
22
|
-
<h1>Checkout</h1>
|
|
23
|
-
<!-- You have to add an entry point with the ID 'tonder-checkout' -->
|
|
24
|
-
<div id="tonder-checkout"></div>
|
|
25
|
-
</div>
|
|
26
|
-
```
|
|
27
|
-
On Script section
|
|
28
|
-
|
|
29
|
-
```javascript
|
|
30
|
-
import { InlineCheckout } from "@tonder.io/ionic-full-sdk"
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
```javascript
|
|
34
|
-
const checkoutData = {
|
|
35
|
-
customer: {
|
|
36
|
-
firstName: "Juan",
|
|
37
|
-
lastName: "Hernández",
|
|
38
|
-
country: "Mexico",
|
|
39
|
-
address: "Av. Revolución 356, Col. Roma",
|
|
40
|
-
city: "Monterrey",
|
|
41
|
-
state: "Nuevo León",
|
|
42
|
-
postCode: "64700",
|
|
43
|
-
email: "juan.hernandez@mail.com",
|
|
44
|
-
phone: "8187654321",
|
|
45
|
-
},
|
|
46
|
-
currency: 'mxn',
|
|
47
|
-
cart: {
|
|
48
|
-
total: 399,
|
|
49
|
-
items: [
|
|
50
|
-
{
|
|
51
|
-
description: "Black T-Shirt",
|
|
52
|
-
quantity: 1,
|
|
53
|
-
price_unit: 1,
|
|
54
|
-
discount: 0,
|
|
55
|
-
taxes: 0,
|
|
56
|
-
product_reference: 1,
|
|
57
|
-
name: "T-Shirt",
|
|
58
|
-
amount_total: 399,
|
|
59
|
-
},
|
|
60
|
-
]
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const apiKey = "You can take this from you Tonder Dashboard";
|
|
65
|
-
const returnUrl = "http://my-website:8080/checkout-success"
|
|
66
|
-
const successUrl = "http://my-website:8080/3ds-success"
|
|
67
|
-
|
|
68
|
-
const inlineCheckout = new InlineCheckout({
|
|
69
|
-
apiKey,
|
|
70
|
-
returnUrl,
|
|
71
|
-
successUrl
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
inlineCheckout.setPaymentData(checkoutData);
|
|
75
|
-
inlineCheckout.setCartTotal(checkoutData.cart.total);
|
|
76
|
-
inlineCheckout.setCustomerEmail(checkoutData.cart.email);
|
|
77
|
-
inlineCheckout.injectCheckout();
|
|
78
|
-
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
## Configuration
|
|
82
|
-
| Property | Type | Required | Description |
|
|
83
|
-
|-------------------|---------------|:-----------------:|-------------------------------------------------------------|
|
|
84
|
-
| apiKey | string | X | You can take this from you Tonder Dashboard |
|
|
85
|
-
| returnUrl | string | X | |
|
|
86
|
-
| successUrl | string | | |
|
|
87
|
-
| style | object | | |
|
|
88
|
-
| containerId | string | | If require a custom checkout container id, default |
|
|
89
|
-
| | | | value "tonder-checkout" |
|
|
90
|
-
| collectorIds | object | | If require a custom div containers ids, default |
|
|
91
|
-
| | | | value: |
|
|
92
|
-
| | | | { |
|
|
93
|
-
| | | | cardsListContainer: "cardsListContainer", |
|
|
94
|
-
| | | | holderName: "collectCardholderName", |
|
|
95
|
-
| | | | cardNumber: "collectCardNumber", |
|
|
96
|
-
| | | | expirationMonth: "collectExpirationMonth", |
|
|
97
|
-
| | | | expirationYear: "collectExpirationYear", |
|
|
98
|
-
| | | | cvv: "collectCvv", |
|
|
99
|
-
| | | | tonderPayButton: "tonderPayButton", |
|
|
100
|
-
| | | | msgError: "msgError", |
|
|
101
|
-
| | | | msgNotification: "msgNotification" |
|
|
102
|
-
| | | | } |
|
|
103
|
-
| callBack | function | | Callback function invoqued after the payment process |
|
|
104
|
-
| | | | end successfully |
|
|
105
|
-
| isOpenpaySandbox | boolean | | Define if openpay work on sandbox, default value true |
|
|
106
|
-
|
|
107
|
-
## Theming
|
|
108
|
-
|
|
109
|
-
<font size="3"> It exists two types of styles to the tonder checkout </font>
|
|
110
|
-
|
|
111
|
-
```javascript
|
|
112
|
-
|
|
113
|
-
const customStyles = {
|
|
114
|
-
inputStyles: {
|
|
115
|
-
base: {
|
|
116
|
-
border: "1px solid #e0e0e0",
|
|
117
|
-
padding: "10px 7px",
|
|
118
|
-
borderRadius: "5px",
|
|
119
|
-
color: "#1d1d1d",
|
|
120
|
-
marginTop: "2px",
|
|
121
|
-
backgroundColor: "white",
|
|
122
|
-
fontFamily: '"Inter", sans-serif',
|
|
123
|
-
fontSize: '16px',
|
|
124
|
-
'&::placeholder': {
|
|
125
|
-
color: "#ccc",
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
cardIcon: {
|
|
129
|
-
position: 'absolute',
|
|
130
|
-
left: '6px',
|
|
131
|
-
bottom: 'calc(50% - 12px)',
|
|
132
|
-
},
|
|
133
|
-
complete: {
|
|
134
|
-
color: "#4caf50",
|
|
135
|
-
},
|
|
136
|
-
empty: {},
|
|
137
|
-
focus: {},
|
|
138
|
-
invalid: {
|
|
139
|
-
border: "1px solid #f44336",
|
|
140
|
-
},
|
|
141
|
-
global: {
|
|
142
|
-
'@import': 'url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap")',
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
labelStyles: {
|
|
146
|
-
base: {
|
|
147
|
-
fontSize: '12px',
|
|
148
|
-
fontWeight: '500',
|
|
149
|
-
fontFamily: '"Inter", sans-serif'
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
errorTextStyles: {
|
|
153
|
-
base: {
|
|
154
|
-
fontSize: '12px',
|
|
155
|
-
fontWeight: '500',
|
|
156
|
-
color: "#f44336",
|
|
157
|
-
fontFamily: '"Inter", sans-serif'
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
labels: {
|
|
161
|
-
cardLabel: 'Número de Tarjeta Personalizado',
|
|
162
|
-
cvvLabel: 'Código de Seguridad',
|
|
163
|
-
expiryMonthLabel: 'Mes de Expiración',
|
|
164
|
-
expiryYearLabel: 'Año de Expiración'
|
|
165
|
-
},
|
|
166
|
-
placeholders: {
|
|
167
|
-
cardPlaceholder: '0000 0000 0000 0000',
|
|
168
|
-
cvvPlaceholder: '123',
|
|
169
|
-
expiryMonthPlaceholder: 'MM',
|
|
170
|
-
expiryYearPlaceholder: 'AA'
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
const inlineCheckout = new InlineCheckout({
|
|
175
|
-
apiKey,
|
|
176
|
-
returnUrl,
|
|
177
|
-
successUrl,
|
|
178
|
-
styles: customStyles
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
<font size="3">The styles param is related to the style of the inputs inside the checkout form, to customize the checkout container and the cards list you can use global styles on base to this classes</font>
|
|
184
|
-
|
|
185
|
-
```css
|
|
186
|
-
|
|
187
|
-
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap");
|
|
188
|
-
|
|
189
|
-
.container-tonder {
|
|
190
|
-
background-color: #F9F9F9;
|
|
191
|
-
margin: 0 auto;
|
|
192
|
-
padding: 30px 10px 30px 10px;
|
|
193
|
-
overflow: hidden;
|
|
194
|
-
transition: max-height 0.5s ease-out;
|
|
195
|
-
max-width: 600px;
|
|
196
|
-
border: solid 1px #e3e3e3;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
.collect-row {
|
|
200
|
-
display: flex;
|
|
201
|
-
justify-content: space-between;
|
|
202
|
-
width: 100%;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
.collect-row > :first-child {
|
|
206
|
-
min-width: 120px;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
.expiration-year {
|
|
210
|
-
padding-top: 25px;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
.empty-div {
|
|
214
|
-
height: 80px;
|
|
215
|
-
margin-top: 2px;
|
|
216
|
-
margin-bottom: 4px;
|
|
217
|
-
margin-left: 10px;
|
|
218
|
-
margin-right: 10px;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
.error-container{
|
|
222
|
-
color: red;
|
|
223
|
-
background-color: #FFDBDB;
|
|
224
|
-
margin-bottom: 13px;
|
|
225
|
-
font-size: 80%;
|
|
226
|
-
padding: 8px 10px;
|
|
227
|
-
border-radius: 10px;
|
|
228
|
-
text-align: left;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
.message-container{
|
|
232
|
-
color: green;
|
|
233
|
-
background-color: #90EE90;
|
|
234
|
-
margin-bottom: 13px;
|
|
235
|
-
font-size: 80%;
|
|
236
|
-
padding: 8px 10px;
|
|
237
|
-
border-radius: 10px;
|
|
238
|
-
text-align: left;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
.pay-button {
|
|
242
|
-
font-size: 16px;
|
|
243
|
-
font-weight: bold;
|
|
244
|
-
min-height: 2.3rem;
|
|
245
|
-
border-radius: 0.5rem;
|
|
246
|
-
cursor: pointer;
|
|
247
|
-
width: 100%;
|
|
248
|
-
padding: 1rem;
|
|
249
|
-
text-align: center;
|
|
250
|
-
border: none;
|
|
251
|
-
background-color: #000;
|
|
252
|
-
color: #fff;
|
|
253
|
-
margin-bottom: 10px;
|
|
254
|
-
display: none;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
.pay-button:disabled, pay-button[disabled] {
|
|
258
|
-
background-color: #B9B9B9;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
.lds-dual-ring {
|
|
262
|
-
display: inline-block;
|
|
263
|
-
width: 14px;
|
|
264
|
-
height: 14px;
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
.lds-dual-ring:after {
|
|
268
|
-
content: " ";
|
|
269
|
-
display: block;
|
|
270
|
-
width: 14px;
|
|
271
|
-
height: 14px;
|
|
272
|
-
border-radius: 50%;
|
|
273
|
-
border: 6px solid #fff;
|
|
274
|
-
border-color: #fff transparent #fff transparent;
|
|
275
|
-
animation: lds-dual-ring 1.2s linear infinite;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
@keyframes lds-dual-ring {
|
|
279
|
-
0% {
|
|
280
|
-
transform: rotate(0deg);
|
|
281
|
-
}
|
|
282
|
-
100% {
|
|
283
|
-
transform: rotate(360deg);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
@media screen and (max-width: 600px) {
|
|
288
|
-
.payment_method_zplit {
|
|
289
|
-
font-size: 16px;
|
|
290
|
-
width: 100%;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
.payment_method_zplit label img {
|
|
294
|
-
display: none;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
.cards-list-container {
|
|
299
|
-
display: flex;
|
|
300
|
-
flex-direction: column;
|
|
301
|
-
padding: 0px 10px 0px 10px;
|
|
302
|
-
gap: 33% 20px;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
.checkbox label {
|
|
306
|
-
margin-left: 10px;
|
|
307
|
-
font-size: '12px';
|
|
308
|
-
font-weight: '500';
|
|
309
|
-
color: #1D1D1D;
|
|
310
|
-
font-family: "Inter", sans-serif;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
.checkbox {
|
|
314
|
-
margin-top: 10px;
|
|
315
|
-
margin-bottom: 10px;
|
|
316
|
-
width: 100%;
|
|
317
|
-
text-align: left;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
.pay-new-card {
|
|
321
|
-
display: flex;
|
|
322
|
-
justify-content: start;
|
|
323
|
-
align-items: center;
|
|
324
|
-
color: #1D1D1D;
|
|
325
|
-
gap: 33% 20px;
|
|
326
|
-
margin-top: 10px;
|
|
327
|
-
margin-bottom: 10px;
|
|
328
|
-
padding-left: 10px;
|
|
329
|
-
padding-right: 10px;
|
|
330
|
-
width: 90%;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
.pay-new-card .card-number {
|
|
334
|
-
font-size: 16px;
|
|
335
|
-
font-family: "Inter", sans-serif;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
.card-image {
|
|
339
|
-
width: 27px;
|
|
340
|
-
height: 20px;
|
|
341
|
-
text-align: left;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
.card-item-label {
|
|
345
|
-
display: flex;
|
|
346
|
-
justify-content: start;
|
|
347
|
-
align-items: center;
|
|
348
|
-
color: #1D1D1D;
|
|
349
|
-
gap: 33% 20px;
|
|
350
|
-
margin-top: 10px;
|
|
351
|
-
margin-bottom: 10px;
|
|
352
|
-
padding-left: 10px;
|
|
353
|
-
padding-right: 10px;
|
|
354
|
-
width: 90%;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
.card_selected {
|
|
358
|
-
width: 10%;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
.card-item {
|
|
362
|
-
display: flex;
|
|
363
|
-
justify-content: start;
|
|
364
|
-
align-items: center;
|
|
365
|
-
gap: 33% 20px;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
.card-item .card-number {
|
|
369
|
-
font-size: 16px;
|
|
370
|
-
font-family: "Inter", sans-serif;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
.card-item .card-expiration {
|
|
374
|
-
font-size: 16px;
|
|
375
|
-
font-family: "Inter", sans-serif;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
```
|
|
379
|
-
|
|
380
|
-
<font size="3">Included in this html template</font>
|
|
381
|
-
|
|
382
|
-
<font size="4">Form</font>
|
|
383
|
-
|
|
384
|
-
```html
|
|
385
|
-
|
|
386
|
-
<div class="container-tonder">
|
|
387
|
-
<div class="cards-list-container"></div>
|
|
388
|
-
<div class="pay-new-card">
|
|
389
|
-
<input checked id="new" name="card_selected" type="radio"/>
|
|
390
|
-
<label for="new">
|
|
391
|
-
<img class="card-image"/>
|
|
392
|
-
<div class="card-number"></div>
|
|
393
|
-
</label>
|
|
394
|
-
</div>
|
|
395
|
-
<div class="container-form">
|
|
396
|
-
<div class="empty-div"></div>
|
|
397
|
-
<div class="empty-div"></div>
|
|
398
|
-
<div class="collect-row">
|
|
399
|
-
<div class="empty-div"></div>
|
|
400
|
-
<div class="expiration-year"></div>
|
|
401
|
-
<div class="empty-div"></div>
|
|
402
|
-
</div>
|
|
403
|
-
<div class="checkbox">
|
|
404
|
-
<input id="save-checkout-card" type="checkbox">
|
|
405
|
-
<label for="save-checkout-card"></label>
|
|
406
|
-
</div>
|
|
407
|
-
<div></div>
|
|
408
|
-
<div></div>
|
|
409
|
-
</div>
|
|
410
|
-
<button class="pay-button"></button>
|
|
411
|
-
</div>
|
|
412
|
-
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
<font size="4">Cards list</font>
|
|
416
|
-
|
|
417
|
-
```html
|
|
418
|
-
|
|
419
|
-
<div class="card-item">
|
|
420
|
-
<input name="card_selected" type="radio"/>
|
|
421
|
-
<label class="card-item-label">
|
|
422
|
-
<img class="card-image"/>
|
|
423
|
-
<div class="card-number"></div>
|
|
424
|
-
<div class="card-expiration"></div>
|
|
425
|
-
</label>
|
|
426
|
-
</div>
|
|
427
|
-
|
|
428
|
-
```
|
|
429
|
-
## Mobile settings
|
|
430
|
-
|
|
431
|
-
<font size="3">If you are deploying to Android, edit your AndroidManifest.xml file to add the Internet permission.</font>
|
|
432
|
-
|
|
433
|
-
```xml
|
|
434
|
-
<!-- Required to fetch data from the internet. -->
|
|
435
|
-
<uses-permission android:name="android.permission.INTERNET" />
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
<font size="3">Likewise, if you are deploying to macOS, edit your macos/Runner/DebugProfile.entitlements and macos/Runner/Release.entitlements files to include the network client entitlement.</font>
|
|
439
|
-
|
|
440
|
-
```xml
|
|
441
|
-
<!-- Required to fetch data from the internet. -->
|
|
442
|
-
<key>com.apple.security.network.client</key>
|
|
443
|
-
<true/>
|
|
444
|
-
```
|
|
445
|
-
|
|
446
|
-
## License
|
|
447
|
-
|
|
448
|
-
[MIT](https://choosealicense.com/licenses/mit/)
|
|
1
|
+
# Tonder Ionic Full SDK
|
|
2
|
+
|
|
3
|
+
Tonder SDK to integrate checkout form
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
You can install using NPM
|
|
8
|
+
```bash
|
|
9
|
+
npm i @tonder.io/ionic-full-sdk
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Add dependencies to the root of the app (index.html)
|
|
13
|
+
```html
|
|
14
|
+
<script src="https://openpay.s3.amazonaws.com/openpay.v1.min.js"></script>
|
|
15
|
+
<script src="https://openpay.s3.amazonaws.com/openpay-data.v1.min.js"></script>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
On HTML view
|
|
20
|
+
```html
|
|
21
|
+
<div>
|
|
22
|
+
<h1>Checkout</h1>
|
|
23
|
+
<!-- You have to add an entry point with the ID 'tonder-checkout' -->
|
|
24
|
+
<div id="tonder-checkout"></div>
|
|
25
|
+
</div>
|
|
26
|
+
```
|
|
27
|
+
On Script section
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
import { InlineCheckout } from "@tonder.io/ionic-full-sdk"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```javascript
|
|
34
|
+
const checkoutData = {
|
|
35
|
+
customer: {
|
|
36
|
+
firstName: "Juan",
|
|
37
|
+
lastName: "Hernández",
|
|
38
|
+
country: "Mexico",
|
|
39
|
+
address: "Av. Revolución 356, Col. Roma",
|
|
40
|
+
city: "Monterrey",
|
|
41
|
+
state: "Nuevo León",
|
|
42
|
+
postCode: "64700",
|
|
43
|
+
email: "juan.hernandez@mail.com",
|
|
44
|
+
phone: "8187654321",
|
|
45
|
+
},
|
|
46
|
+
currency: 'mxn',
|
|
47
|
+
cart: {
|
|
48
|
+
total: 399,
|
|
49
|
+
items: [
|
|
50
|
+
{
|
|
51
|
+
description: "Black T-Shirt",
|
|
52
|
+
quantity: 1,
|
|
53
|
+
price_unit: 1,
|
|
54
|
+
discount: 0,
|
|
55
|
+
taxes: 0,
|
|
56
|
+
product_reference: 1,
|
|
57
|
+
name: "T-Shirt",
|
|
58
|
+
amount_total: 399,
|
|
59
|
+
},
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const apiKey = "You can take this from you Tonder Dashboard";
|
|
65
|
+
const returnUrl = "http://my-website:8080/checkout-success"
|
|
66
|
+
const successUrl = "http://my-website:8080/3ds-success"
|
|
67
|
+
|
|
68
|
+
const inlineCheckout = new InlineCheckout({
|
|
69
|
+
apiKey,
|
|
70
|
+
returnUrl,
|
|
71
|
+
successUrl
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
inlineCheckout.setPaymentData(checkoutData);
|
|
75
|
+
inlineCheckout.setCartTotal(checkoutData.cart.total);
|
|
76
|
+
inlineCheckout.setCustomerEmail(checkoutData.cart.email);
|
|
77
|
+
inlineCheckout.injectCheckout();
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Configuration
|
|
82
|
+
| Property | Type | Required | Description |
|
|
83
|
+
|-------------------|---------------|:-----------------:|-------------------------------------------------------------|
|
|
84
|
+
| apiKey | string | X | You can take this from you Tonder Dashboard |
|
|
85
|
+
| returnUrl | string | X | |
|
|
86
|
+
| successUrl | string | | |
|
|
87
|
+
| style | object | | |
|
|
88
|
+
| containerId | string | | If require a custom checkout container id, default |
|
|
89
|
+
| | | | value "tonder-checkout" |
|
|
90
|
+
| collectorIds | object | | If require a custom div containers ids, default |
|
|
91
|
+
| | | | value: |
|
|
92
|
+
| | | | { |
|
|
93
|
+
| | | | cardsListContainer: "cardsListContainer", |
|
|
94
|
+
| | | | holderName: "collectCardholderName", |
|
|
95
|
+
| | | | cardNumber: "collectCardNumber", |
|
|
96
|
+
| | | | expirationMonth: "collectExpirationMonth", |
|
|
97
|
+
| | | | expirationYear: "collectExpirationYear", |
|
|
98
|
+
| | | | cvv: "collectCvv", |
|
|
99
|
+
| | | | tonderPayButton: "tonderPayButton", |
|
|
100
|
+
| | | | msgError: "msgError", |
|
|
101
|
+
| | | | msgNotification: "msgNotification" |
|
|
102
|
+
| | | | } |
|
|
103
|
+
| callBack | function | | Callback function invoqued after the payment process |
|
|
104
|
+
| | | | end successfully |
|
|
105
|
+
| isOpenpaySandbox | boolean | | Define if openpay work on sandbox, default value true |
|
|
106
|
+
|
|
107
|
+
## Theming
|
|
108
|
+
|
|
109
|
+
<font size="3"> It exists two types of styles to the tonder checkout </font>
|
|
110
|
+
|
|
111
|
+
```javascript
|
|
112
|
+
|
|
113
|
+
const customStyles = {
|
|
114
|
+
inputStyles: {
|
|
115
|
+
base: {
|
|
116
|
+
border: "1px solid #e0e0e0",
|
|
117
|
+
padding: "10px 7px",
|
|
118
|
+
borderRadius: "5px",
|
|
119
|
+
color: "#1d1d1d",
|
|
120
|
+
marginTop: "2px",
|
|
121
|
+
backgroundColor: "white",
|
|
122
|
+
fontFamily: '"Inter", sans-serif',
|
|
123
|
+
fontSize: '16px',
|
|
124
|
+
'&::placeholder': {
|
|
125
|
+
color: "#ccc",
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
cardIcon: {
|
|
129
|
+
position: 'absolute',
|
|
130
|
+
left: '6px',
|
|
131
|
+
bottom: 'calc(50% - 12px)',
|
|
132
|
+
},
|
|
133
|
+
complete: {
|
|
134
|
+
color: "#4caf50",
|
|
135
|
+
},
|
|
136
|
+
empty: {},
|
|
137
|
+
focus: {},
|
|
138
|
+
invalid: {
|
|
139
|
+
border: "1px solid #f44336",
|
|
140
|
+
},
|
|
141
|
+
global: {
|
|
142
|
+
'@import': 'url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap")',
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
labelStyles: {
|
|
146
|
+
base: {
|
|
147
|
+
fontSize: '12px',
|
|
148
|
+
fontWeight: '500',
|
|
149
|
+
fontFamily: '"Inter", sans-serif'
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
errorTextStyles: {
|
|
153
|
+
base: {
|
|
154
|
+
fontSize: '12px',
|
|
155
|
+
fontWeight: '500',
|
|
156
|
+
color: "#f44336",
|
|
157
|
+
fontFamily: '"Inter", sans-serif'
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
labels: {
|
|
161
|
+
cardLabel: 'Número de Tarjeta Personalizado',
|
|
162
|
+
cvvLabel: 'Código de Seguridad',
|
|
163
|
+
expiryMonthLabel: 'Mes de Expiración',
|
|
164
|
+
expiryYearLabel: 'Año de Expiración'
|
|
165
|
+
},
|
|
166
|
+
placeholders: {
|
|
167
|
+
cardPlaceholder: '0000 0000 0000 0000',
|
|
168
|
+
cvvPlaceholder: '123',
|
|
169
|
+
expiryMonthPlaceholder: 'MM',
|
|
170
|
+
expiryYearPlaceholder: 'AA'
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const inlineCheckout = new InlineCheckout({
|
|
175
|
+
apiKey,
|
|
176
|
+
returnUrl,
|
|
177
|
+
successUrl,
|
|
178
|
+
styles: customStyles
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
<font size="3">The styles param is related to the style of the inputs inside the checkout form, to customize the checkout container and the cards list you can use global styles on base to this classes</font>
|
|
184
|
+
|
|
185
|
+
```css
|
|
186
|
+
|
|
187
|
+
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap");
|
|
188
|
+
|
|
189
|
+
.container-tonder {
|
|
190
|
+
background-color: #F9F9F9;
|
|
191
|
+
margin: 0 auto;
|
|
192
|
+
padding: 30px 10px 30px 10px;
|
|
193
|
+
overflow: hidden;
|
|
194
|
+
transition: max-height 0.5s ease-out;
|
|
195
|
+
max-width: 600px;
|
|
196
|
+
border: solid 1px #e3e3e3;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.collect-row {
|
|
200
|
+
display: flex;
|
|
201
|
+
justify-content: space-between;
|
|
202
|
+
width: 100%;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.collect-row > :first-child {
|
|
206
|
+
min-width: 120px;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.expiration-year {
|
|
210
|
+
padding-top: 25px;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.empty-div {
|
|
214
|
+
height: 80px;
|
|
215
|
+
margin-top: 2px;
|
|
216
|
+
margin-bottom: 4px;
|
|
217
|
+
margin-left: 10px;
|
|
218
|
+
margin-right: 10px;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.error-container{
|
|
222
|
+
color: red;
|
|
223
|
+
background-color: #FFDBDB;
|
|
224
|
+
margin-bottom: 13px;
|
|
225
|
+
font-size: 80%;
|
|
226
|
+
padding: 8px 10px;
|
|
227
|
+
border-radius: 10px;
|
|
228
|
+
text-align: left;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.message-container{
|
|
232
|
+
color: green;
|
|
233
|
+
background-color: #90EE90;
|
|
234
|
+
margin-bottom: 13px;
|
|
235
|
+
font-size: 80%;
|
|
236
|
+
padding: 8px 10px;
|
|
237
|
+
border-radius: 10px;
|
|
238
|
+
text-align: left;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.pay-button {
|
|
242
|
+
font-size: 16px;
|
|
243
|
+
font-weight: bold;
|
|
244
|
+
min-height: 2.3rem;
|
|
245
|
+
border-radius: 0.5rem;
|
|
246
|
+
cursor: pointer;
|
|
247
|
+
width: 100%;
|
|
248
|
+
padding: 1rem;
|
|
249
|
+
text-align: center;
|
|
250
|
+
border: none;
|
|
251
|
+
background-color: #000;
|
|
252
|
+
color: #fff;
|
|
253
|
+
margin-bottom: 10px;
|
|
254
|
+
display: none;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.pay-button:disabled, pay-button[disabled] {
|
|
258
|
+
background-color: #B9B9B9;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.lds-dual-ring {
|
|
262
|
+
display: inline-block;
|
|
263
|
+
width: 14px;
|
|
264
|
+
height: 14px;
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
.lds-dual-ring:after {
|
|
268
|
+
content: " ";
|
|
269
|
+
display: block;
|
|
270
|
+
width: 14px;
|
|
271
|
+
height: 14px;
|
|
272
|
+
border-radius: 50%;
|
|
273
|
+
border: 6px solid #fff;
|
|
274
|
+
border-color: #fff transparent #fff transparent;
|
|
275
|
+
animation: lds-dual-ring 1.2s linear infinite;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
@keyframes lds-dual-ring {
|
|
279
|
+
0% {
|
|
280
|
+
transform: rotate(0deg);
|
|
281
|
+
}
|
|
282
|
+
100% {
|
|
283
|
+
transform: rotate(360deg);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
@media screen and (max-width: 600px) {
|
|
288
|
+
.payment_method_zplit {
|
|
289
|
+
font-size: 16px;
|
|
290
|
+
width: 100%;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.payment_method_zplit label img {
|
|
294
|
+
display: none;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.cards-list-container {
|
|
299
|
+
display: flex;
|
|
300
|
+
flex-direction: column;
|
|
301
|
+
padding: 0px 10px 0px 10px;
|
|
302
|
+
gap: 33% 20px;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.checkbox label {
|
|
306
|
+
margin-left: 10px;
|
|
307
|
+
font-size: '12px';
|
|
308
|
+
font-weight: '500';
|
|
309
|
+
color: #1D1D1D;
|
|
310
|
+
font-family: "Inter", sans-serif;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.checkbox {
|
|
314
|
+
margin-top: 10px;
|
|
315
|
+
margin-bottom: 10px;
|
|
316
|
+
width: 100%;
|
|
317
|
+
text-align: left;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.pay-new-card {
|
|
321
|
+
display: flex;
|
|
322
|
+
justify-content: start;
|
|
323
|
+
align-items: center;
|
|
324
|
+
color: #1D1D1D;
|
|
325
|
+
gap: 33% 20px;
|
|
326
|
+
margin-top: 10px;
|
|
327
|
+
margin-bottom: 10px;
|
|
328
|
+
padding-left: 10px;
|
|
329
|
+
padding-right: 10px;
|
|
330
|
+
width: 90%;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.pay-new-card .card-number {
|
|
334
|
+
font-size: 16px;
|
|
335
|
+
font-family: "Inter", sans-serif;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.card-image {
|
|
339
|
+
width: 27px;
|
|
340
|
+
height: 20px;
|
|
341
|
+
text-align: left;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.card-item-label {
|
|
345
|
+
display: flex;
|
|
346
|
+
justify-content: start;
|
|
347
|
+
align-items: center;
|
|
348
|
+
color: #1D1D1D;
|
|
349
|
+
gap: 33% 20px;
|
|
350
|
+
margin-top: 10px;
|
|
351
|
+
margin-bottom: 10px;
|
|
352
|
+
padding-left: 10px;
|
|
353
|
+
padding-right: 10px;
|
|
354
|
+
width: 90%;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.card_selected {
|
|
358
|
+
width: 10%;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.card-item {
|
|
362
|
+
display: flex;
|
|
363
|
+
justify-content: start;
|
|
364
|
+
align-items: center;
|
|
365
|
+
gap: 33% 20px;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.card-item .card-number {
|
|
369
|
+
font-size: 16px;
|
|
370
|
+
font-family: "Inter", sans-serif;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.card-item .card-expiration {
|
|
374
|
+
font-size: 16px;
|
|
375
|
+
font-family: "Inter", sans-serif;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
<font size="3">Included in this html template</font>
|
|
381
|
+
|
|
382
|
+
<font size="4">Form</font>
|
|
383
|
+
|
|
384
|
+
```html
|
|
385
|
+
|
|
386
|
+
<div class="container-tonder">
|
|
387
|
+
<div class="cards-list-container"></div>
|
|
388
|
+
<div class="pay-new-card">
|
|
389
|
+
<input checked id="new" name="card_selected" type="radio"/>
|
|
390
|
+
<label for="new">
|
|
391
|
+
<img class="card-image"/>
|
|
392
|
+
<div class="card-number"></div>
|
|
393
|
+
</label>
|
|
394
|
+
</div>
|
|
395
|
+
<div class="container-form">
|
|
396
|
+
<div class="empty-div"></div>
|
|
397
|
+
<div class="empty-div"></div>
|
|
398
|
+
<div class="collect-row">
|
|
399
|
+
<div class="empty-div"></div>
|
|
400
|
+
<div class="expiration-year"></div>
|
|
401
|
+
<div class="empty-div"></div>
|
|
402
|
+
</div>
|
|
403
|
+
<div class="checkbox">
|
|
404
|
+
<input id="save-checkout-card" type="checkbox">
|
|
405
|
+
<label for="save-checkout-card"></label>
|
|
406
|
+
</div>
|
|
407
|
+
<div></div>
|
|
408
|
+
<div></div>
|
|
409
|
+
</div>
|
|
410
|
+
<button class="pay-button"></button>
|
|
411
|
+
</div>
|
|
412
|
+
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
<font size="4">Cards list</font>
|
|
416
|
+
|
|
417
|
+
```html
|
|
418
|
+
|
|
419
|
+
<div class="card-item">
|
|
420
|
+
<input name="card_selected" type="radio"/>
|
|
421
|
+
<label class="card-item-label">
|
|
422
|
+
<img class="card-image"/>
|
|
423
|
+
<div class="card-number"></div>
|
|
424
|
+
<div class="card-expiration"></div>
|
|
425
|
+
</label>
|
|
426
|
+
</div>
|
|
427
|
+
|
|
428
|
+
```
|
|
429
|
+
## Mobile settings
|
|
430
|
+
|
|
431
|
+
<font size="3">If you are deploying to Android, edit your AndroidManifest.xml file to add the Internet permission.</font>
|
|
432
|
+
|
|
433
|
+
```xml
|
|
434
|
+
<!-- Required to fetch data from the internet. -->
|
|
435
|
+
<uses-permission android:name="android.permission.INTERNET" />
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
<font size="3">Likewise, if you are deploying to macOS, edit your macos/Runner/DebugProfile.entitlements and macos/Runner/Release.entitlements files to include the network client entitlement.</font>
|
|
439
|
+
|
|
440
|
+
```xml
|
|
441
|
+
<!-- Required to fetch data from the internet. -->
|
|
442
|
+
<key>com.apple.security.network.client</key>
|
|
443
|
+
<true/>
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
## License
|
|
447
|
+
|
|
448
|
+
[MIT](https://choosealicense.com/licenses/mit/)
|