logix-pay 1.0.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 +139 -0
- package/dist/index.cjs.js +716 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.esm.js +713 -0
- package/dist/index.esm.js.map +1 -0
- package/package.json +42 -0
package/README.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# 💳 Logix Pay
|
|
2
|
+
|
|
3
|
+
**Logix Pay** is a modern React payment component library that provides secure, SPA-friendly card payment forms for:
|
|
4
|
+
|
|
5
|
+
- 🟣 Shift4
|
|
6
|
+
- 🔵 Stripe
|
|
7
|
+
|
|
8
|
+
Built for React Router, Next.js, Vite, CRA and any SPA architecture.
|
|
9
|
+
|
|
10
|
+
No forced redirects. Full control via callbacks.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# ✨ Features
|
|
15
|
+
|
|
16
|
+
- 🔐 Secure card tokenization
|
|
17
|
+
- 🛡️ 3D Secure support
|
|
18
|
+
- ⚡ Callback-based success & error handling
|
|
19
|
+
- 🎨 Fully customizable UI
|
|
20
|
+
- 📦 Library-ready components
|
|
21
|
+
- 🚀 SPA friendly (no page reloads)
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
# 📦 Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install logix-pay
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
# 📁 Package Exports
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
export { default as ShiftPaymentForm } from "./ShiftPaymentForm";
|
|
37
|
+
export { default as StripePaymentForm } from "./StripePaymentForm";
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
# 🟣 Shift4 Payment Form
|
|
43
|
+
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
```jsx
|
|
47
|
+
import { ShiftPaymentForm } from "logix-pay";
|
|
48
|
+
|
|
49
|
+
<ShiftPaymentForm
|
|
50
|
+
amount={1000}
|
|
51
|
+
currency="USD"
|
|
52
|
+
color="#0d6efd"
|
|
53
|
+
formWidth={400}
|
|
54
|
+
formBorderRadius={20}
|
|
55
|
+
formBackgroundColor="#fff"
|
|
56
|
+
inputPadding={12}
|
|
57
|
+
baseUrl="https://api.example.com/payment/"
|
|
58
|
+
userId="user-123"
|
|
59
|
+
description="Premium subscription"
|
|
60
|
+
successPage={(message) => {
|
|
61
|
+
console.log("Payment successful:", message);
|
|
62
|
+
}}
|
|
63
|
+
errorPage={(error) => {
|
|
64
|
+
console.error("Payment failed:", error);
|
|
65
|
+
}}
|
|
66
|
+
/>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
# 🔵 Stripe Payment Form
|
|
72
|
+
|
|
73
|
+
## Usage
|
|
74
|
+
|
|
75
|
+
```jsx
|
|
76
|
+
import { StripePaymentForm } from "logix-pay";
|
|
77
|
+
|
|
78
|
+
<StripePaymentForm
|
|
79
|
+
amount={1000}
|
|
80
|
+
currency="USD"
|
|
81
|
+
color="#635bff"
|
|
82
|
+
formWidth={400}
|
|
83
|
+
formBorderRadius={20}
|
|
84
|
+
formBackgroundColor="#fff"
|
|
85
|
+
inputPadding={12}
|
|
86
|
+
baseUrl="https://api.example.com/payment/"
|
|
87
|
+
userId="user-123"
|
|
88
|
+
description="Premium subscription"
|
|
89
|
+
successPage={(message) => {
|
|
90
|
+
console.log("Payment successful:", message);
|
|
91
|
+
}}
|
|
92
|
+
errorPage={(error) => {
|
|
93
|
+
console.error("Payment failed:", error);
|
|
94
|
+
}}
|
|
95
|
+
/>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
# 🔧 Props
|
|
101
|
+
|
|
102
|
+
| Prop | Type | Required | Default | Description |
|
|
103
|
+
|------|------|----------|----------|------------|
|
|
104
|
+
| amount | number | ✅ | — | Payment amount in smallest currency unit (e.g. cents) |
|
|
105
|
+
| currency | string | ✅ | — | ISO currency code (USD, EUR, etc.) |
|
|
106
|
+
| baseUrl | string | ✅ | — | Backend payment API base URL |
|
|
107
|
+
| userId | string | ✅ | — | Unique user identifier |
|
|
108
|
+
| successPage | function | ✅ | — | Triggered on successful payment |
|
|
109
|
+
| errorPage | function | ✅ | — | Triggered on failed payment |
|
|
110
|
+
| description | string | ❌ | — | Payment description |
|
|
111
|
+
| color | string | ❌ | provider default | Primary theme color |
|
|
112
|
+
| formWidth | number | ❌ | 400 | Form width (px) |
|
|
113
|
+
| formBorderRadius | number | ❌ | 20 | Form border radius (px) |
|
|
114
|
+
| formBackgroundColor | string | ❌ | "#fff" | Form background color |
|
|
115
|
+
| inputPadding | number | ❌ | 12 | Input padding (px) |
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
# 🧠 How It Works
|
|
120
|
+
|
|
121
|
+
1. Card details are securely tokenized by Shift4 or Stripe.
|
|
122
|
+
2. Token is sent to your backend (`baseUrl`).
|
|
123
|
+
3. Backend confirms the payment.
|
|
124
|
+
4. Component returns result via callback.
|
|
125
|
+
5. You control routing and UI updates.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
# 🔐 Security
|
|
130
|
+
|
|
131
|
+
- Card data is handled securely by the provider.
|
|
132
|
+
- Tokenization ensures PCI compliance scope reduction.
|
|
133
|
+
- Supports 3D Secure authentication flows.
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
# 📄 License
|
|
138
|
+
|
|
139
|
+
MIT
|