@settlr/sdk 0.4.2 → 0.4.4
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 +35 -13
- package/dist/index.js +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,19 +4,21 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/@settlr/sdk)
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
6
|
|
|
7
|
-
> **
|
|
7
|
+
> **Accept crypto payments without wallets.** Customers pay with email. You get USDC instantly.
|
|
8
8
|
|
|
9
9
|
🌐 **Website:** [settlr.dev](https://settlr.dev)
|
|
10
10
|
📖 **Docs:** [settlr.dev/docs](https://settlr.dev/docs)
|
|
11
|
-
🎮 **Demo:** [settlr.dev/demo](https://settlr.dev/demo)
|
|
11
|
+
🎮 **Demo:** [settlr.dev/demo](https://settlr.dev/demo)
|
|
12
|
+
💻 **GitHub:** [github.com/ABFX15/x402-hack-payment](https://github.com/ABFX15/x402-hack-payment)
|
|
12
13
|
|
|
13
14
|
## Why Settlr?
|
|
14
15
|
|
|
15
|
-
- ✅ **No wallet required** -
|
|
16
|
-
- ✅ **
|
|
17
|
-
- ✅ **
|
|
18
|
-
- ✅ **
|
|
19
|
-
- ✅ **
|
|
16
|
+
- ✅ **No wallet required** - Customers pay with just an email
|
|
17
|
+
- ✅ **Zero gas fees** - No SOL needed, ever (Kora gasless)
|
|
18
|
+
- ✅ **Pay from any chain** - Accept USDC from Ethereum, Base, Arbitrum, Polygon, Optimism (Mayan)
|
|
19
|
+
- ✅ **Instant settlement** - USDC direct to your Solana wallet
|
|
20
|
+
- ✅ **One component** - Drop-in React `<BuyButton>`
|
|
21
|
+
- ✅ **2% flat fee** - No hidden costs
|
|
20
22
|
|
|
21
23
|
## Installation
|
|
22
24
|
|
|
@@ -28,7 +30,7 @@ npm install @settlr/sdk
|
|
|
28
30
|
|
|
29
31
|
### 1. Get Your API Key
|
|
30
32
|
|
|
31
|
-
Sign up at [settlr.
|
|
33
|
+
Sign up at [settlr.dev/onboarding](https://settlr.dev/onboarding) to register your business and get an API key. Your wallet address is linked to your API key automatically.
|
|
32
34
|
|
|
33
35
|
### 2. Create a Payment Link
|
|
34
36
|
|
|
@@ -36,10 +38,10 @@ Sign up at [settlr.app/dashboard](https://settlr.app/dashboard) and create an AP
|
|
|
36
38
|
import { Settlr } from "@settlr/sdk";
|
|
37
39
|
|
|
38
40
|
const settlr = new Settlr({
|
|
39
|
-
apiKey: "sk_live_xxxxxxxxxxxx", // Your API key
|
|
41
|
+
apiKey: "sk_live_xxxxxxxxxxxx", // Your API key from dashboard
|
|
40
42
|
merchant: {
|
|
41
43
|
name: "My Store",
|
|
42
|
-
walletAddress
|
|
44
|
+
// walletAddress is optional - automatically fetched from your API key
|
|
43
45
|
},
|
|
44
46
|
});
|
|
45
47
|
|
|
@@ -52,6 +54,8 @@ const payment = await settlr.createPayment({
|
|
|
52
54
|
window.location.href = payment.checkoutUrl;
|
|
53
55
|
```
|
|
54
56
|
|
|
57
|
+
> **Note:** When you register at [settlr.dev/onboarding](https://settlr.dev/onboarding), your wallet address is linked to your API key. The SDK automatically fetches it - no need to include it in your code!
|
|
58
|
+
|
|
55
59
|
### 3. Drop-in Buy Button ⭐ NEW
|
|
56
60
|
|
|
57
61
|
The easiest way to accept payments - just drop in a button:
|
|
@@ -64,7 +68,7 @@ function App() {
|
|
|
64
68
|
<SettlrProvider
|
|
65
69
|
config={{
|
|
66
70
|
apiKey: "sk_live_xxxxxxxxxxxx",
|
|
67
|
-
merchant: { name: "GameStore",
|
|
71
|
+
merchant: { name: "GameStore" }, // Wallet fetched from API key
|
|
68
72
|
}}
|
|
69
73
|
>
|
|
70
74
|
<BuyButton
|
|
@@ -108,6 +112,21 @@ Settlr checkout handles authentication via Privy:
|
|
|
108
112
|
|
|
109
113
|
No wallet-adapter setup needed. Just redirect to checkout.
|
|
110
114
|
|
|
115
|
+
### Multichain Payments
|
|
116
|
+
|
|
117
|
+
Customers can pay with USDC from any supported chain. Settlr automatically bridges funds to your Solana wallet via Mayan:
|
|
118
|
+
|
|
119
|
+
| Source Chain | Bridge Time | Gas Cost |
|
|
120
|
+
| ------------ | ----------- | -------------- |
|
|
121
|
+
| Solana | Instant | Free (gasless) |
|
|
122
|
+
| Base | ~1-2 min | ~$0.01 |
|
|
123
|
+
| Arbitrum | ~1-2 min | ~$0.01 |
|
|
124
|
+
| Optimism | ~1-2 min | ~$0.01 |
|
|
125
|
+
| Polygon | ~1-2 min | ~$0.01 |
|
|
126
|
+
| Ethereum | ~1-3 min | ~$1-5 |
|
|
127
|
+
|
|
128
|
+
**You only need a Solana wallet** - cross-chain bridging is automatic.
|
|
129
|
+
|
|
111
130
|
### React Hook
|
|
112
131
|
|
|
113
132
|
```tsx
|
|
@@ -120,7 +139,7 @@ function App() {
|
|
|
120
139
|
apiKey: "sk_live_xxxxxxxxxxxx",
|
|
121
140
|
merchant: {
|
|
122
141
|
name: "My Game",
|
|
123
|
-
walletAddress
|
|
142
|
+
// walletAddress optional - linked to your API key
|
|
124
143
|
},
|
|
125
144
|
}}
|
|
126
145
|
>
|
|
@@ -245,9 +264,10 @@ Main client class.
|
|
|
245
264
|
|
|
246
265
|
```typescript
|
|
247
266
|
interface SettlrConfig {
|
|
267
|
+
apiKey: string; // Required: your API key from dashboard
|
|
248
268
|
merchant: {
|
|
249
269
|
name: string;
|
|
250
|
-
walletAddress
|
|
270
|
+
walletAddress?: string; // Optional: auto-fetched from API key
|
|
251
271
|
logoUrl?: string;
|
|
252
272
|
webhookUrl?: string;
|
|
253
273
|
};
|
|
@@ -257,6 +277,8 @@ interface SettlrConfig {
|
|
|
257
277
|
}
|
|
258
278
|
```
|
|
259
279
|
|
|
280
|
+
> **Tip:** When you register at [settlr.dev/onboarding](https://settlr.dev/onboarding), your wallet address is linked to your API key. You don't need to specify it in the config!
|
|
281
|
+
|
|
260
282
|
#### Methods
|
|
261
283
|
|
|
262
284
|
##### `createPayment(options)`
|
package/dist/index.js
CHANGED
|
@@ -633,7 +633,7 @@ var defaultStyles = {
|
|
|
633
633
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
634
634
|
},
|
|
635
635
|
primary: {
|
|
636
|
-
background: "linear-gradient(135deg,
|
|
636
|
+
background: "linear-gradient(135deg, rgb(168, 85, 247) 0%, rgb(34, 211, 238) 100%)",
|
|
637
637
|
color: "white"
|
|
638
638
|
},
|
|
639
639
|
secondary: {
|
|
@@ -643,8 +643,8 @@ var defaultStyles = {
|
|
|
643
643
|
},
|
|
644
644
|
outline: {
|
|
645
645
|
background: "transparent",
|
|
646
|
-
color: "
|
|
647
|
-
border: "2px solid
|
|
646
|
+
color: "rgb(168, 85, 247)",
|
|
647
|
+
border: "2px solid rgb(168, 85, 247)"
|
|
648
648
|
},
|
|
649
649
|
sm: {
|
|
650
650
|
padding: "8px 16px",
|
package/dist/index.mjs
CHANGED
|
@@ -590,7 +590,7 @@ var defaultStyles = {
|
|
|
590
590
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
591
591
|
},
|
|
592
592
|
primary: {
|
|
593
|
-
background: "linear-gradient(135deg,
|
|
593
|
+
background: "linear-gradient(135deg, rgb(168, 85, 247) 0%, rgb(34, 211, 238) 100%)",
|
|
594
594
|
color: "white"
|
|
595
595
|
},
|
|
596
596
|
secondary: {
|
|
@@ -600,8 +600,8 @@ var defaultStyles = {
|
|
|
600
600
|
},
|
|
601
601
|
outline: {
|
|
602
602
|
background: "transparent",
|
|
603
|
-
color: "
|
|
604
|
-
border: "2px solid
|
|
603
|
+
color: "rgb(168, 85, 247)",
|
|
604
|
+
border: "2px solid rgb(168, 85, 247)"
|
|
605
605
|
},
|
|
606
606
|
sm: {
|
|
607
607
|
padding: "8px 16px",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@settlr/sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Settlr SDK - Accept Solana USDC payments in games and apps. Email checkout, gasless transactions, no wallet required. The easiest way to add crypto payments.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|