@sdkrouter/payments 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.
package/README.md ADDED
@@ -0,0 +1,122 @@
1
+ # @sdkrouter/payments
2
+
3
+ Accept crypto payments on your website with one React component. No payment processor, no merchant account, no monthly fees — payments go directly to your exchange account.
4
+
5
+ ## How it works
6
+
7
+ 1. Connect your exchange account (Binance, Bybit, OKX, KuCoin) in [sdkrouter.com](https://sdkrouter.com) dashboard
8
+ 2. Create a payment link (fixed or custom amount)
9
+ 3. Drop `<PaymentPage linkId="..." />` into your site
10
+ 4. Buyer clicks "Pay" → sees QR code + deposit address + exact USDT amount
11
+ 5. Buyer sends crypto from any wallet
12
+ 6. System detects the deposit automatically — no manual confirmation needed
13
+ 7. Funds appear in your exchange account
14
+
15
+ **Zero platform fees.** You only pay standard network fees (e.g., ~$1 for TRC20).
16
+
17
+ ## Quick Start
18
+
19
+ ```bash
20
+ npm install @sdkrouter/payments
21
+ ```
22
+
23
+ ### Full-page checkout
24
+
25
+ ```tsx
26
+ import { PaymentPage } from '@sdkrouter/payments';
27
+
28
+ <PaymentPage linkId="your-link-uuid" />
29
+ ```
30
+
31
+ ### Inline widget
32
+
33
+ ```tsx
34
+ import { PaymentWidget } from '@sdkrouter/payments';
35
+
36
+ <PaymentWidget linkId="abc-123" />
37
+ ```
38
+
39
+ ### Pay button with modal
40
+
41
+ ```tsx
42
+ <PaymentWidget linkId="abc-123" mode="button" buttonText="Pay $50" />
43
+ ```
44
+
45
+ ## What the buyer sees
46
+
47
+ | Step | Screen |
48
+ |------|--------|
49
+ | **1. Form** | Title, amount, email field |
50
+ | **2. Payment** | QR code, deposit address (copy), exact amount (copy), 60-min countdown |
51
+ | **3. Waiting** | "Checking for payment..." — auto-polls every 15 seconds |
52
+ | **4. Confirmed** | "Payment Received!" with transaction ID |
53
+
54
+ ### Why the amount isn't round
55
+
56
+ Each payment gets a unique amount (e.g., `10.003229 USDT` instead of `10.00`). This is how the system matches your deposit to your invoice on a shared address. The buyer copies the exact amount — it's handled automatically.
57
+
58
+ ## Features
59
+
60
+ - **QR code** — SVG, scannable by any crypto wallet
61
+ - **Copy buttons** — one-tap copy for address and amount
62
+ - **Countdown timer** — 60-minute window, urgent indicator at <5 min
63
+ - **Auto-detection** — polls for payment, no "I've paid" button needed
64
+ - **Dark/light theme** — auto-detects from system/Tailwind/`data-theme`
65
+ - **Self-contained** — CSS injected automatically, no external stylesheets
66
+ - **React 18 & 19** — works with both
67
+
68
+ ## Custom UI
69
+
70
+ ```tsx
71
+ import { PaymentProvider, usePayment } from '@sdkrouter/payments';
72
+
73
+ <PaymentProvider linkId="abc-123">
74
+ <MyCheckout />
75
+ </PaymentProvider>
76
+
77
+ function MyCheckout() {
78
+ const { link, pay, paymentResult, isPaying, step, reset } = usePayment();
79
+
80
+ return (
81
+ <div>
82
+ <h1>{link?.title}</h1>
83
+ <button onClick={() => pay({ email: 'buyer@example.com' })} disabled={isPaying}>
84
+ Pay ${link?.amountUsd}
85
+ </button>
86
+ {paymentResult && (
87
+ <p>Send {paymentResult.payAmount} {paymentResult.coin} to {paymentResult.payAddress}</p>
88
+ )}
89
+ </div>
90
+ );
91
+ }
92
+ ```
93
+
94
+ ## Props
95
+
96
+ ```ts
97
+ interface PaymentLinkConfig {
98
+ linkId: string; // Payment link UUID from dashboard
99
+ baseUrl?: string; // API URL (default: https://api.sdkrouter.com)
100
+ customerId?: string; // Your customer ID — enables payment history
101
+ projectSlug?: string; // Your project slug
102
+ onSuccess?: (result) => void; // Called when payment confirmed
103
+ onError?: (error: string) => void; // Called on error
104
+ theme?: 'light' | 'dark' | 'auto';
105
+ locale?: string; // 'en', 'ru', 'ko', etc.
106
+ }
107
+ ```
108
+
109
+ ## Supported exchanges
110
+
111
+ | Exchange | Networks | Sub-accounts |
112
+ |----------|----------|-------------|
113
+ | Binance | TRC20, ERC20, BEP20, Arbitrum, SOL | Up to 1000 |
114
+ | Bybit | TRC20, ERC20, Arbitrum, SOL | Up to 100 |
115
+ | OKX | TRC20, ERC20, Arbitrum, Polygon, SOL | Up to 50 |
116
+ | KuCoin | TRC20, ERC20 | Up to 100 |
117
+
118
+ Default network: **TRC20** (cheapest — ~$1 fee, fastest — ~3 seconds).
119
+
120
+ ## License
121
+
122
+ MIT
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var chunk3W2GRACB_cjs = require('./chunk-3W2GRACB.cjs');
5
+ require('./chunk-P3RGFDH4.cjs');
6
+
7
+
8
+
9
+ Object.defineProperty(exports, "PaymentContent", {
10
+ enumerable: true,
11
+ get: function () { return chunk3W2GRACB_cjs.PaymentContent; }
12
+ });
13
+ //# sourceMappingURL=PaymentContent-BRE2P6SS.cjs.map
14
+ //# sourceMappingURL=PaymentContent-BRE2P6SS.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"PaymentContent-BRE2P6SS.cjs"}
@@ -0,0 +1,5 @@
1
+ "use client";
2
+ export { PaymentContent } from './chunk-N3LT7RRW.mjs';
3
+ import './chunk-4QQBPIIT.mjs';
4
+ //# sourceMappingURL=PaymentContent-HEOBMWSU.mjs.map
5
+ //# sourceMappingURL=PaymentContent-HEOBMWSU.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"PaymentContent-HEOBMWSU.mjs"}
@@ -0,0 +1,29 @@
1
+ 'use strict';
2
+
3
+ require('../chunk-RSPZZ5K2.cjs');
4
+ var chunkP3RGFDH4_cjs = require('../chunk-P3RGFDH4.cjs');
5
+
6
+
7
+
8
+ Object.defineProperty(exports, "API", {
9
+ enumerable: true,
10
+ get: function () { return chunkP3RGFDH4_cjs.API; }
11
+ });
12
+ Object.defineProperty(exports, "Enums", {
13
+ enumerable: true,
14
+ get: function () { return chunkP3RGFDH4_cjs.enums_exports; }
15
+ });
16
+ Object.defineProperty(exports, "MemoryStorageAdapter", {
17
+ enumerable: true,
18
+ get: function () { return chunkP3RGFDH4_cjs.MemoryStorageAdapter; }
19
+ });
20
+ Object.defineProperty(exports, "PaymentsAPI", {
21
+ enumerable: true,
22
+ get: function () { return chunkP3RGFDH4_cjs.API; }
23
+ });
24
+ Object.defineProperty(exports, "createPaymentsApi", {
25
+ enumerable: true,
26
+ get: function () { return chunkP3RGFDH4_cjs.createPaymentsApi; }
27
+ });
28
+ //# sourceMappingURL=index.cjs.map
29
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}