@zahlen/checkout 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +257 -0
  2. package/package.json +3 -2
package/README.md ADDED
@@ -0,0 +1,257 @@
1
+ # @zahlen/checkout
2
+
3
+ <p align="center">
4
+ <img src="https://img.shields.io/npm/v/@zahlen/checkout?style=flat-square" alt="npm version" />
5
+ <img src="https://img.shields.io/npm/l/@zahlen/checkout?style=flat-square" alt="license" />
6
+ <img src="https://img.shields.io/bundlephobia/minzip/@zahlen/checkout?style=flat-square" alt="bundle size" />
7
+ </p>
8
+
9
+ <p align="center">
10
+ <strong>A modern, Gen Z-friendly payment checkout modal for the web.</strong>
11
+ <br />
12
+ Beautiful • Fast • Easy to integrate
13
+ </p>
14
+
15
+ ---
16
+
17
+ ## ✨ Features
18
+
19
+ - 🎨 **Modern UI** - Glassmorphism design with dark mode by default
20
+ - ⚡ **Lightweight** - Under 10KB gzipped
21
+ - 🔒 **Secure** - PCI-compliant, no card data touches your servers
22
+ - 📱 **Responsive** - Works beautifully on all devices
23
+ - 🌍 **Multi-currency** - Supports NGN, USD, EUR, GBP, and more
24
+ - 🎭 **Customizable** - Theming via CSS variables
25
+ - 💳 **Smart Detection** - Auto-detects card brands (Visa, Mastercard, Verve, etc.)
26
+
27
+ ---
28
+
29
+ ## 🚀 Quick Start
30
+
31
+ ### CDN (Recommended for quick setup)
32
+
33
+ ```html
34
+ <!-- Add the script -->
35
+ <script src="https://unpkg.com/@zahlen/checkout"></script>
36
+
37
+ <!-- Add a pay button -->
38
+ <button id="pay-btn">Pay ₦4,999</button>
39
+
40
+ <script>
41
+ // Initialize
42
+ Zahlen.init({ apiKey: 'pk_live_your_api_key' });
43
+
44
+ // Handle click
45
+ document.getElementById('pay-btn').onclick = () => {
46
+ Zahlen.checkout({
47
+ amount: 499900, // Amount in kobo (₦4,999)
48
+ currency: 'NGN',
49
+ description: 'Premium Plan',
50
+ onSuccess: (result) => {
51
+ console.log('Payment successful!', result);
52
+ // Redirect to success page
53
+ },
54
+ onError: (error) => {
55
+ console.error('Payment failed:', error.message);
56
+ }
57
+ });
58
+ };
59
+ </script>
60
+ ```
61
+
62
+ ### npm / yarn
63
+
64
+ ```bash
65
+ npm install @zahlen/checkout
66
+ # or
67
+ yarn add @zahlen/checkout
68
+ ```
69
+
70
+ ```typescript
71
+ import { Zahlen } from '@zahlen/checkout';
72
+
73
+ Zahlen.init({ apiKey: 'pk_live_your_api_key' });
74
+
75
+ function handlePayment() {
76
+ Zahlen.checkout({
77
+ amount: 499900,
78
+ currency: 'NGN',
79
+ description: 'Premium Plan',
80
+ customerEmail: 'user@example.com',
81
+ onSuccess: (result) => {
82
+ console.log('Paid!', result);
83
+ },
84
+ onError: (error) => {
85
+ console.error('Failed:', error);
86
+ },
87
+ onClose: () => {
88
+ console.log('Modal closed');
89
+ }
90
+ });
91
+ }
92
+ ```
93
+
94
+ ---
95
+
96
+ ## 📖 API Reference
97
+
98
+ ### `Zahlen.init(config)`
99
+
100
+ Initialize the SDK. Call this once when your app loads.
101
+
102
+ ```typescript
103
+ interface ZahlenConfig {
104
+ apiKey: string; // Required: Your API key
105
+ theme?: 'dark' | 'light' | 'auto'; // Default: 'dark'
106
+ locale?: string; // Default: 'en-US'
107
+ customStyles?: Partial<ZahlenTheme>;
108
+ }
109
+ ```
110
+
111
+ ### `Zahlen.checkout(options)`
112
+
113
+ Open the checkout modal.
114
+
115
+ ```typescript
116
+ interface CheckoutOptions {
117
+ amount: number; // Required: Amount in smallest unit (kobo/cents)
118
+ currency: string; // Required: ISO currency code
119
+ description?: string; // Optional: Payment description
120
+ customerEmail?: string; // Optional: For receipts
121
+ metadata?: object; // Optional: Custom data
122
+ onSuccess: (result: PaymentResult) => void;
123
+ onError: (error: PaymentError) => void;
124
+ onClose?: () => void;
125
+ }
126
+ ```
127
+
128
+ ### `Zahlen.setTheme(theme)`
129
+
130
+ Change the theme dynamically.
131
+
132
+ ```typescript
133
+ Zahlen.setTheme('light'); // or 'dark' or 'auto'
134
+ ```
135
+
136
+ ### `Zahlen.closeModal()`
137
+
138
+ Programmatically close the modal.
139
+
140
+ ---
141
+
142
+ ## 🎨 Customization
143
+
144
+ ### Custom Colors
145
+
146
+ ```typescript
147
+ Zahlen.init({
148
+ apiKey: 'pk_live_xxx',
149
+ customStyles: {
150
+ '--zahlen-primary': '#FF6B6B',
151
+ '--zahlen-secondary': '#4ECDC4',
152
+ '--zahlen-bg': '#1A1A2E',
153
+ }
154
+ });
155
+ ```
156
+
157
+ ### Available CSS Variables
158
+
159
+ | Variable | Default | Description |
160
+ |----------|---------|-------------|
161
+ | `--zahlen-primary` | `#7C3AED` | Primary brand color |
162
+ | `--zahlen-secondary` | `#4F46E5` | Secondary/gradient color |
163
+ | `--zahlen-bg` | `#0F0F23` | Modal background |
164
+ | `--zahlen-surface` | `rgba(255,255,255,0.05)` | Input backgrounds |
165
+ | `--zahlen-border` | `rgba(255,255,255,0.1)` | Border color |
166
+ | `--zahlen-text` | `#FFFFFF` | Primary text |
167
+ | `--zahlen-text-muted` | `#A0A0B0` | Muted text |
168
+ | `--zahlen-border-radius` | `12px` | Border radius |
169
+
170
+ ---
171
+
172
+ ## 📱 Framework Integrations
173
+
174
+ ### React
175
+
176
+ ```bash
177
+ npm install @zahlen/checkout-react
178
+ ```
179
+
180
+ ```tsx
181
+ import { ZahlenButton, ZahlenProvider } from '@zahlen/checkout-react';
182
+
183
+ function App() {
184
+ return (
185
+ <ZahlenProvider apiKey="pk_live_xxx">
186
+ <ZahlenButton
187
+ amount={499900}
188
+ currency="NGN"
189
+ onSuccess={(result) => console.log('Paid!', result)}
190
+ onError={(error) => console.error(error)}
191
+ >
192
+ Pay ₦4,999
193
+ </ZahlenButton>
194
+ </ZahlenProvider>
195
+ );
196
+ }
197
+ ```
198
+
199
+ ### Angular
200
+
201
+ ```bash
202
+ npm install @zahlen/checkout-angular
203
+ ```
204
+
205
+ ```typescript
206
+ // app.module.ts
207
+ import { ZahlenModule } from '@zahlen/checkout-angular';
208
+
209
+ @NgModule({
210
+ imports: [ZahlenModule.forRoot({ apiKey: 'pk_live_xxx' })]
211
+ })
212
+ export class AppModule {}
213
+ ```
214
+
215
+ ```html
216
+ <!-- component.html -->
217
+ <button zahlenCheckout
218
+ [amount]="499900"
219
+ [currency]="'NGN'"
220
+ (success)="onSuccess($event)"
221
+ (error)="onError($event)">
222
+ Pay ₦4,999
223
+ </button>
224
+ ```
225
+
226
+ ---
227
+
228
+ ## 💳 Supported Cards
229
+
230
+ | Card Brand | Supported |
231
+ |------------|-----------|
232
+ | Visa | ✅ |
233
+ | Mastercard | ✅ |
234
+ | Verve | ✅ |
235
+ | American Express | ✅ |
236
+ | Discover | ✅ |
237
+
238
+ ---
239
+
240
+ ## 🔒 Security
241
+
242
+ - All card data is encrypted and processed securely
243
+ - PCI DSS compliant
244
+ - No sensitive data stored on your servers
245
+ - Tokenized payments
246
+
247
+ ---
248
+
249
+ ## 📄 License
250
+
251
+ MIT © Zahlen
252
+
253
+ ---
254
+
255
+ <p align="center">
256
+ Made with 💜 by the Zahlen team
257
+ </p>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zahlen/checkout",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Modern, Gen Z-friendly payment checkout modal for the web",
5
5
  "author": "Zahlen",
6
6
  "license": "MIT",
@@ -31,7 +31,8 @@
31
31
  "index.cjs.js",
32
32
  "index.esm.js",
33
33
  "index.d.ts",
34
- "src/**/*.d.ts"
34
+ "src/**/*.d.ts",
35
+ "README.md"
35
36
  ],
36
37
  "dependencies": {}
37
38
  }