@gatepayfe/pay-js-react 0.0.1 → 0.0.2
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 +32 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -20,8 +20,7 @@ export function Checkout() {
|
|
|
20
20
|
<GatePayElement
|
|
21
21
|
gatePay={{
|
|
22
22
|
clientId: 'your-client-id',
|
|
23
|
-
locale: 'en
|
|
24
|
-
theme: 'auto',
|
|
23
|
+
locale: 'en',
|
|
25
24
|
}}
|
|
26
25
|
payment={{
|
|
27
26
|
clientSessionSecret: 'cs_xxx',
|
|
@@ -44,6 +43,36 @@ This package is marked with `"use client"`. Import it only in Client Components.
|
|
|
44
43
|
import { GatePayElement } from '@gatepayfe/pay-js-react'
|
|
45
44
|
```
|
|
46
45
|
|
|
46
|
+
## API
|
|
47
|
+
|
|
48
|
+
### `<GatePayElement />`
|
|
49
|
+
|
|
50
|
+
| Prop | Type | Required | Description |
|
|
51
|
+
|------|------|----------|-------------|
|
|
52
|
+
| `gatePay` | `GatePayOptions` | yes | Global SDK config |
|
|
53
|
+
| `payment` | `PaymentElementOptions` | yes | Payment session config and callbacks |
|
|
54
|
+
|
|
55
|
+
### `gatePay` (`GatePayOptions`)
|
|
56
|
+
|
|
57
|
+
| Option | Type | Required | Description |
|
|
58
|
+
|--------|------|----------|-------------|
|
|
59
|
+
| `clientId` | `string` | yes | Merchant client ID |
|
|
60
|
+
| `locale` | `'en' \| 'zh' \| 'zh-tw' \| 'ar' \| 'pt' \| 'pt-br' \| 'de' \| 'es' \| 'fr' \| 'id' \| 'it' \| 'ja' \| 'nl' \| 'ru' \| 'th' \| 'tr' \| 'uk' \| 'vi' \| 'en-us'` | no | Global locale, default browser language |
|
|
61
|
+
| `fiatCurrency` | `'EUR' \| 'GBP' \| 'USD' \| 'CNY' \| 'JPY' \| 'AUD' \| 'CAD' \| 'CHF'` | no | Display currency, default `USD` |
|
|
62
|
+
|
|
63
|
+
### `payment` (`PaymentElementOptions`)
|
|
64
|
+
|
|
65
|
+
| Option | Type | Required | Description |
|
|
66
|
+
|--------|------|----------|-------------|
|
|
67
|
+
| `clientSessionSecret` | `string` | yes | Session secret from backend |
|
|
68
|
+
| `paymentMethods` | `('GatePay' \| 'Web3Pay')[]` | no | Filter payment methods, default all |
|
|
69
|
+
| `onReady` | `() => void` | no | Iframe rendered |
|
|
70
|
+
| `onSuccess` | `(result) => void` | no | Payment / authorization succeeded |
|
|
71
|
+
| `onCancel` | `() => void` | no | User cancelled |
|
|
72
|
+
| `onError` | `(error) => void` | no | Payment failed |
|
|
73
|
+
| `onExpired` | `() => void` | no | Order expired |
|
|
74
|
+
| `onSessionExpired` | `() => void` | no | Session secret expired |
|
|
75
|
+
|
|
47
76
|
## Ref API
|
|
48
77
|
|
|
49
78
|
```tsx
|
|
@@ -52,8 +81,7 @@ import { GatePayElement, type GatePayElementRef } from '@gatepayfe/pay-js-react'
|
|
|
52
81
|
|
|
53
82
|
const ref = useRef<GatePayElementRef>(null)
|
|
54
83
|
|
|
55
|
-
// ref.current?.updateLocale('zh
|
|
56
|
-
// ref.current?.updateTheme('dark')
|
|
84
|
+
// ref.current?.updateLocale('zh')
|
|
57
85
|
// ref.current?.destroy()
|
|
58
86
|
```
|
|
59
87
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gatepayfe/pay-js-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "React bindings for @gatepayfe/pay-js embedded cashier SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/cjs/index.cjs",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"registry": "https://registry.npmjs.org/"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@gatepayfe/pay-js": "0.0.
|
|
30
|
+
"@gatepayfe/pay-js": "0.0.2"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"react": "^18.2.0 || ^19.0.0",
|