@odus/checkout 0.1.2 → 0.3.0

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 CHANGED
@@ -1,4 +1,4 @@
1
- # Odus Checkout SDK Documentation
1
+ # Checkout SDK
2
2
 
3
3
  The Odus Checkout is a flexible, easy-to-implement JavaScript SDK that allows merchants to accept payments on their websites with minimal integration effort. This documentation provides all the necessary information to successfully implement the Odus Checkout on your website.
4
4
 
@@ -9,10 +9,11 @@ The Odus Checkout is a flexible, easy-to-implement JavaScript SDK that allows me
9
9
  - [Configuration Options](#configuration-options)
10
10
  - [Payment Methods](#payment-methods)
11
11
  - [Callbacks and Event Handling](#callbacks-and-event-handling)
12
- - [Localization](#localization)
12
+ - [Localization Support](#localization-support)
13
13
  - [Advanced Usage](#advanced-usage)
14
14
  - [API Reference](#api-reference)
15
15
  - [Troubleshooting](#troubleshooting)
16
+ - [Related Guides](#related-guides)
16
17
 
17
18
  ## Installation
18
19
 
@@ -50,11 +51,13 @@ The Odus Checkout is a flexible, easy-to-implement JavaScript SDK that allows me
50
51
  ### NPM Usage (Module)
51
52
 
52
53
  ```bash
53
- npm install @odus-js
54
+ npm install @odus/checkout
54
55
  ```
55
56
 
56
57
  ```javascript
57
58
  import { OdusCheckout } from '@odus/checkout';
59
+ // Import the required styles
60
+ import '@odus/checkout/styles';
58
61
 
59
62
  function CheckoutPage() {
60
63
  useEffect(() => {
@@ -77,6 +80,8 @@ function CheckoutPage() {
77
80
  }
78
81
  ```
79
82
 
83
+ > **Important**: Always import the styles using `import '@odus/checkout/styles'` to ensure the checkout UI renders correctly. Without the styles, the checkout component will not display properly.
84
+
80
85
  ## Getting Started
81
86
 
82
87
  ### Basic Implementation
@@ -85,6 +90,8 @@ Here's a simple example of how to implement the Odus Checkout in your applicatio
85
90
 
86
91
  ```javascript
87
92
  import { OdusCheckout } from '@odus/checkout';
93
+ // Import the required styles
94
+ import '@odus/checkout/styles';
88
95
 
89
96
  // Initialize the checkout
90
97
  const checkout = new OdusCheckout({
@@ -108,6 +115,10 @@ const checkout = new OdusCheckout({
108
115
  console.log('3DS authentication required!', redirectUrl);
109
116
  // Custom redirect handling (only called when manualActionHandling is true)
110
117
  },
118
+ onLoadingStateChange: (isLoading) => {
119
+ console.log('Loading state changed:', isLoading);
120
+ // Toggle loading indicators in your UI
121
+ },
111
122
  },
112
123
  // Optional: Enable manual handling of 3DS redirects
113
124
  // manualActionHandling: true,
@@ -189,7 +200,30 @@ onActionRequired: (redirectUrl) => {
189
200
  };
190
201
  ```
191
202
 
192
- ## Localization support
203
+ ### onLoadingStateChange
204
+
205
+ Called when the loading state of the checkout form changes. This is useful for showing or hiding custom loading indicators in your UI.
206
+
207
+ This callback is optional. If not provided, Odus will automatically render its default spinner during loading states.
208
+
209
+ ```javascript
210
+ onLoadingStateChange: (isLoading) => {
211
+ // isLoading is a boolean indicating whether the form is currently loading
212
+ console.log('Loading state changed:', isLoading);
213
+
214
+ // Example: Toggle a custom spinner in your UI
215
+ const spinner = document.getElementById('my-spinner');
216
+ if (isLoading) {
217
+ spinner.style.display = 'block';
218
+ } else {
219
+ spinner.style.display = 'none';
220
+ }
221
+ };
222
+ ```
223
+
224
+ **Note:** Implementing this callback will override the default Odus loading indicator, giving you complete control over the loading experience.
225
+
226
+ ## Localization Support
193
227
 
194
228
  Odus provides localized payment experiences in 33 languages, helping you better serve your global customer base.
195
229
 
@@ -268,11 +302,12 @@ type CheckoutConfig = {
268
302
  paymentId: string;
269
303
  environment: 'test' | 'live';
270
304
  callbacks?: {
271
- onPaymentSucceeded?: (result: PaymentResult) => void;
305
+ onPaymentSucceeded?: (result: string) => void;
272
306
  onPaymentFailed?: (result: string) => void;
273
307
  onActionRequired?: (redirectUrl: string) => void;
308
+ onLoadingStateChange?: (isLoading: boolean) => void;
274
309
  };
275
- locale?: 'en' | 'de' | 'es' | 'fr' | 'pl' | 'pt' | null;
310
+ locale?: 'en' | 'de' | 'es' | 'fr' | 'pl' | 'pt' | 'it' | 'tr' | null;
276
311
  disableErrorMessages?: boolean;
277
312
  manualActionHandling?: boolean;
278
313
  };
@@ -285,6 +320,7 @@ type CheckoutConfig = {
285
320
  #### Checkout not appearing
286
321
 
287
322
  - Ensure the container element exists before calling `mount()`
323
+ - Check that styles are imported with `import '@odus/checkout/styles'` when using npm/module approach
288
324
  - Check browser console for errors
289
325
  - Verify your API key and profile ID are correct
290
326
  - Confirm that you're using the correct environment ('test' or 'live')
@@ -301,4 +337,10 @@ type CheckoutConfig = {
301
337
  - Ensure the callback correctly handles the redirectUrl parameter
302
338
  - Verify that any custom redirect implementation maintains all URL parameters
303
339
 
304
- © 2025 Odus Payments, Inc. All rights reserved.
340
+ ## Related Guides
341
+
342
+ For a complete understanding of how to integrate the Checkout SDK in your application, please refer to these additional guides:
343
+
344
+ - [Payment Flow Overview](./flow-overview) - Understand the different payment flows and how they work
345
+ - [Handling Redirects](./handling-redirects) - Learn how to handle redirects for 3DS authentication and alternative payment methods
346
+ - [Making Payments](./making-payments) - Step-by-step guide on how to process payments
@@ -2,6 +2,7 @@ declare type CheckoutCallbacks = {
2
2
  onPaymentSucceeded?: (result: PaymentResult) => void;
3
3
  onPaymentFailed?: (result: string) => void;
4
4
  onActionRequired?: (redirectUrl: string) => void;
5
+ onLoadingStateChange?: (isLoading: boolean) => void;
5
6
  };
6
7
 
7
8
  export declare type CheckoutConfig = {
@@ -128,7 +129,33 @@ export declare const frLocale: {
128
129
  }
129
130
  };
130
131
 
131
- declare type Locale = 'en' | 'de' | 'es' | 'fr' | 'pl' | 'pt';
132
+ export declare const itLocale: {
133
+ "email": "Email",
134
+ "cardholderNameLabel": "Nome del titolare della carta",
135
+ "cardInformation": "Informazioni sulla carta",
136
+ "cardholderNamePlaceholder": "Nome completo sulla carta",
137
+ "cardExpiry": "MM / AA",
138
+ "loading": "Non chiudere la finestra",
139
+ "buttonTexts": {
140
+ "pay": "PAGA",
141
+ "submit": "INVIA",
142
+ "getPlan": "OTTIENI IL MIO PIANO",
143
+ "donate": "DONARE",
144
+ "book": "PRENOTA ORA",
145
+ "order": "ORDINA ORA"
146
+ },
147
+ "validation": {
148
+ "emailSuggestion": "Intendevi {{email}}?",
149
+ "emailInvalid": "La tua email non è corretta",
150
+ "cardExpiryInvalid": "La data di scadenza della tua carta è nel passato",
151
+ "cardExpiryFormat": "La data di scadenza della tua carta è incompleta",
152
+ "cardSecurityFormat": "Il codice di sicurezza della tua carta è incompleto",
153
+ "nameRequired": "Inserisci il nome come appare sulla tua carta",
154
+ "cardNumberInvalid": "Il numero della tua carta non è valido"
155
+ }
156
+ };
157
+
158
+ declare type Locale = 'en' | 'de' | 'es' | 'fr' | 'pl' | 'pt' | 'it' | 'tr';
132
159
 
133
160
  export declare class OdusCheckout {
134
161
  private config;
@@ -198,4 +225,30 @@ export declare const ptLocale: {
198
225
  }
199
226
  };
200
227
 
228
+ export declare const trLocale: {
229
+ "email": "E-posta",
230
+ "cardholderNameLabel": "Kart sahibinin adı",
231
+ "cardInformation": "Kart bilgileri",
232
+ "cardholderNamePlaceholder": "Kart üzerindeki tam ad",
233
+ "cardExpiry": "AA / YY",
234
+ "loading": "Lütfen pencereyi kapatmayın",
235
+ "buttonTexts": {
236
+ "pay": "ÖDE",
237
+ "submit": "GÖNDER",
238
+ "getPlan": "PLANIMI AL",
239
+ "donate": "BAĞIŞ YAP",
240
+ "book": "ŞİMDİ REZERVASYON YAP",
241
+ "order": "ŞİMDİ SİPARİŞ VER"
242
+ },
243
+ "validation": {
244
+ "emailSuggestion": "{{email}} demek mi istediniz?",
245
+ "emailInvalid": "E-posta adresiniz geçerli değil",
246
+ "cardExpiryInvalid": "Kartınızın son kullanma tarihi geçmiş",
247
+ "cardExpiryFormat": "Kartınızın son kullanma tarihi eksik",
248
+ "cardSecurityFormat": "Kartınızın güvenlik kodu eksik",
249
+ "nameRequired": "Lütfen kart üzerindeki ismi girin",
250
+ "cardNumberInvalid": "Kart numaranız geçersiz"
251
+ }
252
+ };
253
+
201
254
  export { }