@paynext/sdk 0.0.77 → 0.0.78
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 +8 -4
- package/dist/index.d.ts +5 -5
- package/dist/index.es.js +2 -470
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ npm install @paynext/sdk
|
|
|
11
11
|
## Quick Start
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { PayNextCheckout, type PaymentResult } from '@paynext/sdk'
|
|
14
|
+
import { PayNextCheckout, type PaymentResult, type AttemptResult } from '@paynext/sdk'
|
|
15
15
|
|
|
16
16
|
import '@paynext/sdk/styles'
|
|
17
17
|
|
|
@@ -21,6 +21,10 @@ await checkout.mount({
|
|
|
21
21
|
clientToken: '<you-client-token>',
|
|
22
22
|
environment: 'sandbox',
|
|
23
23
|
apiVersion: '1.0.0'
|
|
24
|
+
onCheckoutAttempt?: (result: AttemptResult) => void
|
|
25
|
+
// Handle payment attempt
|
|
26
|
+
console.info('Payment attempt:', result)
|
|
27
|
+
},
|
|
24
28
|
onCheckoutComplete: (result: PaymentResult) => {
|
|
25
29
|
// Handle successful payment
|
|
26
30
|
console.log('Payment successful!', result)
|
|
@@ -36,7 +40,7 @@ await checkout.mount({
|
|
|
36
40
|
|
|
37
41
|
```tsx
|
|
38
42
|
import { useEffect, useRef } from 'react'
|
|
39
|
-
import { PayNextCheckout, type PaymentResult, type
|
|
43
|
+
import { PayNextCheckout, type PaymentResult, type AttemptResult } from '@paynext/sdk'
|
|
40
44
|
|
|
41
45
|
import '@paynext/sdk/styles'
|
|
42
46
|
|
|
@@ -58,7 +62,7 @@ export const CheckoutComponent: FC<Readonly<IProps> = (props) => {
|
|
|
58
62
|
clientToken,
|
|
59
63
|
environment: 'sandbox',
|
|
60
64
|
apiVersion: '1.0.0',
|
|
61
|
-
|
|
65
|
+
onCheckoutAttempt?: (result: AttemptResult) => void
|
|
62
66
|
// Handle payment attempt
|
|
63
67
|
console.info('Payment attempt:', result)
|
|
64
68
|
},
|
|
@@ -93,8 +97,8 @@ interface PayNextConfig {
|
|
|
93
97
|
locale?: Locale
|
|
94
98
|
translate?: CheckoutTranslate
|
|
95
99
|
styles?: StylesConfig
|
|
100
|
+
onCheckoutAttempt?: (result: AttemptResult) => void
|
|
96
101
|
onCheckoutComplete?: (result: PaymentResult) => void
|
|
97
|
-
onPaymentAttempt?: (result: PaymentAttemptResult) => void
|
|
98
102
|
onCheckoutFail?: (error: IErrorInterface) => void
|
|
99
103
|
}
|
|
100
104
|
```
|
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,10 @@ declare interface ApplePayTransaction {
|
|
|
30
30
|
}>;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
declare interface AttemptResult {
|
|
34
|
+
paymentMethod: PaymentMethod;
|
|
35
|
+
}
|
|
36
|
+
|
|
33
37
|
declare interface BillingAddress {
|
|
34
38
|
city?: string;
|
|
35
39
|
country?: string;
|
|
@@ -291,10 +295,6 @@ declare type Listener<TData> = (data: TData) => void;
|
|
|
291
295
|
|
|
292
296
|
export declare type Locale = 'ar' | 'en' | 'bg' | 'cs' | 'da' | 'de' | 'el' | 'es' | 'et' | 'fi' | 'fil' | 'fr' | 'hr' | 'hu' | 'id' | 'it' | 'ja' | 'ko' | 'lt' | 'lv' | 'ms' | 'ru' | 'mt' | 'nb' | 'no' | 'nl' | 'pl' | 'pt' | 'ro' | 'ua' | 'sk' | 'sl' | 'sv' | 'th' | 'tr' | 'vi' | 'zh';
|
|
293
297
|
|
|
294
|
-
declare interface PaymentAttemptResult {
|
|
295
|
-
paymentMethod: PaymentMethod;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
298
|
export declare enum PaymentMethod {
|
|
299
299
|
PAYPAL = "PAYPAL",
|
|
300
300
|
APPLE_PAY = "APPLEPAY",
|
|
@@ -484,8 +484,8 @@ export declare interface PayNextConfig {
|
|
|
484
484
|
styles?: StylesConfig;
|
|
485
485
|
translate?: DeepPartial<CheckoutTranslate>;
|
|
486
486
|
locale?: Locale;
|
|
487
|
+
onCheckoutAttempt?: (result: AttemptResult) => void;
|
|
487
488
|
onCheckoutComplete?: (result: PaymentResult) => void;
|
|
488
|
-
onPaymentAttempt?: (result: PaymentAttemptResult) => void;
|
|
489
489
|
onCheckoutFail?: (error: IErrorInterface) => void;
|
|
490
490
|
}
|
|
491
491
|
|