@solvapay/server 1.0.0-preview.20 → 1.0.0-preview.21

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/dist/index.d.cts CHANGED
@@ -1,212 +1,353 @@
1
1
  interface components {
2
2
  schemas: {
3
- UpdateProviderDto: Record<string, never>;
3
+ UpdateProviderDto: {
4
+ /** @description Legal entity information */
5
+ legalEntity?: Record<string, never>;
6
+ /**
7
+ * Provider description
8
+ * @example My business
9
+ */
10
+ description?: string;
11
+ /**
12
+ * Business website URL
13
+ * @example https://example.com
14
+ */
15
+ website?: string;
16
+ /**
17
+ * Business type
18
+ * @example individual
19
+ * @enum {string}
20
+ */
21
+ businessType?: "individual" | "company";
22
+ /**
23
+ * Business email address
24
+ * @example business@example.com
25
+ */
26
+ businessEmail?: string;
27
+ /**
28
+ * Support email address
29
+ * @example support@example.com
30
+ */
31
+ supportEmail?: string;
32
+ /**
33
+ * Business telephone number
34
+ * @example +1234567890
35
+ */
36
+ telephone?: string;
37
+ /**
38
+ * Support telephone number
39
+ * @example +1234567890
40
+ */
41
+ supportTelephone?: string;
42
+ /**
43
+ * Default currency code
44
+ * @example usd
45
+ */
46
+ defaultCurrency?: string;
47
+ /** @description Arbitrary metadata */
48
+ metadata?: Record<string, never>;
49
+ /** @description Terms of Service acceptance */
50
+ tosAcceptance?: Record<string, never>;
51
+ };
4
52
  CreateSecretKey: Record<string, never>;
5
- CheckName: Record<string, never>;
6
- CreateAdminAgent: Record<string, never>;
7
- UpdateAdminAgent: Record<string, never>;
8
- Agent: Record<string, never>;
9
- CreateAgentRequest: Record<string, never>;
10
- UpdateAgentRequest: Record<string, never>;
11
- Signup: Record<string, never>;
53
+ Signup: {
54
+ name: string;
55
+ email: string;
56
+ /** @enum {string} */
57
+ type?: "provider" | "admin" | "super_admin";
58
+ };
12
59
  AuthResponse: Record<string, never>;
13
- Login: Record<string, never>;
14
- ForgotPassword: Record<string, never>;
15
- ResetPassword: Record<string, never>;
16
- VerifyEmail: Record<string, never>;
60
+ Login: {
61
+ /** @description Email to send a 6-digit login code to */
62
+ email: string;
63
+ };
64
+ VerifyLoginCode: {
65
+ email: string;
66
+ /** @description 6-digit login code sent to email */
67
+ code: string;
68
+ };
69
+ VerifyEmail: {
70
+ emailVerificationCode: string;
71
+ };
17
72
  CreateUser: Record<string, never>;
18
73
  UpdateUser: Record<string, never>;
19
74
  UpdateProfile: Record<string, never>;
20
75
  UpdatePreferences: Record<string, never>;
21
- ChangePassword: Record<string, never>;
22
- RequestEmailChange: Record<string, never>;
23
- CreateProductRequest: {
24
- /**
25
- * Product name
26
- * @example AI Writing Assistant
27
- */
28
- name: string;
76
+ RequestEmailChange: {
77
+ newEmail: string;
78
+ };
79
+ VerifyEmailChange: {
80
+ code: string;
81
+ };
82
+ CreateCheckoutSessionRequest: {
29
83
  /**
30
- * Product description
31
- * @example AI-powered writing tool
84
+ * Customer reference
85
+ * @example cus_3c4d5e6f7g8h
32
86
  */
33
- description?: string;
34
- /** URL to the product image */
35
- imageUrl?: string;
87
+ customerReference: string;
36
88
  /**
37
- * Free-form product type defined by the provider
38
- * @example Coding Assistant
89
+ * Plan reference (optional)
90
+ * @example pln_2b3c4d5e6f7g
39
91
  */
40
- productType?: string;
92
+ planRef?: string;
41
93
  /**
42
- * Whether this product uses MCP Pay proxy
43
- * @default false
94
+ * Product reference (required)
95
+ * @example prd_1a2b3c4d5e6f
44
96
  */
45
- isMcpPay: boolean;
46
- /** Product-specific configuration */
47
- config?: Record<string, never>;
48
- /** Arbitrary key-value metadata */
49
- metadata?: Record<string, never>;
97
+ productRef: string;
50
98
  };
51
- SdkProductResponse: {
99
+ CheckoutSessionResponse: {
52
100
  /**
53
- * Product ID
101
+ * Checkout session ID
54
102
  * @example 507f1f77bcf86cd799439011
55
103
  */
56
104
  id: string;
57
105
  /**
58
- * Product reference
59
- * @example prd_1A2B3C4D
106
+ * Public session ID used in checkout URL
107
+ * @example a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6
60
108
  */
61
- reference: string;
109
+ sessionId: string;
62
110
  /**
63
- * Product name
64
- * @example AI Writing Assistant
111
+ * Amount in cents
112
+ * @example 2999
65
113
  */
66
- name: string;
67
- /** Product description */
68
- description?: string;
69
- /** URL to the product image */
70
- imageUrl?: string;
71
- /** Free-form product type */
72
- productType?: string;
114
+ amount: number;
73
115
  /**
74
- * Product status
116
+ * Currency code
117
+ * @example USD
118
+ */
119
+ currency: string;
120
+ /**
121
+ * Session status
75
122
  * @example active
76
123
  */
77
124
  status: string;
78
125
  /**
79
- * Product balance in cents
80
- * @example 0
126
+ * Checkout URL to open the checkout page
127
+ * @example https://solvapay.com/customer/checkout?id=a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6
81
128
  */
82
- balance: number;
129
+ checkoutUrl: string;
130
+ };
131
+ SelectCustomerSessionProductRequest: {
83
132
  /**
84
- * Total number of transactions
85
- * @example 0
133
+ * Product reference or ID to scope the customer manage session
134
+ * @example prd_1a2b3c4d5e6f
86
135
  */
87
- totalTransactions: number;
136
+ productRef: string;
137
+ };
138
+ CancelRenewalRequest: {
139
+ /** @description Reason for cancelling renewal */
140
+ reason?: string;
141
+ };
142
+ ExternalAccount: {
88
143
  /**
89
- * Whether this product uses MCP Pay proxy
90
- * @example false
144
+ * Country code
145
+ * @example US
91
146
  */
92
- isMcpPay: boolean;
93
- /** Product-specific configuration */
94
- config?: Record<string, never>;
95
- /** Arbitrary key-value metadata */
96
- metadata?: Record<string, never>;
97
- /** Creation timestamp */
98
- createdAt: string;
99
- /** Last update timestamp */
100
- updatedAt: string;
101
- /** Plans associated with this product */
102
- plans?: string[];
103
- };
104
- UpdateProductRequest: {
105
- /** Product name */
106
- name?: string;
107
- /** Product description */
108
- description?: string;
109
- /** URL to the product image */
110
- imageUrl?: string;
111
- /** Free-form product type defined by the provider */
112
- productType?: string;
147
+ country: string;
113
148
  /**
114
- * Product status
149
+ * Currency code
150
+ * @example usd
151
+ */
152
+ currency: string;
153
+ /**
154
+ * Account holder name
155
+ * @example John Doe
156
+ */
157
+ accountHolderName: string;
158
+ /**
159
+ * Account holder type
160
+ * @example individual
115
161
  * @enum {string}
116
162
  */
117
- status?: "active" | "inactive" | "suspended";
118
- /** Product-specific configuration */
119
- config?: Record<string, never>;
120
- /** Arbitrary key-value metadata */
121
- metadata?: Record<string, never>;
163
+ accountHolderType: "individual" | "company";
164
+ /**
165
+ * Routing number
166
+ * @example 110000000
167
+ */
168
+ routingNumber: string;
169
+ /**
170
+ * Account number
171
+ * @example 000123456789
172
+ */
173
+ accountNumber: string;
122
174
  };
123
- CreatePlanRequest: {
175
+ TosAcceptance: {
124
176
  /**
125
- * Plan name
126
- * @example Basic Plan
177
+ * IP address of user accepting ToS
178
+ * @example 192.168.1.1
127
179
  */
128
- name: string;
180
+ ip: string;
181
+ };
182
+ UpdateConnectedAccount: {
129
183
  /**
130
- * Plan description
131
- * @example Basic recurring plan with monthly billing
184
+ * Business website URL
185
+ * @example https://example.com
132
186
  */
133
- description?: string;
187
+ website?: string;
188
+ /** @description External bank account */
189
+ externalAccount?: components["schemas"]["ExternalAccount"];
190
+ /** @description Terms of Service acceptance */
191
+ tosAcceptance?: components["schemas"]["TosAcceptance"];
192
+ };
193
+ Plan: {
134
194
  /**
135
- * Plan type
195
+ * Plan type exposed in SDK
136
196
  * @example recurring
137
197
  * @enum {string}
138
198
  */
139
- type?: "recurring" | "usage-based" | "hybrid" | "one-time";
199
+ type: "recurring" | "one-time";
140
200
  /**
141
- * Billing cycle (required for recurring/hybrid, optional for post-paid usage-based)
142
- * @example monthly
143
- * @enum {string}
201
+ * Plan ID
202
+ * @example 507f1f77bcf86cd799439011
144
203
  */
145
- billingCycle?: "weekly" | "monthly" | "quarterly" | "yearly" | "custom";
204
+ id: string;
146
205
  /**
147
- * Plan price
148
- * @example 29.99
206
+ * Plan reference
207
+ * @example pln_1A2B3C4D
149
208
  */
150
- price?: number;
209
+ reference: string;
210
+ /**
211
+ * Plan price in cents
212
+ * @example 2999
213
+ */
214
+ price: number;
151
215
  /**
152
216
  * Currency code (ISO 4217)
153
217
  * @example USD
154
- * @enum {string}
155
218
  */
156
- currency?: "USD" | "EUR" | "GBP" | "SEK" | "NOK" | "DKK" | "CAD" | "AUD" | "JPY" | "CHF" | "PLN" | "CZK" | "HUF" | "RON" | "BGN" | "HRK" | "RSD" | "MKD" | "BAM" | "ALL" | "ISK" | "TRY" | "RUB" | "UAH" | "BYN" | "MDL" | "GEL" | "AMD" | "AZN" | "KZT" | "KGS" | "TJS" | "TMT" | "UZS" | "MNT" | "CNY" | "KRW" | "THB" | "VND" | "IDR" | "MYR" | "SGD" | "PHP" | "INR" | "PKR" | "BDT" | "LKR" | "NPR" | "AFN" | "IRR" | "IQD" | "JOD" | "KWD" | "LBP" | "OMR" | "QAR" | "SAR" | "SYP" | "AED" | "YER" | "ILS" | "EGP" | "MAD" | "TND" | "DZD" | "LYD" | "SDG" | "ETB" | "KES" | "TZS" | "UGX" | "RWF" | "BIF" | "DJF" | "SOS" | "ERN" | "SLL" | "GMD" | "GNF" | "CVE" | "STN" | "AOA" | "ZAR" | "BWP" | "SZL" | "LSL" | "NAD" | "ZMW" | "ZWL" | "MZN" | "MWK" | "MGA" | "MUR" | "SCR" | "KMF" | "MVR";
219
+ currency: string;
157
220
  /**
158
- * Setup fee
159
- * @example 0
221
+ * Currency symbol (derived from currency)
222
+ * @example $
223
+ */
224
+ currencySymbol?: string;
225
+ /**
226
+ * Number of free units included
227
+ * @example 100
228
+ */
229
+ freeUnits?: number;
230
+ /**
231
+ * One-time setup fee
232
+ * @example 500
160
233
  */
161
234
  setupFee?: number;
162
235
  /**
163
- * Trial days
164
- * @example 7
236
+ * Free trial period in days
237
+ * @example 14
165
238
  */
166
239
  trialDays?: number;
167
240
  /**
168
- * Number of free units included
169
- * @example 100
241
+ * Billing cycle
242
+ * @example monthly
170
243
  */
171
- freeUnits?: number;
244
+ billingCycle?: string;
172
245
  /**
173
- * Billing model for usage-based plans
246
+ * Billing model
174
247
  * @example pre-paid
175
248
  * @enum {string}
176
249
  */
177
250
  billingModel?: "pre-paid" | "post-paid";
178
251
  /**
179
- * Price per unit for usage-based plans
252
+ * Price per usage unit
180
253
  * @example 0.01
181
254
  */
182
255
  pricePerUnit?: number;
183
256
  /**
184
- * Unit name for usage-based plans
185
- * @example request
257
+ * What the plan measures for usage tracking
258
+ * @example requests
186
259
  */
187
- unit?: string;
260
+ measures?: string;
188
261
  /**
189
- * Usage quota for usage-based plans
262
+ * Usage limit for the meter
190
263
  * @example 10000
191
264
  */
192
- quota?: number;
265
+ limit?: number;
193
266
  /**
194
- * Whether to rollover unused units
267
+ * Whether unused units roll over to next period
195
268
  * @example false
196
269
  */
197
270
  rolloverUnusedUnits?: boolean;
271
+ /** @description Usage limits */
272
+ limits?: {
273
+ [key: string]: unknown;
274
+ };
275
+ /** @description Plan features */
276
+ features?: {
277
+ [key: string]: unknown;
278
+ };
279
+ /**
280
+ * Whether this is a free tier plan
281
+ * @example false
282
+ */
283
+ isFreeTier: boolean;
284
+ /**
285
+ * Whether payment is required
286
+ * @example true
287
+ */
288
+ requiresPayment: boolean;
289
+ /**
290
+ * Whether the plan is active (derived from status)
291
+ * @example true
292
+ */
293
+ isActive: boolean;
294
+ /** @description Maximum number of active users */
295
+ maxActiveUsers?: number;
296
+ /** @description Access expiry in days */
297
+ accessExpiryDays?: number;
298
+ /**
299
+ * Plan status
300
+ * @example active
301
+ */
302
+ status: string;
303
+ /** @description Creation timestamp */
304
+ createdAt: string;
305
+ /** @description Last update timestamp */
306
+ updatedAt: string;
307
+ };
308
+ CreatePlanRequest: {
309
+ /**
310
+ * Plan type exposed in SDK
311
+ * @example recurring
312
+ * @enum {string}
313
+ */
314
+ type?: "recurring" | "one-time";
315
+ /**
316
+ * Billing cycle (required for recurring/hybrid, optional for post-paid usage-based)
317
+ * @example monthly
318
+ * @enum {string}
319
+ */
320
+ billingCycle?: "weekly" | "monthly" | "quarterly" | "yearly" | "custom";
198
321
  /**
199
- * Base price for hybrid plans
200
- * @example 29.99
322
+ * Plan price in cents
323
+ * @example 2999
324
+ */
325
+ price?: number;
326
+ /**
327
+ * Currency code (ISO 4217)
328
+ * @example USD
329
+ * @enum {string}
330
+ */
331
+ currency?: "USD" | "EUR" | "GBP" | "SEK" | "NOK" | "DKK" | "CAD" | "AUD" | "JPY" | "CHF" | "PLN" | "CZK" | "HUF" | "RON" | "BGN" | "HRK" | "RSD" | "MKD" | "BAM" | "ALL" | "ISK" | "TRY" | "RUB" | "UAH" | "BYN" | "MDL" | "GEL" | "AMD" | "AZN" | "KZT" | "KGS" | "TJS" | "TMT" | "UZS" | "MNT" | "CNY" | "KRW" | "THB" | "VND" | "IDR" | "MYR" | "SGD" | "PHP" | "INR" | "PKR" | "BDT" | "LKR" | "NPR" | "AFN" | "IRR" | "IQD" | "JOD" | "KWD" | "LBP" | "OMR" | "QAR" | "SAR" | "SYP" | "AED" | "YER" | "ILS" | "EGP" | "MAD" | "TND" | "DZD" | "LYD" | "SDG" | "ETB" | "KES" | "TZS" | "UGX" | "RWF" | "BIF" | "DJF" | "SOS" | "ERN" | "SLL" | "GMD" | "GNF" | "CVE" | "STN" | "AOA" | "ZAR" | "BWP" | "SZL" | "LSL" | "NAD" | "ZMW" | "ZWL" | "MZN" | "MWK" | "MGA" | "MUR" | "SCR" | "KMF" | "MVR";
332
+ /**
333
+ * Number of free units included
334
+ * @example 100
335
+ */
336
+ freeUnits?: number;
337
+ /**
338
+ * Usage limit for the meter
339
+ * @example 10000
201
340
  */
202
- basePrice?: number;
341
+ limit?: number;
203
342
  /**
204
343
  * Usage limits (shape varies by plan type)
205
344
  * @example {
206
345
  * "maxTransactions": 1000
207
346
  * }
208
347
  */
209
- limits?: Record<string, never>;
348
+ limits?: {
349
+ [key: string]: unknown;
350
+ };
210
351
  /**
211
352
  * Plan features (generic key/value, shape is provider-defined)
212
353
  * @example {
@@ -214,7 +355,9 @@ interface components {
214
355
  * "prioritySupport": false
215
356
  * }
216
357
  */
217
- features?: Record<string, never>;
358
+ features?: {
359
+ [key: string]: unknown;
360
+ };
218
361
  /**
219
362
  * Whether this is a free tier plan
220
363
  * @example false
@@ -241,178 +384,1103 @@ interface components {
241
384
  * @example 30
242
385
  */
243
386
  accessExpiryDays?: number;
244
- /** Additional metadata */
245
- metadata?: Record<string, never>;
387
+ /** @description Additional metadata */
388
+ metadata?: {
389
+ [key: string]: unknown;
390
+ };
246
391
  /**
247
392
  * Whether this is the default plan
248
393
  * @example false
249
394
  */
250
395
  default?: boolean;
251
396
  };
252
- UpdatePlanRequest: Record<string, never>;
253
- CreateCheckoutSessionRequest: {
397
+ UpdatePlanRequest: {
254
398
  /**
255
- * Customer reference
256
- * @example cus_3c4d5e6f7g8h
399
+ * Billing cycle
400
+ * @example monthly
401
+ * @enum {string}
257
402
  */
258
- customerReference: string;
403
+ billingCycle?: "weekly" | "monthly" | "quarterly" | "yearly" | "custom";
259
404
  /**
260
- * Plan reference (optional)
261
- * @example pln_2b3c4d5e6f7g
405
+ * Plan price in cents
406
+ * @example 2999
262
407
  */
263
- planRef?: string;
408
+ price?: number;
264
409
  /**
265
- * Product reference (required)
266
- * @example prd_1a2b3c4d5e6f
410
+ * Currency code (ISO 4217)
411
+ * @example USD
267
412
  */
268
- productRef: string;
269
- };
270
- CheckoutSessionResponse: {
413
+ currency?: string;
271
414
  /**
272
- * Checkout session ID
273
- * @example 507f1f77bcf86cd799439011
415
+ * Number of free units included
416
+ * @example 100
274
417
  */
275
- id: string;
418
+ freeUnits?: number;
276
419
  /**
277
- * Public session ID used in checkout URL
278
- * @example a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6
420
+ * Usage limit for the meter
421
+ * @example 10000
279
422
  */
280
- sessionId: string;
423
+ limit?: number;
281
424
  /**
282
- * Amount in cents
283
- * @example 2999
425
+ * Usage limits (shape varies by plan type)
426
+ * @example {
427
+ * "maxTransactions": 1000
428
+ * }
284
429
  */
285
- amount: number;
430
+ limits?: {
431
+ [key: string]: unknown;
432
+ };
286
433
  /**
287
- * Currency code
288
- * @example USD
434
+ * Plan features (generic key/value, shape is provider-defined)
435
+ * @example {
436
+ * "apiAccess": true,
437
+ * "prioritySupport": false
438
+ * }
439
+ */
440
+ features?: {
441
+ [key: string]: unknown;
442
+ };
443
+ /**
444
+ * Whether this is a free tier plan
445
+ * @example false
446
+ */
447
+ isFreeTier?: boolean;
448
+ /**
449
+ * Whether payment is required
450
+ * @example true
451
+ */
452
+ requiresPayment?: boolean;
453
+ /**
454
+ * Plan status
455
+ * @example active
456
+ * @enum {string}
457
+ */
458
+ status?: "active" | "inactive" | "archived";
459
+ /**
460
+ * Maximum number of active users
461
+ * @example 10
462
+ */
463
+ maxActiveUsers?: number;
464
+ /**
465
+ * Access expiry in days
466
+ * @example 30
467
+ */
468
+ accessExpiryDays?: number;
469
+ /** @description Additional metadata */
470
+ metadata?: {
471
+ [key: string]: unknown;
472
+ };
473
+ /**
474
+ * Whether this is the default plan
475
+ * @example false
476
+ */
477
+ default?: boolean;
478
+ };
479
+ ProductConfigDto: {
480
+ /**
481
+ * Fulfillment type
482
+ * @example digital
483
+ */
484
+ fulfillmentType?: string;
485
+ /**
486
+ * Validity period in days
487
+ * @example 30
488
+ */
489
+ validityPeriod?: number;
490
+ /**
491
+ * Delivery method
492
+ * @example api
493
+ */
494
+ deliveryMethod?: string;
495
+ };
496
+ CreateProductRequest: {
497
+ /**
498
+ * Product name
499
+ * @example AI Writing Assistant
500
+ */
501
+ name: string;
502
+ /**
503
+ * Product description
504
+ * @example AI-powered writing tool
505
+ */
506
+ description?: string;
507
+ /** @description URL to the product image */
508
+ imageUrl?: string;
509
+ /**
510
+ * Free-form product type defined by the provider
511
+ * @example Coding Assistant
512
+ */
513
+ productType?: string;
514
+ /**
515
+ * Whether this product uses MCP Pay proxy
516
+ * @default false
517
+ */
518
+ isMcpPay: boolean;
519
+ /** @description Product-specific configuration */
520
+ config?: components["schemas"]["ProductConfigDto"];
521
+ /** @description Arbitrary key-value metadata */
522
+ metadata?: {
523
+ [key: string]: unknown;
524
+ };
525
+ };
526
+ SdkPlanResponse: {
527
+ /**
528
+ * Plan ID
529
+ * @example 507f1f77bcf86cd799439011
530
+ */
531
+ id: string;
532
+ /**
533
+ * Plan reference
534
+ * @example pln_1A2B3C4D
535
+ */
536
+ reference: string;
537
+ /**
538
+ * Plan price in cents
539
+ * @example 2999
540
+ */
541
+ price: number;
542
+ /**
543
+ * Currency code (ISO 4217)
544
+ * @example USD
289
545
  */
290
546
  currency: string;
547
+ /**
548
+ * Currency symbol
549
+ * @example $
550
+ */
551
+ currencySymbol?: string;
552
+ /**
553
+ * One-time setup fee
554
+ * @example 500
555
+ */
556
+ setupFee?: number;
557
+ /**
558
+ * Free trial period in days
559
+ * @example 14
560
+ */
561
+ trialDays?: number;
562
+ /**
563
+ * Billing cycle
564
+ * @example monthly
565
+ */
566
+ billingCycle?: string;
567
+ /**
568
+ * Billing model
569
+ * @example pre-paid
570
+ */
571
+ billingModel?: string;
572
+ /**
573
+ * Price per unit in cents
574
+ * @example 10
575
+ */
576
+ pricePerUnit?: number;
577
+ /**
578
+ * What the plan measures for usage tracking
579
+ * @example requests
580
+ */
581
+ measures?: string;
582
+ /**
583
+ * Usage limit for the meter
584
+ * @example 10000
585
+ */
586
+ limit?: number;
587
+ /**
588
+ * Whether unused units roll over to next period
589
+ * @example false
590
+ */
591
+ rolloverUnusedUnits?: boolean;
592
+ /**
593
+ * Included free units
594
+ * @example 1000
595
+ */
596
+ freeUnits?: number;
597
+ /** @description Usage limits */
598
+ limits?: {
599
+ [key: string]: unknown;
600
+ };
601
+ /** @description Plan features */
602
+ features?: {
603
+ [key: string]: unknown;
604
+ };
605
+ /**
606
+ * Whether this is a free tier plan
607
+ * @example false
608
+ */
609
+ isFreeTier: boolean;
610
+ /**
611
+ * Whether payment is required
612
+ * @example true
613
+ */
614
+ requiresPayment: boolean;
615
+ /**
616
+ * Whether the plan is active
617
+ * @example true
618
+ */
619
+ isActive: boolean;
620
+ /**
621
+ * Plan status
622
+ * @example active
623
+ */
624
+ status: string;
625
+ /** @description Creation timestamp */
626
+ createdAt: string;
627
+ /** @description Last update timestamp */
628
+ updatedAt: string;
629
+ };
630
+ SdkProductResponse: {
631
+ /**
632
+ * Product ID
633
+ * @example 507f1f77bcf86cd799439011
634
+ */
635
+ id: string;
636
+ /**
637
+ * Product reference
638
+ * @example prd_1A2B3C4D
639
+ */
640
+ reference: string;
641
+ /**
642
+ * Product name
643
+ * @example AI Writing Assistant
644
+ */
645
+ name: string;
646
+ /** @description Product description */
647
+ description?: string;
648
+ /** @description URL to the product image */
649
+ imageUrl?: string;
650
+ /** @description Free-form product type */
651
+ productType?: string;
652
+ /**
653
+ * Product status
654
+ * @example active
655
+ */
656
+ status: string;
657
+ /**
658
+ * Product balance in cents
659
+ * @example 0
660
+ */
661
+ balance: number;
662
+ /**
663
+ * Total number of transactions
664
+ * @example 0
665
+ */
666
+ totalTransactions: number;
667
+ /**
668
+ * Whether this product uses MCP Pay proxy
669
+ * @example false
670
+ */
671
+ isMcpPay: boolean;
672
+ /** @description Product-specific configuration */
673
+ config?: components["schemas"]["ProductConfigDto"];
674
+ /** @description Arbitrary key-value metadata */
675
+ metadata?: {
676
+ [key: string]: unknown;
677
+ };
678
+ /** @description Creation timestamp */
679
+ createdAt: string;
680
+ /** @description Last update timestamp */
681
+ updatedAt: string;
682
+ /** @description Plans associated with this product */
683
+ plans?: components["schemas"]["SdkPlanResponse"][];
684
+ /**
685
+ * MCP linkage details for MCP-enabled products
686
+ * @example {
687
+ * "mcpServerId": "67f90f1f1b1c9c0b8df0f111",
688
+ * "mcpServerReference": "mcp_ABC123",
689
+ * "mcpSubdomain": "acme-docs",
690
+ * "mcpProxyUrl": "https://acme-docs.mcp.solvapay.com/mcp",
691
+ * "originUrl": "https://origin.example.com/mcp",
692
+ * "defaultPlanId": "67f90f1f1b1c9c0b8df0f001"
693
+ * }
694
+ */
695
+ mcp?: {
696
+ [key: string]: unknown;
697
+ };
698
+ };
699
+ UpdateProductRequest: {
700
+ /** @description Product name */
701
+ name?: string;
702
+ /** @description Product description */
703
+ description?: string;
704
+ /** @description URL to the product image */
705
+ imageUrl?: string;
706
+ /** @description Free-form product type defined by the provider */
707
+ productType?: string;
708
+ /**
709
+ * Product status
710
+ * @enum {string}
711
+ */
712
+ status?: "active" | "inactive" | "suspended";
713
+ /** @description Product-specific configuration */
714
+ config?: components["schemas"]["ProductConfigDto"];
715
+ /** @description Arbitrary key-value metadata */
716
+ metadata?: {
717
+ [key: string]: unknown;
718
+ };
719
+ };
720
+ McpBootstrapFreePlanConfig: {
721
+ /**
722
+ * Free plan display name override
723
+ * @example Starter
724
+ */
725
+ name?: string;
726
+ /**
727
+ * Included free units (default 1000)
728
+ * @example 500
729
+ */
730
+ freeUnits?: number;
731
+ };
732
+ McpBootstrapPaidPlanInput: {
733
+ /**
734
+ * Logical plan key (must not be "free")
735
+ * @example pro
736
+ */
737
+ key: string;
738
+ /**
739
+ * Plan display name
740
+ * @example Pro
741
+ */
742
+ name: string;
743
+ /**
744
+ * Plan price in cents (must be > 0)
745
+ * @example 2000
746
+ */
747
+ price: number;
748
+ /**
749
+ * Currency code (ISO 4217)
750
+ * @example USD
751
+ */
752
+ currency: string;
753
+ /**
754
+ * Billing cycle for recurring plans
755
+ * @example monthly
756
+ * @enum {string}
757
+ */
758
+ billingCycle?: "weekly" | "monthly" | "quarterly" | "yearly" | "custom";
759
+ /**
760
+ * Plan type
761
+ * @example recurring
762
+ * @enum {string}
763
+ */
764
+ type?: "recurring" | "one-time";
765
+ /**
766
+ * Included free units
767
+ * @example 1000
768
+ */
769
+ freeUnits?: number;
770
+ /**
771
+ * Meter id for usage tracking
772
+ * @example 67f90f1f1b1c9c0b8df0f001
773
+ */
774
+ meterId?: string;
775
+ /**
776
+ * Plan usage limit
777
+ * @example 10000
778
+ */
779
+ limit?: number;
780
+ /** @description Plan features */
781
+ features?: {
782
+ [key: string]: unknown;
783
+ };
784
+ };
785
+ McpBootstrapToolInput: {
786
+ /**
787
+ * Tool name
788
+ * @example search_docs
789
+ */
790
+ name: string;
791
+ /**
792
+ * Tool description
793
+ * @example Search indexed documents
794
+ */
795
+ description?: string;
796
+ /**
797
+ * If true, tool is publicly available without a plan
798
+ * @example false
799
+ */
800
+ noPlan?: boolean;
801
+ /**
802
+ * Direct plan IDs allowed for this tool
803
+ * @example [
804
+ * "67f90f1f1b1c9c0b8df0f001"
805
+ * ]
806
+ */
807
+ planIds?: string[];
808
+ /**
809
+ * Plan references allowed for this tool
810
+ * @example [
811
+ * "pln_ABC123"
812
+ * ]
813
+ */
814
+ planRefs?: string[];
815
+ /**
816
+ * Bootstrap plan keys allowed for this tool (for example free or starter_paid)
817
+ * @example [
818
+ * "free"
819
+ * ]
820
+ */
821
+ planKeys?: string[];
822
+ };
823
+ McpBootstrapRequest: {
824
+ /**
825
+ * Product name (optional when derivable from origin MCP metadata)
826
+ * @example Acme MCP Toolkit
827
+ */
828
+ name?: string;
829
+ /**
830
+ * Product description
831
+ * @example MCP toolkit with tiered access
832
+ */
833
+ description?: string;
834
+ /** @description Product image URL */
835
+ imageUrl?: string;
836
+ /**
837
+ * Free-form product type
838
+ * @example MCP Server
839
+ */
840
+ productType?: string;
841
+ /**
842
+ * Origin MCP server URL (must be https)
843
+ * @example https://origin.example.com/mcp
844
+ */
845
+ originUrl: string;
846
+ /**
847
+ * Domain slug input for MCP server name/subdomain normalization
848
+ * @example acme-docs
849
+ */
850
+ mcpDomain?: string;
851
+ /**
852
+ * Optional auth header name forwarded to origin server
853
+ * @example X-API-Key
854
+ */
855
+ authHeaderName?: string;
856
+ /**
857
+ * Optional auth API key forwarded to origin server
858
+ * @example sk-origin-123
859
+ */
860
+ authApiKey?: string;
861
+ /** @description Free plan config overrides. A free plan is always created; this just customizes name/freeUnits. */
862
+ freePlan?: components["schemas"]["McpBootstrapFreePlanConfig"];
863
+ /** @description Paid plan definitions requiring price + currency */
864
+ paidPlans?: components["schemas"]["McpBootstrapPaidPlanInput"][];
865
+ /** @description Tool to plan mapping configuration */
866
+ tools?: components["schemas"]["McpBootstrapToolInput"][];
867
+ /** @description Arbitrary product metadata */
868
+ metadata?: {
869
+ [key: string]: unknown;
870
+ };
871
+ };
872
+ McpBootstrapResult: {
873
+ /** @description Created product */
874
+ product: components["schemas"]["SdkProductResponse"];
875
+ /**
876
+ * Created or updated MCP server identity
877
+ * @example {
878
+ * "id": "67f90f1f1b1c9c0b8df0f111",
879
+ * "reference": "mcp_ABC123",
880
+ * "subdomain": "acme-docs",
881
+ * "mcpProxyUrl": "https://acme-docs.mcp.solvapay.com/mcp",
882
+ * "url": "https://origin.example.com/mcp",
883
+ * "defaultPlanId": "67f90f1f1b1c9c0b8df0f001"
884
+ * }
885
+ */
886
+ mcpServer: {
887
+ [key: string]: unknown;
888
+ };
889
+ /**
890
+ * Resolved plan mapping by bootstrap key
891
+ * @example {
892
+ * "free": {
893
+ * "id": "67f90f1f1b1c9c0b8df0f001",
894
+ * "reference": "pln_FREE123",
895
+ * "name": "Free"
896
+ * }
897
+ * }
898
+ */
899
+ planMap: {
900
+ [key: string]: unknown;
901
+ };
902
+ /**
903
+ * True when tools were auto-discovered from origin because the request omitted tools
904
+ * @example true
905
+ */
906
+ toolsAutoMapped?: boolean;
907
+ /** @description Auto-discovered tools used during bootstrap */
908
+ autoMappedTools?: {
909
+ name?: string;
910
+ description?: string;
911
+ }[];
912
+ };
913
+ McpBootstrapPreviewResult: {
914
+ /** @description Discovered tools from the origin MCP server */
915
+ discoveredTools: {
916
+ name?: string;
917
+ description?: string;
918
+ }[];
919
+ /** @description Validation status for the provided bootstrap payload */
920
+ validation: {
921
+ valid?: boolean;
922
+ errors?: components["schemas"]["McpBootstrapPreviewValidationError"][];
923
+ };
924
+ /**
925
+ * Product name derived from origin MCP metadata or hostname fallback
926
+ * @example acme-origin-mcp
927
+ */
928
+ derivedName?: string;
929
+ /**
930
+ * Product description derived from origin server instructions
931
+ * @example MCP toolkit for document retrieval and summarization.
932
+ */
933
+ derivedDescription?: string;
934
+ /** @description Source of derived metadata */
935
+ metadataSource: {
936
+ /** @enum {string} */
937
+ name?: "request" | "origin" | "hostname";
938
+ /** @enum {string} */
939
+ description?: "request" | "instructions" | "none";
940
+ };
941
+ /** @description Suggested default tool-to-plan mapping for UI review */
942
+ suggestedMapping: {
943
+ name?: string;
944
+ description?: string;
945
+ planKey?: string;
946
+ }[];
947
+ };
948
+ RecordMeterEventDto: {
949
+ /**
950
+ * Meter name to record against
951
+ * @example requests
952
+ */
953
+ meterName: string;
954
+ /**
955
+ * Customer reference
956
+ * @example cus_ABC123
957
+ */
958
+ customerId: string;
959
+ /**
960
+ * Numeric value (default 1)
961
+ * @default 1
962
+ * @example 1
963
+ */
964
+ value: number;
965
+ /**
966
+ * Arbitrary key-value tags
967
+ * @example {
968
+ * "endpoint": "/api/v1/search",
969
+ * "region": "us-east-1"
970
+ * }
971
+ */
972
+ properties?: {
973
+ [key: string]: unknown;
974
+ };
975
+ /** @description Product ID to scope the usage event to */
976
+ productId?: string;
977
+ /** @description Product reference to scope the usage event to */
978
+ productReference?: string;
979
+ /** @description ISO 8601 timestamp (defaults to now) */
980
+ timestamp?: string;
981
+ };
982
+ RecordBulkMeterEventsDto: {
983
+ /** @description Array of events to record */
984
+ events: components["schemas"]["RecordMeterEventDto"][];
985
+ };
986
+ CreateCustomerSessionRequest: {
987
+ /**
988
+ * Customer reference identifier
989
+ * @example cus_3c4d5e6f7g8h
990
+ */
991
+ customerRef: string;
992
+ /**
993
+ * Optional product reference or ID to scope the customer manage page to a single product.
994
+ * @example prd_1a2b3c4d5e6f
995
+ */
996
+ productRef?: string;
997
+ };
998
+ CustomerSessionResponse: {
999
+ /**
1000
+ * Customer session ID
1001
+ * @example 507f1f77bcf86cd799439011
1002
+ */
1003
+ id: string;
1004
+ /**
1005
+ * Public session ID used in customer URL
1006
+ * @example e3f1c2d4b6a89f001122334455667788
1007
+ */
1008
+ sessionId: string;
291
1009
  /**
292
1010
  * Session status
293
1011
  * @example active
294
1012
  */
295
1013
  status: string;
296
1014
  /**
297
- * Checkout URL to open the checkout page
298
- * @example https://solvapay.com/customer/checkout?id=a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6
1015
+ * Customer URL to open the customer page
1016
+ * @example https://solvapay.com/customer/manage?id=e3f1c2d4b6a89f001122334455667788
299
1017
  */
300
- checkoutUrl: string;
1018
+ customerUrl: string;
301
1019
  };
302
- CancelRenewalRequest: Record<string, never>;
303
- UpdateConnectedAccount: Record<string, never>;
304
- CancelPurchaseRequest: {
305
- /** Reason for cancellation */
306
- reason?: string;
1020
+ CreateCustomerRequest: {
1021
+ /**
1022
+ * Customer email address (required)
1023
+ * @example customer@example.com
1024
+ */
1025
+ email: string;
1026
+ /**
1027
+ * Customer full name (optional)
1028
+ * @example John Doe
1029
+ */
1030
+ name?: string;
1031
+ /**
1032
+ * External reference ID from your auth system to map this customer to an auth user (optional)
1033
+ * @example auth_user_12345
1034
+ */
1035
+ externalRef?: string;
307
1036
  };
308
- CheckLimitRequest: {
1037
+ PurchaseInfo: {
1038
+ /**
1039
+ * Purchase reference
1040
+ * @example pur_1A2B3C4D
1041
+ */
1042
+ reference: string;
1043
+ /**
1044
+ * Product name
1045
+ * @example API Gateway Manager
1046
+ */
1047
+ productName: string;
1048
+ /**
1049
+ * Product reference
1050
+ * @example prd_abc123
1051
+ */
1052
+ productReference?: string;
1053
+ /**
1054
+ * Purchase status
1055
+ * @example active
1056
+ */
1057
+ status: string;
1058
+ /**
1059
+ * Start date
1060
+ * @example 2025-10-27T10:00:00Z
1061
+ */
1062
+ startDate: string;
1063
+ /**
1064
+ * Amount paid in original currency (in cents)
1065
+ * @example 9900
1066
+ */
1067
+ amount: number;
1068
+ /**
1069
+ * Currency code
1070
+ * @example USD
1071
+ */
1072
+ currency: string;
1073
+ /**
1074
+ * End date of purchase
1075
+ * @example 2025-11-27T10:00:00Z
1076
+ */
1077
+ endDate?: string;
1078
+ /**
1079
+ * When purchase was cancelled
1080
+ * @example 2025-10-28T10:00:00Z
1081
+ */
1082
+ cancelledAt?: string;
1083
+ /**
1084
+ * Reason for cancellation
1085
+ * @example Customer request
1086
+ */
1087
+ cancellationReason?: string;
1088
+ /** @description Snapshot of the plan at time of purchase */
1089
+ planSnapshot?: Record<string, never>;
1090
+ };
1091
+ CustomerResponse: {
309
1092
  /**
310
1093
  * Customer reference identifier
1094
+ * @example cus_3c4d5e6f7g8h
1095
+ */
1096
+ reference: string;
1097
+ /**
1098
+ * Customer full name
1099
+ * @example John Doe
1100
+ */
1101
+ name: string;
1102
+ /**
1103
+ * Customer email address
1104
+ * @example customer@example.com
1105
+ */
1106
+ email: string;
1107
+ /**
1108
+ * External reference ID from your auth system (if set during creation or update)
1109
+ * @example auth_user_12345
1110
+ */
1111
+ externalRef?: string;
1112
+ /** @description Active purchases */
1113
+ purchases?: components["schemas"]["PurchaseInfo"][];
1114
+ };
1115
+ CreateCustomerSessionResponse: {
1116
+ /**
1117
+ * Customer session ID/token
1118
+ * @example e3f1c2d4b6a89f001122334455667788
1119
+ */
1120
+ sessionId: string;
1121
+ /**
1122
+ * Full customer URL based on backend configuration (ready to redirect customer)
1123
+ * @example https://solvapay.com/customer/manage?id=e3f1c2d4b6a89f001122334455667788
1124
+ */
1125
+ customerUrl: string;
1126
+ };
1127
+ GetCustomerSessionResponse: {
1128
+ /**
1129
+ * Customer session ID/token
1130
+ * @example e3f1c2d4b6a89f001122334455667788
1131
+ */
1132
+ sessionId: string;
1133
+ /**
1134
+ * Session status
1135
+ * @example active
1136
+ * @enum {string}
1137
+ */
1138
+ status: "active" | "expired" | "used";
1139
+ /**
1140
+ * Full customer URL based on backend configuration (ready to redirect customer)
1141
+ * @example https://solvapay.com/customer/manage?id=e3f1c2d4b6a89f001122334455667788
1142
+ */
1143
+ customerUrl: string;
1144
+ /**
1145
+ * Session expiration date
1146
+ * @example 2025-01-01T12:00:00.000Z
1147
+ */
1148
+ expiresAt: string;
1149
+ /** @description Customer object from session data */
1150
+ customer: components["schemas"]["CustomerResponse"];
1151
+ /**
1152
+ * Session creation date
1153
+ * @example 2025-01-01T11:45:00.000Z
1154
+ */
1155
+ createdAt: string;
1156
+ /**
1157
+ * Session last update date
1158
+ * @example 2025-01-01T11:45:00.000Z
1159
+ */
1160
+ updatedAt: string;
1161
+ };
1162
+ UserInfoRequest: {
1163
+ /**
1164
+ * Customer reference
311
1165
  * @example cus_3C4D5E6F
312
1166
  */
313
1167
  customerRef: string;
314
1168
  /**
315
- * Product reference identifier
1169
+ * Product reference
316
1170
  * @example prd_1A2B3C4D
317
1171
  */
318
1172
  productRef: string;
319
1173
  };
320
- LimitResponse: {
1174
+ UserInfoUserDto: {
1175
+ /** @example cus_3C4D5E6F */
1176
+ reference: string;
1177
+ /** @example John Doe */
1178
+ name?: string | null;
1179
+ /** @example john@example.com */
1180
+ email: string;
1181
+ /** @example auth_user_12345 */
1182
+ externalRef?: string | null;
1183
+ };
1184
+ UserInfoUsageDto: {
1185
+ /** @example 1000 */
1186
+ total: number;
1187
+ /** @example 250 */
1188
+ used: number;
1189
+ /** @example 750 */
1190
+ remaining: number;
321
1191
  /**
322
- * Whether the customer is within their usage limits
1192
+ * Meter ObjectId reference
1193
+ * @example 507f1f77bcf86cd799439011
1194
+ */
1195
+ meterId?: string;
1196
+ /** @example 25 */
1197
+ percentUsed?: number | null;
1198
+ };
1199
+ UserInfoPlanDto: {
1200
+ /** @example pln_2B3C4D5E */
1201
+ reference: string;
1202
+ /**
1203
+ * Price in minor currency units (e.g. cents)
1204
+ * @example 2999
1205
+ */
1206
+ price: number;
1207
+ /** @example USD */
1208
+ currency: string;
1209
+ /** @example recurring */
1210
+ type: string;
1211
+ /** @example monthly */
1212
+ billingCycle?: string | null;
1213
+ features?: string[] | null;
1214
+ limits?: {
1215
+ [key: string]: unknown;
1216
+ } | null;
1217
+ };
1218
+ UserInfoPurchaseDto: {
1219
+ /** @example pur_1A2B3C4D */
1220
+ reference: string;
1221
+ /** @example active */
1222
+ status: string;
1223
+ /** @example My API Product */
1224
+ productName: string;
1225
+ /** @example recurring */
1226
+ planType: string;
1227
+ /** @example 2025-10-27T10:00:00Z */
1228
+ startDate?: string | null;
1229
+ /** @example 2025-11-27T10:00:00Z */
1230
+ endDate?: string | null;
1231
+ usage?: components["schemas"]["UserInfoUsageDto"];
1232
+ plan?: components["schemas"]["UserInfoPlanDto"];
1233
+ };
1234
+ UserInfoResponse: {
1235
+ /**
1236
+ * Human-readable status summary
1237
+ * @example Active subscription: My API Product (25% usage consumed)
1238
+ */
1239
+ status: string;
1240
+ /**
1241
+ * Customer portal session URL
1242
+ * @example https://solvapay.com/customer/manage?id=abc123
1243
+ */
1244
+ verifyUrl?: string | null;
1245
+ user?: components["schemas"]["UserInfoUserDto"];
1246
+ purchase?: components["schemas"]["UserInfoPurchaseDto"];
1247
+ };
1248
+ McpToolDto: {
1249
+ /**
1250
+ * Tool name
1251
+ * @example search_documents
1252
+ */
1253
+ name: string;
1254
+ /**
1255
+ * Plan IDs that grant access to this tool
1256
+ * @example [
1257
+ * "pln_abc123"
1258
+ * ]
1259
+ */
1260
+ planIds?: string[];
1261
+ /**
1262
+ * If true, the tool is unprotected (no purchase check or usage tracking)
1263
+ * @example false
1264
+ */
1265
+ noPlan?: boolean;
1266
+ /**
1267
+ * Human-readable tool description
1268
+ * @example Search indexed documents
1269
+ */
1270
+ description?: string;
1271
+ /**
1272
+ * Whether this is a virtual platform tool handled by SolvaPay
1273
+ * @example false
1274
+ */
1275
+ isVirtual?: boolean;
1276
+ };
1277
+ McpServerDto: {
1278
+ /**
1279
+ * Server ID
1280
+ * @example 507f1f77bcf86cd799439011
1281
+ */
1282
+ id?: string;
1283
+ /**
1284
+ * Unique server reference
1285
+ * @example mcp_abc123
1286
+ */
1287
+ reference?: string;
1288
+ /**
1289
+ * Domain slug used to derive the MCP endpoint subdomain
1290
+ * @example my-mcp-server
1291
+ */
1292
+ name: string;
1293
+ /**
1294
+ * URL-safe subdomain derived from name
1295
+ * @example my-mcp-server
1296
+ */
1297
+ subdomain: string;
1298
+ /**
1299
+ * SolvaPay proxy URL that MCP clients connect to
1300
+ * @example https://mytelescope.mcp.solvapay.com/mcp
1301
+ */
1302
+ mcpProxyUrl?: string;
1303
+ /**
1304
+ * Origin URL of the actual MCP server
1305
+ * @example https://origin.example.com/mcp
1306
+ */
1307
+ url: string;
1308
+ /**
1309
+ * Avatar image URL
1310
+ * @example https://example.com/avatar.png
1311
+ */
1312
+ avatarUrl?: string;
1313
+ /** @description Registered tools for this server */
1314
+ tools?: components["schemas"]["McpToolDto"][];
1315
+ /**
1316
+ * Default plan ID for tool access gating. Must belong to the linked product and be a free-tier plan (isFreeTier=true or price=0).
1317
+ * @example pln_default
1318
+ */
1319
+ defaultPlanId?: string;
1320
+ /**
1321
+ * Associated product ID
1322
+ * @example 507f1f77bcf86cd799439011
1323
+ */
1324
+ productId?: string;
1325
+ /**
1326
+ * Server status
1327
+ * @example active
1328
+ * @enum {string}
1329
+ */
1330
+ status?: "active" | "inactive" | "suspended";
1331
+ /**
1332
+ * Provider ID that owns this server
1333
+ * @example 507f1f77bcf86cd799439011
1334
+ */
1335
+ providerId: string;
1336
+ /**
1337
+ * Custom auth header name for origin requests
1338
+ * @example X-API-Key
1339
+ */
1340
+ authHeaderName?: string;
1341
+ /**
1342
+ * Whether an auth API key is configured
323
1343
  * @example true
324
1344
  */
325
- withinLimits: boolean;
1345
+ hasAuthApiKey?: boolean;
1346
+ /**
1347
+ * Total number of tool-call transactions
1348
+ * @example 42
1349
+ */
1350
+ totalTransactions?: number;
1351
+ /**
1352
+ * Current balance in cents
1353
+ * @example 1500
1354
+ */
1355
+ balance?: number;
1356
+ };
1357
+ PlanSnapshotDto: {
1358
+ /**
1359
+ * Plan reference
1360
+ * @example pln_1A2B3C4D
1361
+ */
1362
+ reference?: string;
1363
+ /**
1364
+ * Plan price in cents
1365
+ * @example 2999
1366
+ */
1367
+ price: number;
1368
+ /**
1369
+ * Currency code
1370
+ * @example USD
1371
+ */
1372
+ currency: string;
1373
+ /**
1374
+ * Plan type
1375
+ * @example recurring
1376
+ */
1377
+ planType: string;
1378
+ /**
1379
+ * Billing cycle
1380
+ * @example monthly
1381
+ */
1382
+ billingCycle?: string | null;
1383
+ /** @description Plan features */
1384
+ features?: {
1385
+ [key: string]: unknown;
1386
+ } | null;
1387
+ /** @description Usage limits */
1388
+ limits?: {
1389
+ [key: string]: unknown;
1390
+ } | null;
1391
+ /**
1392
+ * Meter ObjectId reference
1393
+ * @example 507f1f77bcf86cd799439011
1394
+ */
1395
+ meterId?: string;
326
1396
  /**
327
- * Remaining usage units before hitting the limit
328
- * @example 997
1397
+ * Usage limit for the meter
1398
+ * @example 5000
329
1399
  */
330
- remaining: number;
1400
+ limit?: number;
331
1401
  /**
332
- * Checkout session ID if payment is required
333
- * @example e3f1c2d4b6a89f001122334455667788
1402
+ * Number of free units included
1403
+ * @example 100
334
1404
  */
335
- checkoutSessionId?: string;
1405
+ freeUnits?: number;
336
1406
  /**
337
- * Checkout URL if payment is required
338
- * @example https://solvapay.com/customer/checkout?id=e3f1c2d4b6a89f001122334455667788
1407
+ * Price per usage unit in cents
1408
+ * @example 10
339
1409
  */
340
- checkoutUrl?: string;
1410
+ pricePerUnit?: number;
341
1411
  };
342
- CreateCustomerSessionRequest: {
1412
+ UsageBillingDto: {
343
1413
  /**
344
- * Customer reference identifier
345
- * @example cus_3c4d5e6f7g8h
1414
+ * Units consumed in current period
1415
+ * @example 150
346
1416
  */
347
- customerRef: string;
348
- };
349
- CustomerSessionResponse: {
1417
+ used: number;
350
1418
  /**
351
- * Customer session ID
352
- * @example 507f1f77bcf86cd799439011
1419
+ * Units exceeding the plan limit
1420
+ * @example 0
353
1421
  */
354
- id: string;
1422
+ overageUnits: number;
355
1423
  /**
356
- * Public session ID used in customer URL
357
- * @example e3f1c2d4b6a89f001122334455667788
1424
+ * Overage cost in cents
1425
+ * @example 0
358
1426
  */
359
- sessionId: string;
1427
+ overageCost: number;
360
1428
  /**
361
- * Session status
362
- * @example active
1429
+ * Period start date
1430
+ * @example 2025-10-01T00:00:00Z
363
1431
  */
364
- status: string;
1432
+ periodStart?: string;
365
1433
  /**
366
- * Customer URL to open the customer page
367
- * @example https://solvapay.com/customer/manage?id=e3f1c2d4b6a89f001122334455667788
1434
+ * Period end date
1435
+ * @example 2025-11-01T00:00:00Z
368
1436
  */
369
- customerUrl: string;
1437
+ periodEnd?: string;
370
1438
  };
371
- CreateCustomerRequest: {
1439
+ PurchaseResponse: {
372
1440
  /**
373
- * Customer email address (required)
374
- * @example customer@example.com
1441
+ * Purchase ID
1442
+ * @example 507f1f77bcf86cd799439011
375
1443
  */
376
- email: string;
1444
+ id: string;
377
1445
  /**
378
- * Customer full name (optional)
379
- * @example John Doe
1446
+ * Purchase reference
1447
+ * @example pur_1A2B3C4D
380
1448
  */
381
- name?: string;
1449
+ reference: string;
382
1450
  /**
383
- * External reference ID from your auth system to map this customer to an auth user (optional)
384
- * @example auth_user_12345
1451
+ * Customer reference
1452
+ * @example cus_3C4D5E6F
385
1453
  */
386
- externalRef?: string;
387
- };
388
- PurchaseInfo: {
1454
+ customerRef: string;
389
1455
  /**
390
- * Purchase reference
391
- * @example sub_abc123
1456
+ * Customer email
1457
+ * @example customer@example.com
392
1458
  */
393
- reference: string;
1459
+ customerEmail: string;
394
1460
  /**
395
- * Plan name
396
- * @example Pro Plan
1461
+ * Product reference
1462
+ * @example prd_1A2B3C4D
397
1463
  */
398
- planName: string;
1464
+ productRef: string;
399
1465
  /**
400
- * Product reference
401
- * @example prd_abc123
1466
+ * Product ID
1467
+ * @example 507f1f77bcf86cd799439012
402
1468
  */
403
- productReference?: string;
1469
+ productId?: string;
1470
+ /**
1471
+ * Product name
1472
+ * @example API Gateway Manager
1473
+ */
1474
+ productName?: string;
1475
+ /** @description Plan snapshot at time of purchase */
1476
+ planSnapshot: components["schemas"]["PlanSnapshotDto"];
404
1477
  /**
405
1478
  * Purchase status
406
1479
  * @example active
407
1480
  */
408
1481
  status: string;
409
1482
  /**
410
- * Start date
411
- * @example 2025-10-27T10:00:00Z
412
- */
413
- startDate: string;
414
- /**
415
- * Amount paid in original currency (in cents)
1483
+ * Amount in cents
416
1484
  * @example 9900
417
1485
  */
418
1486
  amount: number;
@@ -421,92 +1489,94 @@ interface components {
421
1489
  * @example USD
422
1490
  */
423
1491
  currency: string;
424
- /**
425
- * End date of purchase
426
- * @example 2025-11-27T10:00:00Z
427
- */
1492
+ /** @description Start date */
1493
+ startDate: string;
1494
+ /** @description End date */
428
1495
  endDate?: string;
1496
+ /** @description Paid at timestamp */
1497
+ paidAt?: string;
1498
+ /** @description Usage billing state for usage-based plans */
1499
+ usage?: components["schemas"]["UsageBillingDto"];
429
1500
  /**
430
- * When purchase was cancelled
431
- * @example 2025-10-28T10:00:00Z
1501
+ * Is recurring
1502
+ * @example true
432
1503
  */
433
- cancelledAt?: string;
1504
+ isRecurring: boolean;
434
1505
  /**
435
- * Reason for cancellation
436
- * @example Customer request
1506
+ * Billing cycle
1507
+ * @enum {string}
437
1508
  */
1509
+ billingCycle?: "weekly" | "monthly" | "quarterly" | "yearly";
1510
+ /** @description Next billing date */
1511
+ nextBillingDate?: string;
1512
+ /** @description Auto-renew enabled */
1513
+ autoRenew?: boolean;
1514
+ /** @description Whether this is a free tier purchase */
1515
+ isFreeTier?: boolean;
1516
+ /** @description Cancelled at */
1517
+ cancelledAt?: string;
1518
+ /** @description Cancellation reason */
438
1519
  cancellationReason?: string;
1520
+ /** @description Created at */
1521
+ createdAt: string;
439
1522
  };
440
- CustomerResponse: {
1523
+ CancelPurchaseRequest: {
1524
+ /** @description Reason for cancellation */
1525
+ reason?: string;
1526
+ };
1527
+ CheckLimitRequest: {
441
1528
  /**
442
1529
  * Customer reference identifier
443
- * @example cus_3c4d5e6f7g8h
444
- */
445
- reference: string;
446
- /**
447
- * Customer full name
448
- * @example John Doe
1530
+ * @example cus_3C4D5E6F
449
1531
  */
450
- name: string;
1532
+ customerRef: string;
451
1533
  /**
452
- * Customer email address
453
- * @example customer@example.com
1534
+ * Product reference identifier
1535
+ * @example prd_1A2B3C4D
454
1536
  */
455
- email: string;
1537
+ productRef: string;
456
1538
  /**
457
- * External reference ID from your auth system (if set during creation or update)
458
- * @example auth_user_12345
1539
+ * Plan reference to pre-select when creating a checkout session. If provided and the customer needs to purchase, the checkout page skips plan selection and shows the payment form directly.
1540
+ * @example pln_2B3C4D5E
459
1541
  */
460
- externalRef?: string;
461
- /** Active purchases */
462
- purchases?: components["schemas"]["PurchaseInfo"][];
463
- };
464
- CreateCustomerSessionResponse: {
1542
+ planRef?: string;
465
1543
  /**
466
- * Customer session ID/token
467
- * @example e3f1c2d4b6a89f001122334455667788
1544
+ * Canonical usage meter name used for limit checks (for example: requests, tokens).
1545
+ * @example requests
468
1546
  */
469
- sessionId: string;
1547
+ meterName?: string;
470
1548
  /**
471
- * Full customer URL based on backend configuration (ready to redirect customer)
472
- * @example https://solvapay.com/customer/manage?id=e3f1c2d4b6a89f001122334455667788
1549
+ * Usage type alias for meterName. If both are provided, meterName takes precedence.
1550
+ * @example requests
473
1551
  */
474
- customerUrl: string;
1552
+ usageType?: string;
475
1553
  };
476
- GetCustomerSessionResponse: {
477
- /**
478
- * Customer session ID/token
479
- * @example e3f1c2d4b6a89f001122334455667788
480
- */
481
- sessionId: string;
1554
+ LimitResponse: {
482
1555
  /**
483
- * Session status
484
- * @example active
485
- * @enum {string}
1556
+ * Whether the customer is within their usage limits
1557
+ * @example true
486
1558
  */
487
- status: "active" | "expired" | "used";
1559
+ withinLimits: boolean;
488
1560
  /**
489
- * Full customer URL based on backend configuration (ready to redirect customer)
490
- * @example https://solvapay.com/customer/manage?id=e3f1c2d4b6a89f001122334455667788
1561
+ * Remaining usage units before hitting the limit
1562
+ * @example 997
491
1563
  */
492
- customerUrl: string;
1564
+ remaining: number;
493
1565
  /**
494
- * Session expiration date
495
- * @example 2025-01-01T12:00:00.000Z
1566
+ * Checkout session ID if payment is required
1567
+ * @example e3f1c2d4b6a89f001122334455667788
496
1568
  */
497
- expiresAt: string;
498
- /** Customer object from session data */
499
- customer: components["schemas"]["CustomerResponse"];
1569
+ checkoutSessionId?: string;
500
1570
  /**
501
- * Session creation date
502
- * @example 2025-01-01T11:45:00.000Z
1571
+ * Checkout URL if payment is required
1572
+ * @example https://solvapay.com/customer/checkout?id=e3f1c2d4b6a89f001122334455667788
503
1573
  */
504
- createdAt: string;
1574
+ checkoutUrl?: string;
505
1575
  /**
506
- * Session last update date
507
- * @example 2025-01-01T11:45:00.000Z
1576
+ * The meter name to use when tracking usage events
1577
+ * @example requests
508
1578
  */
509
- updatedAt: string;
1579
+ meterName?: string;
510
1580
  };
511
1581
  DynamicClientRegistrationDto: {
512
1582
  /** @example My AI Agent */
@@ -579,19 +1649,19 @@ interface components {
579
1649
  token_endpoint_auth_method: string;
580
1650
  };
581
1651
  GoogleLoginDto: {
582
- /** The authorization code returned by Google */
1652
+ /** @description The authorization code returned by Google */
583
1653
  code: string;
584
- /** The redirect URI used in the initial authorization request */
1654
+ /** @description The redirect URI used in the initial authorization request */
585
1655
  redirect_uri: string;
586
- /** The state parameter returned by Google (contains client_id) */
1656
+ /** @description The state parameter returned by Google (contains client_id) */
587
1657
  state: string;
588
1658
  };
589
1659
  GithubLoginDto: {
590
- /** The authorization code returned by GitHub */
1660
+ /** @description The authorization code returned by GitHub */
591
1661
  code: string;
592
- /** The redirect URI used in the initial authorization request */
1662
+ /** @description The redirect URI used in the initial authorization request */
593
1663
  redirect_uri: string;
594
- /** The state parameter returned by GitHub (contains client_id) */
1664
+ /** @description The state parameter returned by GitHub (contains client_id) */
595
1665
  state: string;
596
1666
  };
597
1667
  ExecuteAnalyticsQuery: Record<string, never>;
@@ -627,12 +1697,17 @@ interface components {
627
1697
  secondary?: string;
628
1698
  };
629
1699
  ThemeOverridesDto: {
630
- /** Light mode color overrides */
1700
+ /** @description Light mode color overrides */
631
1701
  light?: components["schemas"]["ThemeModeColorsDto"];
632
- /** Dark mode color overrides */
1702
+ /** @description Dark mode color overrides */
633
1703
  dark?: components["schemas"]["ThemeModeColorsDto"];
634
1704
  };
635
1705
  UpdateBrandThemeDto: {
1706
+ /**
1707
+ * Logo image URL displayed in hosted page headers
1708
+ * @example /ui/files/download/provider-assets/provider-123/logos/logo.png
1709
+ */
1710
+ logo?: string;
636
1711
  /**
637
1712
  * Provider's brand name displayed on hosted pages
638
1713
  * @example Acme Corp
@@ -655,11 +1730,33 @@ interface components {
655
1730
  * @example 16px
656
1731
  */
657
1732
  fontSize: string;
658
- /** Per-mode color overrides for light and dark themes */
1733
+ /** @description Per-mode color overrides for light and dark themes */
659
1734
  themes?: components["schemas"]["ThemeOverridesDto"];
660
1735
  };
661
- CreateWebhookEndpointDto: Record<string, never>;
662
- UpdateWebhookEndpointDto: Record<string, never>;
1736
+ CreateWebhookEndpointDto: {
1737
+ /**
1738
+ * Webhook endpoint URL
1739
+ * @example https://example.com/webhook
1740
+ */
1741
+ url: string;
1742
+ /**
1743
+ * Webhook endpoint description
1744
+ * @example Production webhook
1745
+ */
1746
+ description?: string;
1747
+ };
1748
+ UpdateWebhookEndpointDto: {
1749
+ /**
1750
+ * Webhook endpoint URL
1751
+ * @example https://example.com/webhook
1752
+ */
1753
+ url?: string;
1754
+ /**
1755
+ * Webhook endpoint description
1756
+ * @example Updated webhook
1757
+ */
1758
+ description?: string;
1759
+ };
663
1760
  CreatePreregistrationDto: {
664
1761
  /** @example jane@company.com */
665
1762
  email: string;
@@ -675,6 +1772,10 @@ interface components {
675
1772
  [key: string]: string;
676
1773
  };
677
1774
  };
1775
+ /** @description Auto-generated fallback schema for unresolved reference: McpBootstrapPreviewValidationError */
1776
+ McpBootstrapPreviewValidationError: {
1777
+ [key: string]: unknown;
1778
+ };
678
1779
  };
679
1780
  responses: never;
680
1781
  parameters: never;
@@ -689,11 +1790,17 @@ interface components {
689
1790
  * Types related to the SolvaPay API client and backend communication.
690
1791
  */
691
1792
 
1793
+ type UsageMeterType = 'requests' | 'tokens';
1794
+ type CheckLimitsRequest = components['schemas']['CheckLimitRequest'] & {
1795
+ meterName?: string;
1796
+ usageType?: UsageMeterType;
1797
+ };
692
1798
  /**
693
1799
  * Extended LimitResponse with plan field
694
1800
  */
695
1801
  type LimitResponseWithPlan = components['schemas']['LimitResponse'] & {
696
1802
  plan: string;
1803
+ meterName?: string;
697
1804
  };
698
1805
  /**
699
1806
  * Extended CustomerResponse with proper field mapping
@@ -732,6 +1839,67 @@ interface ProcessPaymentResult {
732
1839
  oneTimePurchase?: OneTimePurchaseInfo;
733
1840
  status: 'completed';
734
1841
  }
1842
+ interface McpBootstrapFreePlanConfig {
1843
+ name?: string;
1844
+ freeUnits?: number;
1845
+ }
1846
+ interface McpBootstrapPaidPlanInput {
1847
+ key: string;
1848
+ name: string;
1849
+ /** Price in cents (e.g. 2000 = $20.00) */
1850
+ price: number;
1851
+ currency: string;
1852
+ billingCycle?: 'weekly' | 'monthly' | 'quarterly' | 'yearly' | 'custom';
1853
+ type?: 'recurring' | 'one-time';
1854
+ freeUnits?: number;
1855
+ meterId?: string;
1856
+ limit?: number;
1857
+ features?: Record<string, unknown>;
1858
+ }
1859
+ interface ToolPlanMappingInput {
1860
+ name: string;
1861
+ description?: string;
1862
+ noPlan?: boolean;
1863
+ planIds?: string[];
1864
+ planRefs?: string[];
1865
+ planKeys?: string[];
1866
+ }
1867
+ interface McpBootstrapRequest {
1868
+ name?: string;
1869
+ description?: string;
1870
+ imageUrl?: string;
1871
+ productType?: string;
1872
+ originUrl: string;
1873
+ /** Optional token combined with provider name to derive the final MCP subdomain. */
1874
+ mcpDomain?: string;
1875
+ authHeaderName?: string;
1876
+ authApiKey?: string;
1877
+ freePlan?: McpBootstrapFreePlanConfig;
1878
+ paidPlans?: McpBootstrapPaidPlanInput[];
1879
+ tools?: ToolPlanMappingInput[];
1880
+ metadata?: Record<string, unknown>;
1881
+ }
1882
+ interface McpBootstrapResponse {
1883
+ product: components['schemas']['SdkProductResponse'];
1884
+ mcpServer: {
1885
+ id?: string;
1886
+ reference?: string;
1887
+ subdomain?: string;
1888
+ mcpProxyUrl?: string;
1889
+ url: string;
1890
+ defaultPlanId?: string;
1891
+ };
1892
+ planMap: Record<string, {
1893
+ id: string;
1894
+ reference: string;
1895
+ name?: string;
1896
+ }>;
1897
+ toolsAutoMapped?: boolean;
1898
+ autoMappedTools?: Array<{
1899
+ name: string;
1900
+ description?: string;
1901
+ }>;
1902
+ }
735
1903
  /**
736
1904
  * SolvaPay API Client Interface
737
1905
  *
@@ -740,16 +1908,19 @@ interface ProcessPaymentResult {
740
1908
  * You can provide your own implementation or use the default createSolvaPayClient().
741
1909
  */
742
1910
  interface SolvaPayClient {
743
- checkLimits(params: components['schemas']['CheckLimitRequest']): Promise<LimitResponseWithPlan>;
1911
+ checkLimits(params: CheckLimitsRequest): Promise<LimitResponseWithPlan>;
744
1912
  trackUsage(params: {
745
1913
  customerRef: string;
746
- productRef: string;
747
- planRef: string;
748
- outcome: string;
749
- action?: string;
750
- requestId?: string;
751
- actionDuration?: number;
1914
+ actionType?: 'transaction' | 'api_call' | 'hour' | 'email' | 'storage' | 'custom';
1915
+ units?: number;
1916
+ outcome?: 'success' | 'paywall' | 'fail';
1917
+ productReference?: string;
1918
+ purchaseReference?: string;
1919
+ description?: string;
1920
+ metadata?: Record<string, unknown>;
1921
+ duration?: number;
752
1922
  timestamp?: string;
1923
+ idempotencyKey?: string;
753
1924
  }): Promise<void>;
754
1925
  createCustomer?(params: components['schemas']['CreateCustomerRequest']): Promise<{
755
1926
  customerRef: string;
@@ -769,17 +1940,26 @@ interface SolvaPayClient {
769
1940
  reference: string;
770
1941
  name: string;
771
1942
  }>;
1943
+ bootstrapMcpProduct?(params: McpBootstrapRequest): Promise<McpBootstrapResponse>;
772
1944
  updateProduct?(productRef: string, params: components['schemas']['UpdateProductRequest']): Promise<components['schemas']['SdkProductResponse']>;
773
1945
  deleteProduct?(productRef: string): Promise<void>;
774
- listPlans?(productRef: string): Promise<Array<{
1946
+ cloneProduct?(productRef: string, overrides?: {
1947
+ name?: string;
1948
+ }): Promise<{
775
1949
  reference: string;
776
1950
  name: string;
777
- description?: string;
1951
+ }>;
1952
+ listPlans?(productRef: string): Promise<Array<{
1953
+ reference: string;
778
1954
  price?: number;
779
1955
  currency?: string;
780
1956
  interval?: string;
781
1957
  isFreeTier?: boolean;
782
1958
  freeUnits?: number;
1959
+ measures?: string;
1960
+ limit?: number;
1961
+ pricePerUnit?: number;
1962
+ billingModel?: string;
783
1963
  metadata?: Record<string, unknown>;
784
1964
  [key: string]: unknown;
785
1965
  }>>;
@@ -787,7 +1967,10 @@ interface SolvaPayClient {
787
1967
  productRef: string;
788
1968
  }): Promise<{
789
1969
  reference: string;
790
- name: string;
1970
+ }>;
1971
+ updatePlan?(productRef: string, planRef: string, params: Partial<components['schemas']['CreatePlanRequest']>): Promise<{
1972
+ reference: string;
1973
+ [key: string]: unknown;
791
1974
  }>;
792
1975
  deletePlan?(productRef: string, planRef: string): Promise<void>;
793
1976
  createPaymentIntent?(params: {
@@ -811,6 +1994,10 @@ interface SolvaPayClient {
811
1994
  customerRef: string;
812
1995
  planRef?: string;
813
1996
  }): Promise<ProcessPaymentResult>;
1997
+ getUserInfo?(params: {
1998
+ customerRef: string;
1999
+ productRef: string;
2000
+ }): Promise<components['schemas']['UserInfoResponse']>;
814
2001
  createCheckoutSession(params: components['schemas']['CreateCheckoutSessionRequest']): Promise<components['schemas']['CheckoutSessionResponse']>;
815
2002
  createCustomerSession(params: components['schemas']['CreateCustomerSessionRequest']): Promise<components['schemas']['CreateCustomerSessionResponse']>;
816
2003
  }
@@ -835,6 +2022,7 @@ interface PaywallArgs {
835
2022
  interface PaywallMetadata {
836
2023
  product?: string;
837
2024
  plan?: string;
2025
+ usageType?: 'requests' | 'tokens';
838
2026
  }
839
2027
  /**
840
2028
  * Structured content for paywall errors
@@ -918,6 +2106,10 @@ interface PayableOptions {
918
2106
  * Plan reference (alias for plan, preferred for consistency with backend API)
919
2107
  */
920
2108
  planRef?: string;
2109
+ /**
2110
+ * Usage meter type to charge against (defaults to 'requests')
2111
+ */
2112
+ usageType?: 'requests' | 'tokens';
921
2113
  /**
922
2114
  * Optional function to extract customer reference from context
923
2115
  */
@@ -971,6 +2163,49 @@ interface McpAdapterOptions {
971
2163
  transformResponse?: (result: any) => any;
972
2164
  }
973
2165
 
2166
+ /**
2167
+ * Virtual Tools for MCP Server Monetization
2168
+ *
2169
+ * Provides the same self-service tools (get_user_info, upgrade, manage_account)
2170
+ * that hosted MCP Pay servers get automatically, but for SDK-integrated servers.
2171
+ * These tools are NOT usage-tracked and bypass the paywall.
2172
+ */
2173
+
2174
+ interface VirtualToolsOptions {
2175
+ /** Product reference (required) */
2176
+ product: string;
2177
+ /** Extract customer reference from MCP tool args */
2178
+ getCustomerRef: (args: Record<string, unknown>) => string;
2179
+ /** Tool names to exclude from registration (optional) */
2180
+ exclude?: string[];
2181
+ }
2182
+ interface VirtualToolDefinition {
2183
+ name: string;
2184
+ description: string;
2185
+ inputSchema: {
2186
+ type: 'object';
2187
+ properties: Record<string, object>;
2188
+ required: string[];
2189
+ };
2190
+ handler: (args: Record<string, unknown>) => Promise<{
2191
+ content: Array<{
2192
+ type: string;
2193
+ text: string;
2194
+ }>;
2195
+ isError?: boolean;
2196
+ }>;
2197
+ }
2198
+ declare const VIRTUAL_TOOL_DEFINITIONS: {
2199
+ name: string;
2200
+ description: string;
2201
+ inputSchema: {
2202
+ type: "object";
2203
+ properties: Record<string, object>;
2204
+ required: string[];
2205
+ };
2206
+ }[];
2207
+ declare function createVirtualTools(apiClient: SolvaPayClient, options: VirtualToolsOptions): VirtualToolDefinition[];
2208
+
974
2209
  /**
975
2210
  * Configuration for creating a SolvaPay instance.
976
2211
  *
@@ -1007,6 +2242,12 @@ interface CreateSolvaPayConfig {
1007
2242
  * Defaults to production API URL if not provided.
1008
2243
  */
1009
2244
  apiBaseUrl?: string;
2245
+ /**
2246
+ * TTL in ms for the checkLimits cache (default 10 000).
2247
+ * Positive results are cached and optimistically decremented to avoid
2248
+ * redundant API calls during tool-call bursts.
2249
+ */
2250
+ limitsCacheTTL?: number;
1010
2251
  }
1011
2252
  /**
1012
2253
  * Payable function that provides explicit adapters for different frameworks.
@@ -1269,7 +2510,8 @@ interface SolvaPay {
1269
2510
  * ```typescript
1270
2511
  * const limits = await solvaPay.checkLimits({
1271
2512
  * customerRef: 'user_123',
1272
- * productRef: 'prd_myapi'
2513
+ * productRef: 'prd_myapi',
2514
+ * planRef: 'pln_premium'
1273
2515
  * });
1274
2516
  *
1275
2517
  * if (!limits.withinLimits) {
@@ -1281,11 +2523,15 @@ interface SolvaPay {
1281
2523
  checkLimits(params: {
1282
2524
  customerRef: string;
1283
2525
  productRef: string;
2526
+ planRef?: string;
2527
+ meterName?: 'requests' | 'tokens';
2528
+ usageType?: 'requests' | 'tokens';
1284
2529
  }): Promise<{
1285
2530
  withinLimits: boolean;
1286
2531
  remaining: number;
1287
2532
  plan: string;
1288
2533
  checkoutUrl?: string;
2534
+ meterName?: string;
1289
2535
  }>;
1290
2536
  /**
1291
2537
  * Track usage for a customer action.
@@ -1306,26 +2552,26 @@ interface SolvaPay {
1306
2552
  * @example
1307
2553
  * ```typescript
1308
2554
  * await solvaPay.trackUsage({
1309
- * customerRef: 'user_123',
1310
- * productRef: 'prd_myapi',
1311
- * planRef: 'pln_premium',
2555
+ * customerRef: 'cus_3C4D5E6F',
2556
+ * actionType: 'api_call',
2557
+ * units: 1,
1312
2558
  * outcome: 'success',
1313
- * action: 'api_call',
1314
- * requestId: 'req_123',
1315
- * actionDuration: 150,
1316
- * timestamp: new Date().toISOString()
2559
+ * metadata: { toolName: 'search', endpoint: '/search' },
1317
2560
  * });
1318
2561
  * ```
1319
2562
  */
1320
2563
  trackUsage(params: {
1321
2564
  customerRef: string;
1322
- productRef: string;
1323
- planRef: string;
1324
- outcome: 'success' | 'paywall' | 'fail';
1325
- action?: string;
1326
- requestId: string;
1327
- actionDuration: number;
1328
- timestamp: string;
2565
+ actionType?: 'transaction' | 'api_call' | 'hour' | 'email' | 'storage' | 'custom';
2566
+ units?: number;
2567
+ outcome?: 'success' | 'paywall' | 'fail';
2568
+ productReference?: string;
2569
+ purchaseReference?: string;
2570
+ description?: string;
2571
+ metadata?: Record<string, unknown>;
2572
+ duration?: number;
2573
+ timestamp?: string;
2574
+ idempotencyKey?: string;
1329
2575
  }): Promise<void>;
1330
2576
  /**
1331
2577
  * Create a new customer in SolvaPay backend.
@@ -1423,6 +2669,7 @@ interface SolvaPay {
1423
2669
  *
1424
2670
  * @param params - Customer session parameters
1425
2671
  * @param params.customerRef - Customer reference
2672
+ * @param params.productRef - Optional product reference for scoping portal view
1426
2673
  * @returns Customer portal session with redirect URL
1427
2674
  *
1428
2675
  * @example
@@ -1437,10 +2684,47 @@ interface SolvaPay {
1437
2684
  */
1438
2685
  createCustomerSession(params: {
1439
2686
  customerRef: string;
2687
+ productRef?: string;
1440
2688
  }): Promise<{
1441
2689
  sessionId: string;
1442
2690
  customerUrl: string;
1443
2691
  }>;
2692
+ /**
2693
+ * Bootstrap an MCP-enabled product with plans and tool mappings.
2694
+ *
2695
+ * This helper wraps the backend orchestration endpoint and is intended for
2696
+ * fast setup flows where you want one call for product + plans + MCP config.
2697
+ */
2698
+ bootstrapMcpProduct(params: McpBootstrapRequest): Promise<McpBootstrapResponse>;
2699
+ /**
2700
+ * Get virtual tool definitions with bound handlers for MCP server integration.
2701
+ *
2702
+ * Returns an array of tool objects (name, description, inputSchema, handler)
2703
+ * that provide self-service capabilities: user info, upgrade, and account management.
2704
+ * These tools bypass the paywall and are not usage-tracked.
2705
+ *
2706
+ * Register the returned tools on your MCP server alongside your own tools.
2707
+ *
2708
+ * @param options - Virtual tools configuration
2709
+ * @param options.product - Product reference (required)
2710
+ * @param options.getCustomerRef - Function to extract customer ref from tool args
2711
+ * @param options.exclude - Optional list of tool names to exclude
2712
+ * @returns Array of virtual tool definitions with handlers
2713
+ *
2714
+ * @example
2715
+ * ```typescript
2716
+ * const virtualTools = solvaPay.getVirtualTools({
2717
+ * product: 'prd_myapi',
2718
+ * getCustomerRef: args => args._auth?.customer_ref || 'anonymous',
2719
+ * });
2720
+ *
2721
+ * // Register on your MCP server
2722
+ * for (const tool of virtualTools) {
2723
+ * // Add to tools/list and tools/call handlers
2724
+ * }
2725
+ * ```
2726
+ */
2727
+ getVirtualTools(options: VirtualToolsOptions): VirtualToolDefinition[];
1444
2728
  /**
1445
2729
  * Direct access to the API client for advanced operations.
1446
2730
  *
@@ -1656,6 +2940,23 @@ declare class PaywallError extends Error {
1656
2940
  */
1657
2941
  declare function withRetry<T>(fn: () => Promise<T>, options?: RetryOptions): Promise<T>;
1658
2942
 
2943
+ /**
2944
+ * MCP OAuth helper utilities.
2945
+ *
2946
+ * These helpers are intentionally lightweight and do not verify JWT signatures.
2947
+ * Use them after token validation (for example via /v1/oauth/userinfo).
2948
+ */
2949
+ declare class McpBearerAuthError extends Error {
2950
+ constructor(message: string);
2951
+ }
2952
+ type McpBearerCustomerRefOptions = {
2953
+ claimPriority?: string[];
2954
+ };
2955
+ declare function extractBearerToken(authorization?: string | null): string | null;
2956
+ declare function decodeJwtPayload(token: string): Record<string, unknown>;
2957
+ declare function getCustomerRefFromJwtPayload(payload: Record<string, unknown>, options?: McpBearerCustomerRefOptions): string;
2958
+ declare function getCustomerRefFromBearerAuthHeader(authorization?: string | null, options?: McpBearerCustomerRefOptions): string;
2959
+
1659
2960
  /**
1660
2961
  * Helper Types
1661
2962
  *
@@ -2027,4 +3328,4 @@ declare function verifyWebhook({ body, signature, secret, }: {
2027
3328
  secret: string;
2028
3329
  }): any;
2029
3330
 
2030
- export { type AuthenticatedUser, type CreateSolvaPayConfig, type CustomerResponseMapped, type ErrorResult, type HttpAdapterOptions, type McpAdapterOptions, type NextAdapterOptions, type OneTimePurchaseInfo, type PayableFunction, type PayableOptions, type PaywallArgs, PaywallError, type PaywallMetadata, type PaywallStructuredContent, type PaywallToolResult, type ProcessPaymentResult, type RetryOptions, type ServerClientOptions, type SolvaPay, type SolvaPayClient, cancelPurchaseCore, createCheckoutSessionCore, createCustomerSessionCore, createPaymentIntentCore, createSolvaPay, createSolvaPayClient, getAuthenticatedUserCore, handleRouteError, isErrorResult, listPlansCore, processPaymentIntentCore, syncCustomerCore, verifyWebhook, withRetry };
3331
+ export { type AuthenticatedUser, type CreateSolvaPayConfig, type CustomerResponseMapped, type ErrorResult, type HttpAdapterOptions, type McpAdapterOptions, McpBearerAuthError, type McpBootstrapFreePlanConfig, type McpBootstrapPaidPlanInput, type McpBootstrapRequest, type McpBootstrapResponse, type NextAdapterOptions, type OneTimePurchaseInfo, type PayableFunction, type PayableOptions, type PaywallArgs, PaywallError, type PaywallMetadata, type PaywallStructuredContent, type PaywallToolResult, type ProcessPaymentResult, type RetryOptions, type ServerClientOptions, type SolvaPay, type SolvaPayClient, type ToolPlanMappingInput, VIRTUAL_TOOL_DEFINITIONS, type VirtualToolDefinition, type VirtualToolsOptions, cancelPurchaseCore, createCheckoutSessionCore, createCustomerSessionCore, createPaymentIntentCore, createSolvaPay, createSolvaPayClient, createVirtualTools, decodeJwtPayload, extractBearerToken, getAuthenticatedUserCore, getCustomerRefFromBearerAuthHeader, getCustomerRefFromJwtPayload, handleRouteError, isErrorResult, listPlansCore, processPaymentIntentCore, syncCustomerCore, verifyWebhook, withRetry };