@paynext/sdk 0.0.154 → 0.0.156
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 +1 -33
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,8 +13,6 @@ npm install @paynext/sdk
|
|
|
13
13
|
```typescript
|
|
14
14
|
import { PayNextCheckout, type PaymentResult, type AttemptResult, type CheckoutError } from '@paynext/sdk'
|
|
15
15
|
|
|
16
|
-
import '@paynext/sdk/styles'
|
|
17
|
-
|
|
18
16
|
const checkout = new PayNextCheckout()
|
|
19
17
|
|
|
20
18
|
await checkout.mount('checkout-form', {
|
|
@@ -44,43 +42,12 @@ await checkout.mount('checkout-form', {
|
|
|
44
42
|
})
|
|
45
43
|
```
|
|
46
44
|
|
|
47
|
-
## HTML Example
|
|
48
|
-
|
|
49
|
-
```html
|
|
50
|
-
<!DOCTYPE html>
|
|
51
|
-
<html>
|
|
52
|
-
<head>
|
|
53
|
-
<link rel="stylesheet" href="https://unpkg.com/@paynext/sdk/dist/styles.css">
|
|
54
|
-
</head>
|
|
55
|
-
<body>
|
|
56
|
-
<div id="checkout-form"></div>
|
|
57
|
-
|
|
58
|
-
<script type="module">
|
|
59
|
-
import { PayNextCheckout } from 'https://unpkg.com/@paynext/sdk/dist/index.es.js'
|
|
60
|
-
|
|
61
|
-
const checkout = new PayNextCheckout()
|
|
62
|
-
|
|
63
|
-
await checkout.mount('checkout-form', {
|
|
64
|
-
clientToken: 'your-client-token',
|
|
65
|
-
environment: 'sandbox',
|
|
66
|
-
apiVersion: '1.0.0',
|
|
67
|
-
onCheckoutComplete: (result) => {
|
|
68
|
-
console.log('Payment successful!', result)
|
|
69
|
-
}
|
|
70
|
-
})
|
|
71
|
-
</script>
|
|
72
|
-
</body>
|
|
73
|
-
</html>
|
|
74
|
-
```
|
|
75
|
-
|
|
76
45
|
## React Example
|
|
77
46
|
|
|
78
47
|
```tsx
|
|
79
48
|
import { useEffect } from 'react'
|
|
80
49
|
import { PayNextCheckout, type PaymentResult, type AttemptResult, type CheckoutError } from '@paynext/sdk'
|
|
81
50
|
|
|
82
|
-
import '@paynext/sdk/styles'
|
|
83
|
-
|
|
84
51
|
// interface
|
|
85
52
|
interface IProps {
|
|
86
53
|
clientToken: string
|
|
@@ -89,6 +56,7 @@ interface IProps {
|
|
|
89
56
|
// component
|
|
90
57
|
export const CheckoutComponent: FC<Readonly<IProps>> = (props) => {
|
|
91
58
|
const { clientToken } = props
|
|
59
|
+
|
|
92
60
|
const componentId = 'paynext-checkout'
|
|
93
61
|
|
|
94
62
|
useEffect(() => {
|