@beep-it/sdk-core 0.1.0-beta.4 → 0.1.1
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 +24 -18
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# The BEEP SDK: Turn Your Cool Sh
|
|
1
|
+
# The BEEP SDK: Turn Your Cool Sh\*t into Cash 💸
|
|
2
2
|
|
|
3
3
|
Alright, let's be real. You made something awesome. A game, an app, a digital masterpiece. And now you wanna get paid for it. As you should! But dealing with payments is a whole vibe killer. That's where we come in.
|
|
4
4
|
|
|
5
|
-
## 🤔 So, like, what even
|
|
5
|
+
## 🤔 So, like, what even _is_ this?
|
|
6
6
|
|
|
7
7
|
Think of this SDK as your personal cheat code for money. It's a box of pre-written code that you can just drop into your project to handle all the boring payment stuff.
|
|
8
8
|
|
|
@@ -10,9 +10,9 @@ No, you don't need to know what an "SDK" is. Just know this: **this is the easy
|
|
|
10
10
|
|
|
11
11
|
With this, you can:
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
- **Give your users a "wallet"**: It's not a real wallet. It's just a secure spot online for them to keep their digital cash to pay you with. We handle all the scary security stuff.
|
|
14
|
+
- **Ask for money (nicely)**: Create an "invoice," which is just a fancy word for a bill. It's like sending a Venmo request, but for your app.
|
|
15
|
+
- **Actually get paid**: Process the payment and see the money roll in. Cha-ching.
|
|
16
16
|
|
|
17
17
|
Basically, we're the ✨ unpaid intern ✨ who handles your finances so you can get back to creating.
|
|
18
18
|
|
|
@@ -29,6 +29,7 @@ In your project's command line thingy (the black box where you type stuff), past
|
|
|
29
29
|
```bash
|
|
30
30
|
npm install @beep-it/sdk-core
|
|
31
31
|
```
|
|
32
|
+
|
|
32
33
|
This basically downloads our toolkit and puts it in your project's folder.
|
|
33
34
|
|
|
34
35
|
### Step 2: Get Your Secret Handshake (aka API Key)
|
|
@@ -48,7 +49,7 @@ import { BeepClient, SupportedToken } from '@beep-it/sdk-core';
|
|
|
48
49
|
// This line creates your BEEP-Bot. It's now ready for your commands.
|
|
49
50
|
const beep = new BeepClient({
|
|
50
51
|
// Just paste that secret key you got from the dashboard right here.
|
|
51
|
-
apiKey: 'your_super_secret_api_key_goes_here'
|
|
52
|
+
apiKey: 'your_super_secret_api_key_goes_here',
|
|
52
53
|
});
|
|
53
54
|
|
|
54
55
|
console.log('Ok, your BEEP-Bot is ready. Slay.');
|
|
@@ -80,7 +81,7 @@ You just need to tell your BEEP-Bot how much you want to charge and in what curr
|
|
|
80
81
|
6. **You get notified** - Either through webhooks (if you set those up) or by checking the status
|
|
81
82
|
7. **Money lands in your account** - Cha-ching! 🤑
|
|
82
83
|
|
|
83
|
-
Seriously, all
|
|
84
|
+
Seriously, all _you_ need to worry about is step 1. We handle 2-7 because we're nice like that.
|
|
84
85
|
|
|
85
86
|
```typescript
|
|
86
87
|
// Just describe what you're charging for.
|
|
@@ -105,7 +106,6 @@ try {
|
|
|
105
106
|
// 1. Render the `qrCode` in your UI for the user to scan.
|
|
106
107
|
// 2. Redirect the user to the `paymentUrl`.
|
|
107
108
|
// BEEP will handle the rest on the backend once the user approves the transaction.
|
|
108
|
-
|
|
109
109
|
} catch (error) {
|
|
110
110
|
console.error('Oof. Something went wrong creating the invoice:', error.message);
|
|
111
111
|
}
|
|
@@ -140,7 +140,7 @@ const invoice = await beep.invoices.createInvoice({
|
|
|
140
140
|
amount: '19.99', // Amount as string
|
|
141
141
|
token: SupportedToken.USDT, // Enum magic!
|
|
142
142
|
description: 'VIP Battle Pass - Summer Season',
|
|
143
|
-
payerType: 'customer_wallet' // Customer pays
|
|
143
|
+
payerType: 'customer_wallet', // Customer pays
|
|
144
144
|
});
|
|
145
145
|
|
|
146
146
|
// Now you have everything you need for the user to pay
|
|
@@ -210,7 +210,7 @@ const invoice = await beep.invoices.createInvoice({
|
|
|
210
210
|
description: 'Premium service',
|
|
211
211
|
amount: '29.99',
|
|
212
212
|
token: SupportedToken.USDT,
|
|
213
|
-
payerType: 'customer_wallet'
|
|
213
|
+
payerType: 'customer_wallet',
|
|
214
214
|
});
|
|
215
215
|
|
|
216
216
|
// Get all your invoices
|
|
@@ -236,7 +236,7 @@ const product = await beep.products.createProduct({
|
|
|
236
236
|
description: 'Gives +10 attack and looks cool as heck',
|
|
237
237
|
price: '9.99', // Just regular numbers as strings
|
|
238
238
|
token: SupportedToken.USDT, // So much cleaner than a crazy address
|
|
239
|
-
isSubscription: false // One-time purchase
|
|
239
|
+
isSubscription: false, // One-time purchase
|
|
240
240
|
});
|
|
241
241
|
|
|
242
242
|
console.log(`Created product with ID: ${product.id}`);
|
|
@@ -247,7 +247,7 @@ const subscriptionProduct = await beep.products.createProduct({
|
|
|
247
247
|
description: 'Monthly subscription with exclusive skins and perks',
|
|
248
248
|
price: '14.99', // Monthly price
|
|
249
249
|
token: SupportedToken.USDT,
|
|
250
|
-
isSubscription: true // This makes it recurring - monthly subscription!
|
|
250
|
+
isSubscription: true, // This makes it recurring - monthly subscription!
|
|
251
251
|
});
|
|
252
252
|
|
|
253
253
|
console.log(`Created subscription with ID: ${subscriptionProduct.id}`);
|
|
@@ -258,7 +258,7 @@ const oneTimeProduct = await beep.products.createProduct({
|
|
|
258
258
|
description: 'Credits for API calls',
|
|
259
259
|
price: '0.001', // Price per credit
|
|
260
260
|
token: SupportedToken.USDT,
|
|
261
|
-
isSubscription: false // One-time purchase
|
|
261
|
+
isSubscription: false, // One-time purchase
|
|
262
262
|
});
|
|
263
263
|
|
|
264
264
|
console.log(`Created one-time product with ID: ${oneTimeProduct.id}`);
|
|
@@ -280,7 +280,7 @@ const products = await beep.products.listProducts();
|
|
|
280
280
|
console.log(`You have ${products.length} products`);
|
|
281
281
|
|
|
282
282
|
// Loop through them if you're feeling fancy
|
|
283
|
-
products.forEach(product => {
|
|
283
|
+
products.forEach((product) => {
|
|
284
284
|
console.log(`${product.name}: ${product.price} ${product.token || 'tokens'}`);
|
|
285
285
|
});
|
|
286
286
|
```
|
|
@@ -292,7 +292,7 @@ products.forEach(product => {
|
|
|
292
292
|
const updatedProduct = await beep.products.updateProduct('prod_123abc456def', {
|
|
293
293
|
price: '14.99', // Price increase! Cha-ching!
|
|
294
294
|
description: 'Now with extra sparkles ✨',
|
|
295
|
-
token: SupportedToken.USDT
|
|
295
|
+
token: SupportedToken.USDT,
|
|
296
296
|
});
|
|
297
297
|
|
|
298
298
|
console.log('Product updated with new price:', updatedProduct.price);
|
|
@@ -314,16 +314,16 @@ Handle low-level payment operations like asset purchasing and transaction signin
|
|
|
314
314
|
// Request payment for assets
|
|
315
315
|
const payment = await beep.payments.requestAndPurchaseAsset({
|
|
316
316
|
paymentReference: 'premium_subscription_123',
|
|
317
|
-
assetIds: ['asset_1', 'asset_2']
|
|
317
|
+
assetIds: ['asset_1', 'asset_2'],
|
|
318
318
|
});
|
|
319
319
|
|
|
320
320
|
// Sign Solana transactions directly
|
|
321
321
|
const signedTx = await beep.payments.signSolanaTransaction({
|
|
322
322
|
senderAddress: 'sender_wallet_address',
|
|
323
|
-
recipientAddress: 'recipient_wallet_address',
|
|
323
|
+
recipientAddress: 'recipient_wallet_address',
|
|
324
324
|
tokenMintAddress: 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB',
|
|
325
325
|
amount: 1000000, // 1.0 USDT in base units
|
|
326
|
-
decimals: 6
|
|
326
|
+
decimals: 6,
|
|
327
327
|
});
|
|
328
328
|
```
|
|
329
329
|
|
|
@@ -353,6 +353,12 @@ console.log(defaultToken); // SupportedToken.USDT
|
|
|
353
353
|
|
|
354
354
|
---
|
|
355
355
|
|
|
356
|
+
## Resources
|
|
357
|
+
|
|
358
|
+
[Beep llms.txt](https://www.justbeep.it/llms.txt)
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
356
362
|
## License
|
|
357
363
|
|
|
358
364
|
MIT. Go wild.
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -467,7 +467,7 @@ var BeepClient = class {
|
|
|
467
467
|
throw new Error("API key is required to initialize BeepClient");
|
|
468
468
|
}
|
|
469
469
|
this.client = import_axios.default.create({
|
|
470
|
-
baseURL: options.serverUrl || "https://api.
|
|
470
|
+
baseURL: options.serverUrl || "https://api.justbeep.it",
|
|
471
471
|
headers: {
|
|
472
472
|
Authorization: `Bearer ${options.apiKey}`,
|
|
473
473
|
"Content-Type": "application/json",
|
package/dist/index.mjs
CHANGED
|
@@ -431,7 +431,7 @@ var BeepClient = class {
|
|
|
431
431
|
throw new Error("API key is required to initialize BeepClient");
|
|
432
432
|
}
|
|
433
433
|
this.client = axios.create({
|
|
434
|
-
baseURL: options.serverUrl || "https://api.
|
|
434
|
+
baseURL: options.serverUrl || "https://api.justbeep.it",
|
|
435
435
|
headers: {
|
|
436
436
|
Authorization: `Bearer ${options.apiKey}`,
|
|
437
437
|
"Content-Type": "application/json",
|