@beep-it/sdk-core 0.1.4 → 0.1.6
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 +12 -3
- package/dist/index.js +44 -35
- package/dist/index.mjs +44 -35
- package/dist/modules/payments.d.ts +8 -5
- package/dist/modules/payments.d.ts.map +1 -1
- package/dist/modules/products.d.ts.map +1 -1
- package/dist/types/payment.d.ts +23 -0
- package/dist/types/payment.d.ts.map +1 -1
- package/dist/types/token.d.ts +5 -4
- package/dist/types/token.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
# The BEEP SDK: Turn Your Cool Sh\*t into
|
|
1
|
+
# The BEEP PAY SDK: Turn Your Cool Sh\*t into Revenue - now on SUI 💸
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Accept credit cards, USDC and receive revenue in USDC on SUI wallets
|
|
4
|
+
|
|
5
|
+
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.
|
|
6
|
+
|
|
7
|
+
That’s where **Beep** comes in.
|
|
8
|
+
|
|
9
|
+
Beep makes it stupid simple to accept **USDC payments** on the **SUI network**, fully **self-custodial**, **AEO-ready**, and **AI-native**.
|
|
10
|
+
No banks. No bridges. No nonsense.
|
|
11
|
+
|
|
12
|
+
---
|
|
4
13
|
|
|
5
14
|
## Table of Contents
|
|
6
15
|
|
|
@@ -374,7 +383,7 @@ const beep = new BeepClient({ apiKey: process.env.BEEP_API_KEY! });
|
|
|
374
383
|
const result = await beep.createPayout({
|
|
375
384
|
amount: '1000000', // 1.00 USDC (6 decimals)
|
|
376
385
|
destinationWalletAddress: 'DESTINATION_ADDRESS',
|
|
377
|
-
chain: '
|
|
386
|
+
chain: 'SUI',
|
|
378
387
|
token: 'USDC',
|
|
379
388
|
});
|
|
380
389
|
|
package/dist/index.js
CHANGED
|
@@ -40,26 +40,29 @@ var import_axios = __toESM(require("axios"));
|
|
|
40
40
|
|
|
41
41
|
// src/types/token.ts
|
|
42
42
|
var SupportedToken = /* @__PURE__ */ ((SupportedToken3) => {
|
|
43
|
+
SupportedToken3["USDC"] = "USDC";
|
|
43
44
|
SupportedToken3["USDT"] = "USDT";
|
|
44
45
|
return SupportedToken3;
|
|
45
46
|
})(SupportedToken || {});
|
|
46
47
|
var TOKEN_ADDRESSES = {
|
|
47
|
-
|
|
48
|
+
["USDC" /* USDC */]: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyB7u6T",
|
|
49
|
+
// USDC mint address
|
|
48
50
|
["USDT" /* USDT */]: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"
|
|
49
51
|
// USDT mint address
|
|
50
52
|
};
|
|
51
53
|
var TOKEN_DECIMALS = {
|
|
52
|
-
|
|
54
|
+
["USDC" /* USDC */]: 6,
|
|
55
|
+
// USDC uses 6 decimal places
|
|
53
56
|
["USDT" /* USDT */]: 6
|
|
54
57
|
// USDT uses 6 decimal places
|
|
55
58
|
};
|
|
56
59
|
var TokenUtils = class {
|
|
57
60
|
/**
|
|
58
61
|
* Retrieves the SPL token address for a supported token
|
|
59
|
-
*
|
|
62
|
+
*
|
|
60
63
|
* @param token - The supported token enum value
|
|
61
64
|
* @returns The corresponding SPL token address on Solana
|
|
62
|
-
*
|
|
65
|
+
*
|
|
63
66
|
* @example
|
|
64
67
|
* ```typescript
|
|
65
68
|
* const address = TokenUtils.getTokenAddress(SupportedToken.USDT);
|
|
@@ -71,10 +74,10 @@ var TokenUtils = class {
|
|
|
71
74
|
}
|
|
72
75
|
/**
|
|
73
76
|
* Performs reverse lookup to find token enum from SPL address
|
|
74
|
-
*
|
|
77
|
+
*
|
|
75
78
|
* @param address - The SPL token address to look up
|
|
76
79
|
* @returns The corresponding SupportedToken enum value, or null if not found
|
|
77
|
-
*
|
|
80
|
+
*
|
|
78
81
|
* @example
|
|
79
82
|
* ```typescript
|
|
80
83
|
* const token = TokenUtils.getTokenFromAddress('Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB');
|
|
@@ -91,14 +94,14 @@ var TokenUtils = class {
|
|
|
91
94
|
}
|
|
92
95
|
/**
|
|
93
96
|
* Gets the number of decimal places for accurate token amount calculations
|
|
94
|
-
*
|
|
97
|
+
*
|
|
95
98
|
* @param token - The supported token to get decimals for
|
|
96
|
-
* @returns Number of decimal places (e.g., 6 for
|
|
97
|
-
*
|
|
99
|
+
* @returns Number of decimal places (e.g., 6 for USDC)
|
|
100
|
+
*
|
|
98
101
|
* @example
|
|
99
102
|
* ```typescript
|
|
100
|
-
* const decimals = TokenUtils.getTokenDecimals(SupportedToken.
|
|
101
|
-
* const baseUnits = 1.5 * Math.pow(10, decimals); // Convert 1.5
|
|
103
|
+
* const decimals = TokenUtils.getTokenDecimals(SupportedToken.USDC);
|
|
104
|
+
* const baseUnits = 1.5 * Math.pow(10, decimals); // Convert 1.5 USDC to base units
|
|
102
105
|
* ```
|
|
103
106
|
*/
|
|
104
107
|
static getTokenDecimals(token) {
|
|
@@ -106,10 +109,10 @@ var TokenUtils = class {
|
|
|
106
109
|
}
|
|
107
110
|
/**
|
|
108
111
|
* Type guard to check if a string value represents a supported token
|
|
109
|
-
*
|
|
112
|
+
*
|
|
110
113
|
* @param token - String value to check
|
|
111
114
|
* @returns True if the token is supported, with proper type narrowing
|
|
112
|
-
*
|
|
115
|
+
*
|
|
113
116
|
* @example
|
|
114
117
|
* ```typescript
|
|
115
118
|
* const userInput = 'USDT';
|
|
@@ -124,17 +127,17 @@ var TokenUtils = class {
|
|
|
124
127
|
}
|
|
125
128
|
/**
|
|
126
129
|
* Returns the default token for operations when no token is specified
|
|
127
|
-
*
|
|
130
|
+
*
|
|
128
131
|
* @returns The default SupportedToken (currently USDT)
|
|
129
|
-
*
|
|
132
|
+
*
|
|
130
133
|
* @example
|
|
131
134
|
* ```typescript
|
|
132
135
|
* const defaultToken = TokenUtils.getDefaultToken();
|
|
133
|
-
* console.log(defaultToken); // SupportedToken.
|
|
136
|
+
* console.log(defaultToken); // SupportedToken.USDC
|
|
134
137
|
* ```
|
|
135
138
|
*/
|
|
136
139
|
static getDefaultToken() {
|
|
137
|
-
return "
|
|
140
|
+
return "USDC" /* USDC */;
|
|
138
141
|
}
|
|
139
142
|
};
|
|
140
143
|
|
|
@@ -436,7 +439,6 @@ var PaymentsModule = class {
|
|
|
436
439
|
* const beep = new BeepClient({ apiKey: 'your_secret_api_key' });
|
|
437
440
|
*
|
|
438
441
|
* const paymentSession = await beep.payments.issuePayment({
|
|
439
|
-
* apiKey: 'your_secret_api_key',
|
|
440
442
|
* assetChunks: [
|
|
441
443
|
* { assetId: 'video-streaming-uuid', quantity: 1 },
|
|
442
444
|
* { assetId: 'api-calls-uuid', quantity: 100 }
|
|
@@ -474,7 +476,6 @@ var PaymentsModule = class {
|
|
|
474
476
|
* ```typescript
|
|
475
477
|
* // Start billing for the streaming session
|
|
476
478
|
* const result = await beep.payments.startStreaming({
|
|
477
|
-
* apiKey: 'your_secret_api_key',
|
|
478
479
|
* invoiceId: 'invoice_uuid_from_issuePayment'
|
|
479
480
|
* });
|
|
480
481
|
*
|
|
@@ -504,7 +505,6 @@ var PaymentsModule = class {
|
|
|
504
505
|
* ```typescript
|
|
505
506
|
* // Temporarily pause billing (can be resumed later)
|
|
506
507
|
* const result = await beep.payments.pauseStreaming({
|
|
507
|
-
* apiKey: 'your_secret_api_key',
|
|
508
508
|
* invoiceId: 'active_streaming_invoice_uuid'
|
|
509
509
|
* });
|
|
510
510
|
*
|
|
@@ -536,7 +536,6 @@ var PaymentsModule = class {
|
|
|
536
536
|
* ```typescript
|
|
537
537
|
* // Permanently stop and finalize the streaming session
|
|
538
538
|
* const result = await beep.payments.stopStreaming({
|
|
539
|
-
* apiKey: 'your_secret_api_key',
|
|
540
539
|
* invoiceId: 'active_streaming_invoice_uuid'
|
|
541
540
|
* });
|
|
542
541
|
*
|
|
@@ -549,6 +548,16 @@ var PaymentsModule = class {
|
|
|
549
548
|
const response = await this.client.post("/v1/invoices/stop", payload);
|
|
550
549
|
return response.data;
|
|
551
550
|
}
|
|
551
|
+
/**
|
|
552
|
+
* Checks payment status for a given reference key.
|
|
553
|
+
* Calls the server `/v1/invoices/check-payment-status` endpoint with an API key.
|
|
554
|
+
*
|
|
555
|
+
* @param params.referenceKey - The payment reference key to check
|
|
556
|
+
*/
|
|
557
|
+
async checkPaymentStatus(params) {
|
|
558
|
+
const { data } = await this.client.post("/v1/invoices/check-payment-status", params);
|
|
559
|
+
return data;
|
|
560
|
+
}
|
|
552
561
|
};
|
|
553
562
|
|
|
554
563
|
// src/modules/products.ts
|
|
@@ -559,11 +568,11 @@ var ProductsModule = class {
|
|
|
559
568
|
/**
|
|
560
569
|
* Creates a new product with the specified configuration
|
|
561
570
|
* Products can be used to generate invoices with consistent pricing and metadata
|
|
562
|
-
*
|
|
571
|
+
*
|
|
563
572
|
* @param payload - Product creation parameters including name, price, and token information
|
|
564
573
|
* @returns Promise that resolves to the created product
|
|
565
574
|
* @throws {Error} When product creation fails
|
|
566
|
-
*
|
|
575
|
+
*
|
|
567
576
|
* @example
|
|
568
577
|
* ```typescript
|
|
569
578
|
* // Create a one-time purchase product
|
|
@@ -574,7 +583,7 @@ var ProductsModule = class {
|
|
|
574
583
|
* token: SupportedToken.USDT,
|
|
575
584
|
* isSubscription: false
|
|
576
585
|
* });
|
|
577
|
-
*
|
|
586
|
+
*
|
|
578
587
|
* // Create a subscription product
|
|
579
588
|
* const subscription = await beep.products.createProduct({
|
|
580
589
|
* name: 'Monthly Pro Plan',
|
|
@@ -591,7 +600,7 @@ var ProductsModule = class {
|
|
|
591
600
|
requestPayload.splTokenAddress = TokenUtils.getTokenAddress(requestPayload.token);
|
|
592
601
|
}
|
|
593
602
|
if (requestPayload.price) {
|
|
594
|
-
const token = requestPayload.token || "
|
|
603
|
+
const token = requestPayload.token || "USDC" /* USDC */;
|
|
595
604
|
const decimals = TokenUtils.getTokenDecimals(token);
|
|
596
605
|
const priceValue = typeof requestPayload.price === "string" ? parseFloat(requestPayload.price) : requestPayload.price;
|
|
597
606
|
const priceInBaseUnits = Math.round(priceValue * 10 ** decimals);
|
|
@@ -602,11 +611,11 @@ var ProductsModule = class {
|
|
|
602
611
|
}
|
|
603
612
|
/**
|
|
604
613
|
* Retrieves a specific product by its ID
|
|
605
|
-
*
|
|
614
|
+
*
|
|
606
615
|
* @param productId - The unique identifier of the product to retrieve
|
|
607
616
|
* @returns Promise that resolves to the product details
|
|
608
617
|
* @throws {Error} When the product is not found or retrieval fails
|
|
609
|
-
*
|
|
618
|
+
*
|
|
610
619
|
* @example
|
|
611
620
|
* ```typescript
|
|
612
621
|
* const product = await beep.products.getProduct('prod_123abc456def');
|
|
@@ -619,10 +628,10 @@ var ProductsModule = class {
|
|
|
619
628
|
}
|
|
620
629
|
/**
|
|
621
630
|
* Retrieves all products for the current merchant
|
|
622
|
-
*
|
|
631
|
+
*
|
|
623
632
|
* @returns Promise that resolves to an array of products
|
|
624
633
|
* @throws {Error} When product retrieval fails
|
|
625
|
-
*
|
|
634
|
+
*
|
|
626
635
|
* @example
|
|
627
636
|
* ```typescript
|
|
628
637
|
* const products = await beep.products.listProducts();
|
|
@@ -637,19 +646,19 @@ var ProductsModule = class {
|
|
|
637
646
|
/**
|
|
638
647
|
* Updates an existing product with new configuration
|
|
639
648
|
* Only provided fields will be updated - omitted fields remain unchanged
|
|
640
|
-
*
|
|
649
|
+
*
|
|
641
650
|
* @param productId - The unique identifier of the product to update
|
|
642
651
|
* @param payload - Product update parameters (all fields optional)
|
|
643
652
|
* @returns Promise that resolves to the updated product
|
|
644
653
|
* @throws {Error} When the product is not found or update fails
|
|
645
|
-
*
|
|
654
|
+
*
|
|
646
655
|
* @example
|
|
647
656
|
* ```typescript
|
|
648
657
|
* // Update just the price
|
|
649
658
|
* const updatedProduct = await beep.products.updateProduct('prod_123', {
|
|
650
659
|
* price: '29.99'
|
|
651
660
|
* });
|
|
652
|
-
*
|
|
661
|
+
*
|
|
653
662
|
* // Update multiple fields
|
|
654
663
|
* const updatedProduct = await beep.products.updateProduct('prod_123', {
|
|
655
664
|
* name: 'New Product Name',
|
|
@@ -668,13 +677,13 @@ var ProductsModule = class {
|
|
|
668
677
|
}
|
|
669
678
|
/**
|
|
670
679
|
* Deletes an existing product
|
|
671
|
-
*
|
|
680
|
+
*
|
|
672
681
|
* @param productId - The unique identifier of the product to delete
|
|
673
682
|
* @returns Promise that resolves when the product is successfully deleted
|
|
674
683
|
* @throws {Error} When the product is not found or deletion fails
|
|
675
|
-
*
|
|
684
|
+
*
|
|
676
685
|
* @remarks Once deleted, a product cannot be recovered. Existing invoices linked to this product will remain unaffected.
|
|
677
|
-
*
|
|
686
|
+
*
|
|
678
687
|
* @example
|
|
679
688
|
* ```typescript
|
|
680
689
|
* await beep.products.deleteProduct('prod_123abc456def');
|
package/dist/index.mjs
CHANGED
|
@@ -3,26 +3,29 @@ import axios from "axios";
|
|
|
3
3
|
|
|
4
4
|
// src/types/token.ts
|
|
5
5
|
var SupportedToken = /* @__PURE__ */ ((SupportedToken3) => {
|
|
6
|
+
SupportedToken3["USDC"] = "USDC";
|
|
6
7
|
SupportedToken3["USDT"] = "USDT";
|
|
7
8
|
return SupportedToken3;
|
|
8
9
|
})(SupportedToken || {});
|
|
9
10
|
var TOKEN_ADDRESSES = {
|
|
10
|
-
|
|
11
|
+
["USDC" /* USDC */]: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyB7u6T",
|
|
12
|
+
// USDC mint address
|
|
11
13
|
["USDT" /* USDT */]: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"
|
|
12
14
|
// USDT mint address
|
|
13
15
|
};
|
|
14
16
|
var TOKEN_DECIMALS = {
|
|
15
|
-
|
|
17
|
+
["USDC" /* USDC */]: 6,
|
|
18
|
+
// USDC uses 6 decimal places
|
|
16
19
|
["USDT" /* USDT */]: 6
|
|
17
20
|
// USDT uses 6 decimal places
|
|
18
21
|
};
|
|
19
22
|
var TokenUtils = class {
|
|
20
23
|
/**
|
|
21
24
|
* Retrieves the SPL token address for a supported token
|
|
22
|
-
*
|
|
25
|
+
*
|
|
23
26
|
* @param token - The supported token enum value
|
|
24
27
|
* @returns The corresponding SPL token address on Solana
|
|
25
|
-
*
|
|
28
|
+
*
|
|
26
29
|
* @example
|
|
27
30
|
* ```typescript
|
|
28
31
|
* const address = TokenUtils.getTokenAddress(SupportedToken.USDT);
|
|
@@ -34,10 +37,10 @@ var TokenUtils = class {
|
|
|
34
37
|
}
|
|
35
38
|
/**
|
|
36
39
|
* Performs reverse lookup to find token enum from SPL address
|
|
37
|
-
*
|
|
40
|
+
*
|
|
38
41
|
* @param address - The SPL token address to look up
|
|
39
42
|
* @returns The corresponding SupportedToken enum value, or null if not found
|
|
40
|
-
*
|
|
43
|
+
*
|
|
41
44
|
* @example
|
|
42
45
|
* ```typescript
|
|
43
46
|
* const token = TokenUtils.getTokenFromAddress('Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB');
|
|
@@ -54,14 +57,14 @@ var TokenUtils = class {
|
|
|
54
57
|
}
|
|
55
58
|
/**
|
|
56
59
|
* Gets the number of decimal places for accurate token amount calculations
|
|
57
|
-
*
|
|
60
|
+
*
|
|
58
61
|
* @param token - The supported token to get decimals for
|
|
59
|
-
* @returns Number of decimal places (e.g., 6 for
|
|
60
|
-
*
|
|
62
|
+
* @returns Number of decimal places (e.g., 6 for USDC)
|
|
63
|
+
*
|
|
61
64
|
* @example
|
|
62
65
|
* ```typescript
|
|
63
|
-
* const decimals = TokenUtils.getTokenDecimals(SupportedToken.
|
|
64
|
-
* const baseUnits = 1.5 * Math.pow(10, decimals); // Convert 1.5
|
|
66
|
+
* const decimals = TokenUtils.getTokenDecimals(SupportedToken.USDC);
|
|
67
|
+
* const baseUnits = 1.5 * Math.pow(10, decimals); // Convert 1.5 USDC to base units
|
|
65
68
|
* ```
|
|
66
69
|
*/
|
|
67
70
|
static getTokenDecimals(token) {
|
|
@@ -69,10 +72,10 @@ var TokenUtils = class {
|
|
|
69
72
|
}
|
|
70
73
|
/**
|
|
71
74
|
* Type guard to check if a string value represents a supported token
|
|
72
|
-
*
|
|
75
|
+
*
|
|
73
76
|
* @param token - String value to check
|
|
74
77
|
* @returns True if the token is supported, with proper type narrowing
|
|
75
|
-
*
|
|
78
|
+
*
|
|
76
79
|
* @example
|
|
77
80
|
* ```typescript
|
|
78
81
|
* const userInput = 'USDT';
|
|
@@ -87,17 +90,17 @@ var TokenUtils = class {
|
|
|
87
90
|
}
|
|
88
91
|
/**
|
|
89
92
|
* Returns the default token for operations when no token is specified
|
|
90
|
-
*
|
|
93
|
+
*
|
|
91
94
|
* @returns The default SupportedToken (currently USDT)
|
|
92
|
-
*
|
|
95
|
+
*
|
|
93
96
|
* @example
|
|
94
97
|
* ```typescript
|
|
95
98
|
* const defaultToken = TokenUtils.getDefaultToken();
|
|
96
|
-
* console.log(defaultToken); // SupportedToken.
|
|
99
|
+
* console.log(defaultToken); // SupportedToken.USDC
|
|
97
100
|
* ```
|
|
98
101
|
*/
|
|
99
102
|
static getDefaultToken() {
|
|
100
|
-
return "
|
|
103
|
+
return "USDC" /* USDC */;
|
|
101
104
|
}
|
|
102
105
|
};
|
|
103
106
|
|
|
@@ -399,7 +402,6 @@ var PaymentsModule = class {
|
|
|
399
402
|
* const beep = new BeepClient({ apiKey: 'your_secret_api_key' });
|
|
400
403
|
*
|
|
401
404
|
* const paymentSession = await beep.payments.issuePayment({
|
|
402
|
-
* apiKey: 'your_secret_api_key',
|
|
403
405
|
* assetChunks: [
|
|
404
406
|
* { assetId: 'video-streaming-uuid', quantity: 1 },
|
|
405
407
|
* { assetId: 'api-calls-uuid', quantity: 100 }
|
|
@@ -437,7 +439,6 @@ var PaymentsModule = class {
|
|
|
437
439
|
* ```typescript
|
|
438
440
|
* // Start billing for the streaming session
|
|
439
441
|
* const result = await beep.payments.startStreaming({
|
|
440
|
-
* apiKey: 'your_secret_api_key',
|
|
441
442
|
* invoiceId: 'invoice_uuid_from_issuePayment'
|
|
442
443
|
* });
|
|
443
444
|
*
|
|
@@ -467,7 +468,6 @@ var PaymentsModule = class {
|
|
|
467
468
|
* ```typescript
|
|
468
469
|
* // Temporarily pause billing (can be resumed later)
|
|
469
470
|
* const result = await beep.payments.pauseStreaming({
|
|
470
|
-
* apiKey: 'your_secret_api_key',
|
|
471
471
|
* invoiceId: 'active_streaming_invoice_uuid'
|
|
472
472
|
* });
|
|
473
473
|
*
|
|
@@ -499,7 +499,6 @@ var PaymentsModule = class {
|
|
|
499
499
|
* ```typescript
|
|
500
500
|
* // Permanently stop and finalize the streaming session
|
|
501
501
|
* const result = await beep.payments.stopStreaming({
|
|
502
|
-
* apiKey: 'your_secret_api_key',
|
|
503
502
|
* invoiceId: 'active_streaming_invoice_uuid'
|
|
504
503
|
* });
|
|
505
504
|
*
|
|
@@ -512,6 +511,16 @@ var PaymentsModule = class {
|
|
|
512
511
|
const response = await this.client.post("/v1/invoices/stop", payload);
|
|
513
512
|
return response.data;
|
|
514
513
|
}
|
|
514
|
+
/**
|
|
515
|
+
* Checks payment status for a given reference key.
|
|
516
|
+
* Calls the server `/v1/invoices/check-payment-status` endpoint with an API key.
|
|
517
|
+
*
|
|
518
|
+
* @param params.referenceKey - The payment reference key to check
|
|
519
|
+
*/
|
|
520
|
+
async checkPaymentStatus(params) {
|
|
521
|
+
const { data } = await this.client.post("/v1/invoices/check-payment-status", params);
|
|
522
|
+
return data;
|
|
523
|
+
}
|
|
515
524
|
};
|
|
516
525
|
|
|
517
526
|
// src/modules/products.ts
|
|
@@ -522,11 +531,11 @@ var ProductsModule = class {
|
|
|
522
531
|
/**
|
|
523
532
|
* Creates a new product with the specified configuration
|
|
524
533
|
* Products can be used to generate invoices with consistent pricing and metadata
|
|
525
|
-
*
|
|
534
|
+
*
|
|
526
535
|
* @param payload - Product creation parameters including name, price, and token information
|
|
527
536
|
* @returns Promise that resolves to the created product
|
|
528
537
|
* @throws {Error} When product creation fails
|
|
529
|
-
*
|
|
538
|
+
*
|
|
530
539
|
* @example
|
|
531
540
|
* ```typescript
|
|
532
541
|
* // Create a one-time purchase product
|
|
@@ -537,7 +546,7 @@ var ProductsModule = class {
|
|
|
537
546
|
* token: SupportedToken.USDT,
|
|
538
547
|
* isSubscription: false
|
|
539
548
|
* });
|
|
540
|
-
*
|
|
549
|
+
*
|
|
541
550
|
* // Create a subscription product
|
|
542
551
|
* const subscription = await beep.products.createProduct({
|
|
543
552
|
* name: 'Monthly Pro Plan',
|
|
@@ -554,7 +563,7 @@ var ProductsModule = class {
|
|
|
554
563
|
requestPayload.splTokenAddress = TokenUtils.getTokenAddress(requestPayload.token);
|
|
555
564
|
}
|
|
556
565
|
if (requestPayload.price) {
|
|
557
|
-
const token = requestPayload.token || "
|
|
566
|
+
const token = requestPayload.token || "USDC" /* USDC */;
|
|
558
567
|
const decimals = TokenUtils.getTokenDecimals(token);
|
|
559
568
|
const priceValue = typeof requestPayload.price === "string" ? parseFloat(requestPayload.price) : requestPayload.price;
|
|
560
569
|
const priceInBaseUnits = Math.round(priceValue * 10 ** decimals);
|
|
@@ -565,11 +574,11 @@ var ProductsModule = class {
|
|
|
565
574
|
}
|
|
566
575
|
/**
|
|
567
576
|
* Retrieves a specific product by its ID
|
|
568
|
-
*
|
|
577
|
+
*
|
|
569
578
|
* @param productId - The unique identifier of the product to retrieve
|
|
570
579
|
* @returns Promise that resolves to the product details
|
|
571
580
|
* @throws {Error} When the product is not found or retrieval fails
|
|
572
|
-
*
|
|
581
|
+
*
|
|
573
582
|
* @example
|
|
574
583
|
* ```typescript
|
|
575
584
|
* const product = await beep.products.getProduct('prod_123abc456def');
|
|
@@ -582,10 +591,10 @@ var ProductsModule = class {
|
|
|
582
591
|
}
|
|
583
592
|
/**
|
|
584
593
|
* Retrieves all products for the current merchant
|
|
585
|
-
*
|
|
594
|
+
*
|
|
586
595
|
* @returns Promise that resolves to an array of products
|
|
587
596
|
* @throws {Error} When product retrieval fails
|
|
588
|
-
*
|
|
597
|
+
*
|
|
589
598
|
* @example
|
|
590
599
|
* ```typescript
|
|
591
600
|
* const products = await beep.products.listProducts();
|
|
@@ -600,19 +609,19 @@ var ProductsModule = class {
|
|
|
600
609
|
/**
|
|
601
610
|
* Updates an existing product with new configuration
|
|
602
611
|
* Only provided fields will be updated - omitted fields remain unchanged
|
|
603
|
-
*
|
|
612
|
+
*
|
|
604
613
|
* @param productId - The unique identifier of the product to update
|
|
605
614
|
* @param payload - Product update parameters (all fields optional)
|
|
606
615
|
* @returns Promise that resolves to the updated product
|
|
607
616
|
* @throws {Error} When the product is not found or update fails
|
|
608
|
-
*
|
|
617
|
+
*
|
|
609
618
|
* @example
|
|
610
619
|
* ```typescript
|
|
611
620
|
* // Update just the price
|
|
612
621
|
* const updatedProduct = await beep.products.updateProduct('prod_123', {
|
|
613
622
|
* price: '29.99'
|
|
614
623
|
* });
|
|
615
|
-
*
|
|
624
|
+
*
|
|
616
625
|
* // Update multiple fields
|
|
617
626
|
* const updatedProduct = await beep.products.updateProduct('prod_123', {
|
|
618
627
|
* name: 'New Product Name',
|
|
@@ -631,13 +640,13 @@ var ProductsModule = class {
|
|
|
631
640
|
}
|
|
632
641
|
/**
|
|
633
642
|
* Deletes an existing product
|
|
634
|
-
*
|
|
643
|
+
*
|
|
635
644
|
* @param productId - The unique identifier of the product to delete
|
|
636
645
|
* @returns Promise that resolves when the product is successfully deleted
|
|
637
646
|
* @throws {Error} When the product is not found or deletion fails
|
|
638
|
-
*
|
|
647
|
+
*
|
|
639
648
|
* @remarks Once deleted, a product cannot be recovered. Existing invoices linked to this product will remain unaffected.
|
|
640
|
-
*
|
|
649
|
+
*
|
|
641
650
|
* @example
|
|
642
651
|
* ```typescript
|
|
643
652
|
* await beep.products.deleteProduct('prod_123abc456def');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { BeepPurchaseAsset, IssuePaymentPayload, IssuePaymentResponse, PauseStreamingPayload, PauseStreamingResponse, PaymentRequestData, RequestAndPurchaseAssetRequestParams, SignSolanaTransactionData, SignSolanaTransactionParams, StartStreamingPayload, StartStreamingResponse, StopStreamingPayload, StopStreamingResponse } from '../types';
|
|
2
|
+
import { BeepPurchaseAsset, CheckPaymentStatusPayload, CheckPaymentStatusResponse, IssuePaymentPayload, IssuePaymentResponse, PauseStreamingPayload, PauseStreamingResponse, PaymentRequestData, RequestAndPurchaseAssetRequestParams, SignSolanaTransactionData, SignSolanaTransactionParams, StartStreamingPayload, StartStreamingResponse, StopStreamingPayload, StopStreamingResponse } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Module for handling payment operations including asset purchases and Solana transactions
|
|
5
5
|
* Provides methods for creating payment requests and signing blockchain transactions
|
|
@@ -140,7 +140,6 @@ export declare class PaymentsModule {
|
|
|
140
140
|
* const beep = new BeepClient({ apiKey: 'your_secret_api_key' });
|
|
141
141
|
*
|
|
142
142
|
* const paymentSession = await beep.payments.issuePayment({
|
|
143
|
-
* apiKey: 'your_secret_api_key',
|
|
144
143
|
* assetChunks: [
|
|
145
144
|
* { assetId: 'video-streaming-uuid', quantity: 1 },
|
|
146
145
|
* { assetId: 'api-calls-uuid', quantity: 100 }
|
|
@@ -172,7 +171,6 @@ export declare class PaymentsModule {
|
|
|
172
171
|
* ```typescript
|
|
173
172
|
* // Start billing for the streaming session
|
|
174
173
|
* const result = await beep.payments.startStreaming({
|
|
175
|
-
* apiKey: 'your_secret_api_key',
|
|
176
174
|
* invoiceId: 'invoice_uuid_from_issuePayment'
|
|
177
175
|
* });
|
|
178
176
|
*
|
|
@@ -199,7 +197,6 @@ export declare class PaymentsModule {
|
|
|
199
197
|
* ```typescript
|
|
200
198
|
* // Temporarily pause billing (can be resumed later)
|
|
201
199
|
* const result = await beep.payments.pauseStreaming({
|
|
202
|
-
* apiKey: 'your_secret_api_key',
|
|
203
200
|
* invoiceId: 'active_streaming_invoice_uuid'
|
|
204
201
|
* });
|
|
205
202
|
*
|
|
@@ -228,7 +225,6 @@ export declare class PaymentsModule {
|
|
|
228
225
|
* ```typescript
|
|
229
226
|
* // Permanently stop and finalize the streaming session
|
|
230
227
|
* const result = await beep.payments.stopStreaming({
|
|
231
|
-
* apiKey: 'your_secret_api_key',
|
|
232
228
|
* invoiceId: 'active_streaming_invoice_uuid'
|
|
233
229
|
* });
|
|
234
230
|
*
|
|
@@ -238,5 +234,12 @@ export declare class PaymentsModule {
|
|
|
238
234
|
* ```
|
|
239
235
|
*/
|
|
240
236
|
stopStreaming(payload: StopStreamingPayload): Promise<StopStreamingResponse>;
|
|
237
|
+
/**
|
|
238
|
+
* Checks payment status for a given reference key.
|
|
239
|
+
* Calls the server `/v1/invoices/check-payment-status` endpoint with an API key.
|
|
240
|
+
*
|
|
241
|
+
* @param params.referenceKey - The payment reference key to check
|
|
242
|
+
*/
|
|
243
|
+
checkPaymentStatus(params: CheckPaymentStatusPayload): Promise<CheckPaymentStatusResponse>;
|
|
241
244
|
}
|
|
242
245
|
//# sourceMappingURL=payments.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["../../src/modules/payments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,aAAa,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,oCAAoC,EAEpC,yBAAyB,EACzB,2BAA2B,EAE3B,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAGlB;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAgB;gBAElB,MAAM,EAAE,aAAa;IAIjC;;;;;;;;;;;;;;;;OAgBG;IACU,YAAY,CAAC,MAAM,EAAE;QAChC,MAAM,EA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M,OAAO,CAAC;AAEtC,OAAO,EACL,oBAAoB,EACpB,OAAO,EAGP,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAElB;;;;GAIG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAgB;gBAElB,MAAM,EAAE,aAAa;IAIjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACG,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../src/modules/products.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EACL,oBAAoB,EACpB,OAAO,EAGP,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAElB;;;;GAIG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAgB;gBAElB,MAAM,EAAE,aAAa;IAIjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACG,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC;IA0BpE;;;;;;;;;;;;OAYG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKrD;;;;;;;;;;;;OAYG;IACG,YAAY,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAKxC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC;IAYvF;;;;;;;;;;;;;;OAcG;IACG,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGtD"}
|
package/dist/types/payment.d.ts
CHANGED
|
@@ -292,4 +292,27 @@ export interface StopStreamingResponse {
|
|
|
292
292
|
*/
|
|
293
293
|
referenceKeys: string[];
|
|
294
294
|
}
|
|
295
|
+
export declare enum PayoutStatus {
|
|
296
|
+
PENDING = "PENDING",
|
|
297
|
+
IN_PROGRESS = "IN_PROGRESS",
|
|
298
|
+
COMPLETED = "COMPLETED",
|
|
299
|
+
FAILED = "FAILED",
|
|
300
|
+
CANCELED = "CANCELED"
|
|
301
|
+
}
|
|
302
|
+
export interface CheckPaymentStatusPayload {
|
|
303
|
+
/** The payment reference key to check */
|
|
304
|
+
referenceKey: string;
|
|
305
|
+
}
|
|
306
|
+
export interface CheckPaymentStatusResponse {
|
|
307
|
+
/** The current status of the payment (PENDING, IN_PROGRESS, COMPLETED, FAILED, CANCELED) */
|
|
308
|
+
status: PayoutStatus | 'NOT_FOUND';
|
|
309
|
+
/** The payout amount (if applicable) */
|
|
310
|
+
amount?: string;
|
|
311
|
+
/** The blockchain chain (if applicable) */
|
|
312
|
+
chain?: string;
|
|
313
|
+
/** The token type (if applicable) */
|
|
314
|
+
token?: string;
|
|
315
|
+
/** The destination wallet address (if applicable) */
|
|
316
|
+
destinationWalletAddress?: string;
|
|
317
|
+
}
|
|
295
318
|
//# sourceMappingURL=payment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../src/types/payment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AAEH,MAAM,WAAW,oCAAoC;IACnD,8DAA8D;IAC9D,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC5B,uDAAuD;IACvD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mCAAmC;IACnC,cAAc,CAA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EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,oBAAY,YAAY;IACtB,OAAO,YAAY;IACnB,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,QAAQ,aAAa;CACtB;AAED,MAAM,WAAW,yBAAyB;IACxC,yCAAyC;IACzC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,0BAA0B;IACzC,4FAA4F;IAC5F,MAAM,EAAE,YAAY,GAAG,WAAW,CAAC;IACnC,wCAAwC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC"}
|
package/dist/types/token.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Each token represents a different cryptocurrency that can be used for payments
|
|
4
4
|
*/
|
|
5
5
|
export declare enum SupportedToken {
|
|
6
|
+
USDC = "USDC",// Coming soon
|
|
6
7
|
/** Tether USD - A USD-pegged stablecoin */
|
|
7
8
|
USDT = "USDT"
|
|
8
9
|
}
|
|
@@ -52,12 +53,12 @@ export declare class TokenUtils {
|
|
|
52
53
|
* Gets the number of decimal places for accurate token amount calculations
|
|
53
54
|
*
|
|
54
55
|
* @param token - The supported token to get decimals for
|
|
55
|
-
* @returns Number of decimal places (e.g., 6 for
|
|
56
|
+
* @returns Number of decimal places (e.g., 6 for USDC)
|
|
56
57
|
*
|
|
57
58
|
* @example
|
|
58
59
|
* ```typescript
|
|
59
|
-
* const decimals = TokenUtils.getTokenDecimals(SupportedToken.
|
|
60
|
-
* const baseUnits = 1.5 * Math.pow(10, decimals); // Convert 1.5
|
|
60
|
+
* const decimals = TokenUtils.getTokenDecimals(SupportedToken.USDC);
|
|
61
|
+
* const baseUnits = 1.5 * Math.pow(10, decimals); // Convert 1.5 USDC to base units
|
|
61
62
|
* ```
|
|
62
63
|
*/
|
|
63
64
|
static getTokenDecimals(token: SupportedToken): number;
|
|
@@ -85,7 +86,7 @@ export declare class TokenUtils {
|
|
|
85
86
|
* @example
|
|
86
87
|
* ```typescript
|
|
87
88
|
* const defaultToken = TokenUtils.getDefaultToken();
|
|
88
|
-
* console.log(defaultToken); // SupportedToken.
|
|
89
|
+
* console.log(defaultToken); // SupportedToken.USDC
|
|
89
90
|
* ```
|
|
90
91
|
*/
|
|
91
92
|
static getDefaultToken(): SupportedToken;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/types/token.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,cAAc;
|
|
1
|
+
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/types/token.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,cAAc;IACxB,IAAI,SAAS,CAAE,cAAc;IAC7B,2CAA2C;IAC3C,IAAI,SAAS;CACd;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAG1D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAGzD,CAAC;AAEF;;;GAGG;AACH,qBAAa,UAAU;IACrB;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM;IAIrD;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI;IASlE;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM;IAItD;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,cAAc;IAI/D;;;;;;;;;;OAUG;IACH,MAAM,CAAC,eAAe,IAAI,cAAc;CAGzC"}
|