@solvapay/server 1.0.1-preview.2 → 1.0.1-preview.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/edge.d.ts CHANGED
@@ -1,328 +1,103 @@
1
- type WebhookEventType = 'payment.succeeded' | 'payment.failed' | 'payment.refunded' | 'payment.refund_failed' | 'purchase.created' | 'purchase.updated' | 'purchase.cancelled' | 'purchase.expired' | 'purchase.suspended' | 'customer.created' | 'customer.updated' | 'customer.deleted';
2
- interface WebhookEvent {
1
+ type WebhookEventType = 'payment.succeeded' | 'payment.failed' | 'payment.refunded' | 'payment.refund_failed' | 'purchase.created' | 'purchase.updated' | 'purchase.cancelled' | 'purchase.expired' | 'purchase.suspended' | 'customer.created' | 'customer.updated' | 'customer.deleted' | 'checkout_session.created';
2
+ interface WebhookProduct {
3
+ reference: string;
4
+ }
5
+ interface CustomerWebhookObject {
6
+ id: string;
7
+ created: number;
8
+ product: WebhookProduct | null;
9
+ reference?: string;
10
+ name?: string;
11
+ email?: string;
12
+ telephone?: string;
13
+ status?: string;
14
+ }
15
+ type WebhookPayloadObject = Record<string, unknown>;
16
+ type WebhookEventObjectMap = {
17
+ 'payment.succeeded': WebhookPayloadObject;
18
+ 'payment.failed': WebhookPayloadObject;
19
+ 'payment.refunded': WebhookPayloadObject;
20
+ 'payment.refund_failed': WebhookPayloadObject;
21
+ 'purchase.created': WebhookPayloadObject;
22
+ 'purchase.updated': WebhookPayloadObject;
23
+ 'purchase.cancelled': WebhookPayloadObject;
24
+ 'purchase.expired': WebhookPayloadObject;
25
+ 'purchase.suspended': WebhookPayloadObject;
26
+ 'customer.created': CustomerWebhookObject;
27
+ 'customer.updated': CustomerWebhookObject;
28
+ 'customer.deleted': CustomerWebhookObject;
29
+ 'checkout_session.created': WebhookPayloadObject;
30
+ };
31
+ type WebhookEventForType<TType extends WebhookEventType> = {
3
32
  id: string;
4
- type: WebhookEventType;
33
+ type: TType;
5
34
  created: number;
6
35
  api_version: string;
7
36
  data: {
8
- object: Record<string, any>;
9
- previous_attributes: Record<string, any> | null;
37
+ object: WebhookEventObjectMap[TType];
38
+ previous_attributes: Record<string, unknown> | null;
10
39
  };
11
40
  livemode: boolean;
12
41
  request: {
13
42
  id: string | null;
14
43
  idempotency_key: string | null;
15
44
  };
16
- }
45
+ };
46
+ type WebhookEvent = {
47
+ [TType in WebhookEventType]: WebhookEventForType<TType>;
48
+ }[WebhookEventType];
17
49
 
18
50
  interface components {
19
51
  schemas: {
20
- UpdateProviderDto: {
21
- /** @description Legal entity information */
22
- legalEntity?: Record<string, never>;
23
- /**
24
- * Provider description
25
- * @example My business
26
- */
27
- description?: string;
28
- /**
29
- * Business website URL
30
- * @example https://example.com
31
- */
32
- website?: string;
52
+ CreatePaymentIntentDto: {
53
+ productRef?: string;
54
+ customerReference: string;
55
+ planRef?: string;
56
+ pricingTier?: string;
33
57
  /**
34
- * Business type
35
- * @example individual
58
+ * @default product
36
59
  * @enum {string}
37
60
  */
38
- businessType?: "individual" | "company";
39
- /**
40
- * Business email address
41
- * @example business@example.com
42
- */
43
- businessEmail?: string;
44
- /**
45
- * Support email address
46
- * @example support@example.com
47
- */
48
- supportEmail?: string;
49
- /**
50
- * Business telephone number
51
- * @example +1234567890
52
- */
53
- telephone?: string;
54
- /**
55
- * Support telephone number
56
- * @example +1234567890
57
- */
58
- supportTelephone?: string;
59
- /**
60
- * Default currency code
61
- * @example usd
62
- */
63
- defaultCurrency?: string;
64
- /** @description Arbitrary metadata */
65
- metadata?: Record<string, never>;
66
- /** @description Terms of Service acceptance */
67
- tosAcceptance?: Record<string, never>;
68
- };
69
- CreateSecretKey: Record<string, never>;
70
- CreateUser: Record<string, never>;
71
- UpdateUser: Record<string, never>;
72
- UpdateProfile: Record<string, never>;
73
- UpdatePreferences: Record<string, never>;
74
- RequestEmailChange: {
75
- newEmail: string;
76
- };
77
- VerifyEmailChange: {
78
- code: string;
61
+ purpose: "product" | "credit_topup" | "usage_billing";
62
+ amount?: number;
63
+ currency?: string;
64
+ description?: string;
79
65
  };
80
66
  CreateCheckoutSessionRequest: {
81
- /**
82
- * Customer reference
83
- * @example cus_3c4d5e6f7g8h
84
- */
85
- customerReference: string;
86
- /**
87
- * Plan reference (optional)
88
- * @example pln_2b3c4d5e6f7g
89
- */
67
+ customerRef: string;
68
+ productRef?: string;
90
69
  planRef?: string;
91
- /**
92
- * Product reference (required)
93
- * @example prd_1a2b3c4d5e6f
94
- */
95
- productRef: string;
96
- };
97
- CheckoutSessionResponse: {
98
- /**
99
- * Checkout session ID
100
- * @example 507f1f77bcf86cd799439011
101
- */
102
- id: string;
103
- /**
104
- * Public session ID used in checkout URL
105
- * @example a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6
106
- */
107
- sessionId: string;
108
- /**
109
- * Amount in cents
110
- * @example 2999
111
- */
112
- amount: number;
113
- /**
114
- * Currency code
115
- * @example USD
116
- */
117
- currency: string;
118
- /**
119
- * Session status
120
- * @example active
121
- */
122
- status: string;
123
- /**
124
- * Checkout URL to open the checkout page
125
- * @example https://solvapay.com/customer/checkout?id=a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6
126
- */
127
- checkoutUrl: string;
128
- };
129
- SelectCustomerSessionProductRequest: {
130
- /**
131
- * Product reference or ID to scope the customer manage session
132
- * @example prd_1a2b3c4d5e6f
133
- */
134
- productRef: string;
70
+ returnUrl?: string;
71
+ /** @enum {string} */
72
+ purpose?: "credit_topup";
135
73
  };
136
- CancelRenewalRequest: {
137
- /** @description Reason for cancelling renewal */
74
+ CancelPurchaseRequest: {
138
75
  reason?: string;
139
76
  };
140
- ExternalAccount: {
141
- /**
142
- * Country code
143
- * @example US
144
- */
145
- country: string;
146
- /**
147
- * Currency code
148
- * @example usd
149
- */
150
- currency: string;
151
- /**
152
- * Account holder name
153
- * @example John Doe
154
- */
155
- accountHolderName: string;
156
- /**
157
- * Account holder type
158
- * @example individual
159
- * @enum {string}
160
- */
161
- accountHolderType: "individual" | "company";
162
- /**
163
- * Routing number
164
- * @example 110000000
165
- */
166
- routingNumber: string;
167
- /**
168
- * Account number
169
- * @example 000123456789
170
- */
171
- accountNumber: string;
77
+ ProcessPaymentIntentDto: {
78
+ productRef: string;
79
+ customerRef: string;
80
+ planRef?: string;
172
81
  };
173
- TosAcceptance: {
82
+ CreateCheckoutSessionResponse: {
174
83
  /**
175
- * IP address of user accepting ToS
176
- * @example 192.168.1.1
84
+ * Checkout session ID/token
85
+ * @example e3f1c2d4b6a89f001122334455667788
177
86
  */
178
- ip: string;
179
- };
180
- UpdateConnectedAccount: {
87
+ sessionId: string;
181
88
  /**
182
- * Business website URL
183
- * @example https://example.com
89
+ * Full checkout URL based on backend configuration (ready to redirect customer)
90
+ * @example https://solvapay.com/customer/checkout?id=e3f1c2d4b6a89f001122334455667788
184
91
  */
185
- website?: string;
186
- /** @description External bank account */
187
- externalAccount?: components["schemas"]["ExternalAccount"];
188
- /** @description Terms of Service acceptance */
189
- tosAcceptance?: components["schemas"]["TosAcceptance"];
190
- };
191
- Signup: {
192
- name: string;
193
- email: string;
194
- /** @enum {string} */
195
- type?: "provider" | "admin" | "super_admin";
196
- };
197
- AuthUserDto: {
198
- id: string;
199
- name: string;
200
- email: string;
201
- /** @enum {string} */
202
- type: "provider" | "admin" | "super_admin";
203
- emailVerified: boolean;
204
- /** @enum {string} */
205
- authProvider: "local" | "google" | "github" | "facebook";
206
- providerId?: string;
207
- providerRole?: string;
208
- preferences?: Record<string, never>;
209
- };
210
- AuthResponse: {
211
- user: components["schemas"]["AuthUserDto"];
212
- accessToken?: string;
213
- refreshToken?: string;
214
- expiresIn?: number;
215
- message?: string;
216
- requiresMfa?: boolean;
217
- requiresMfaSetup?: boolean;
218
- };
219
- Login: {
220
- /** @description Email to send a 6-digit login code to */
221
- email: string;
92
+ checkoutUrl: string;
222
93
  };
223
- VerifyLoginCode: {
224
- email: string;
225
- /** @description 6-digit login code sent to email */
226
- code: string;
227
- };
228
- VerifyEmail: {
229
- emailVerificationCode: string;
230
- };
231
- DynamicClientRegistrationDto: {
232
- /** @example My AI Agent */
233
- client_name: string;
234
- /**
235
- * @example [
236
- * "https://agent.example.com/callback"
237
- * ]
238
- */
239
- redirect_uris: string[];
240
- /**
241
- * @example [
242
- * "authorization_code",
243
- * "refresh_token"
244
- * ]
245
- */
246
- grant_types?: string[];
247
- /**
248
- * @example [
249
- * "code"
250
- * ]
251
- */
252
- response_types?: string[];
253
- /** @example agent-123 */
254
- software_id?: string;
255
- /** @example 1.0.0 */
256
- software_version?: string;
257
- /** @example https://example.com/logo.png */
258
- logo_uri?: string;
259
- /** @example https://example.com/tos */
260
- tos_uri?: string;
261
- /** @example https://example.com/policy */
262
- policy_uri?: string;
263
- /** @example https://example.com */
264
- client_uri?: string;
265
- };
266
- DynamicClientRegistrationResponseDto: {
267
- /** @example client-id-123 */
268
- client_id: string;
269
- /** @example client-secret-456 */
270
- client_secret: string;
271
- /** @example 1734567890 */
272
- client_id_issued_at: number;
273
- /** @example 0 */
274
- client_secret_expires_at: number;
275
- /** @example My AI Agent */
276
- client_name: string;
277
- /**
278
- * @example [
279
- * "https://agent.example.com/callback"
280
- * ]
281
- */
282
- redirect_uris: string[];
283
- /**
284
- * @example [
285
- * "authorization_code",
286
- * "refresh_token"
287
- * ]
288
- */
289
- grant_types: string[];
290
- /**
291
- * @example [
292
- * "code"
293
- * ]
294
- */
295
- response_types: string[];
296
- /** @example openid profile email */
297
- scope: string;
298
- /** @example client_secret_basic */
299
- token_endpoint_auth_method: string;
300
- };
301
- GoogleLoginDto: {
302
- /** @description The authorization code returned by Google */
303
- code: string;
304
- /** @description The redirect URI used in the initial authorization request */
305
- redirect_uri: string;
306
- /** @description The state parameter returned by Google (contains client_id) */
307
- state: string;
308
- };
309
- GithubLoginDto: {
310
- /** @description The authorization code returned by GitHub */
311
- code: string;
312
- /** @description The redirect URI used in the initial authorization request */
313
- redirect_uri: string;
314
- /** @description The state parameter returned by GitHub (contains client_id) */
315
- state: string;
316
- };
317
- CreateOAuthClientDto: Record<string, never>;
318
- UpdateOAuthClientDto: Record<string, never>;
319
94
  Plan: {
320
95
  /**
321
96
  * Plan type exposed in SDK
322
97
  * @example recurring
323
98
  * @enum {string}
324
99
  */
325
- type: "recurring" | "one-time";
100
+ type: "recurring" | "one-time" | "usage-based";
326
101
  /**
327
102
  * Plan ID
328
103
  * @example 507f1f77bcf86cd799439011
@@ -333,6 +108,16 @@ interface components {
333
108
  * @example pln_1A2B3C4D
334
109
  */
335
110
  reference: string;
111
+ /**
112
+ * Plan name
113
+ * @example Starter
114
+ */
115
+ name?: string;
116
+ /**
117
+ * Plan description
118
+ * @example Best for teams getting started
119
+ */
120
+ description?: string;
336
121
  /**
337
122
  * Plan price in cents
338
123
  * @example 2999
@@ -375,8 +160,8 @@ interface components {
375
160
  */
376
161
  billingModel?: "pre-paid" | "post-paid";
377
162
  /**
378
- * Price per usage unit
379
- * @example 0.01
163
+ * Price per usage unit in cents (supports decimals, e.g. 0.1 = 1/10 cent)
164
+ * @example 0.1
380
165
  */
381
166
  pricePerUnit?: number;
382
167
  /**
@@ -402,11 +187,6 @@ interface components {
402
187
  features?: {
403
188
  [key: string]: unknown;
404
189
  };
405
- /**
406
- * Whether this is a free tier plan
407
- * @example false
408
- */
409
- isFreeTier: boolean;
410
190
  /**
411
191
  * Whether payment is required
412
192
  * @example true
@@ -432,181 +212,81 @@ interface components {
432
212
  updatedAt: string;
433
213
  };
434
214
  CreatePlanRequest: {
435
- /**
436
- * Plan type exposed in SDK
437
- * @example recurring
438
- * @enum {string}
439
- */
440
- type?: "recurring" | "one-time";
441
- /**
442
- * Billing cycle (required for recurring/hybrid, optional for post-paid usage-based)
443
- * @example monthly
444
- * @enum {string}
445
- */
215
+ name?: string;
216
+ description?: string;
217
+ /** @enum {string} */
218
+ type?: "recurring" | "usage-based" | "hybrid" | "one-time";
219
+ /** @enum {string} */
446
220
  billingCycle?: "weekly" | "monthly" | "quarterly" | "yearly" | "custom";
447
- /**
448
- * Plan price in cents
449
- * @example 2999
450
- */
451
221
  price?: number;
452
- /**
453
- * Currency code (ISO 4217)
454
- * @example USD
455
- * @enum {string}
456
- */
457
- 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";
458
- /**
459
- * Number of free units included
460
- * @example 100
461
- */
222
+ pricePerUnit?: number;
223
+ currency?: string;
224
+ /** @enum {string} */
225
+ billingModel?: "pre-paid" | "post-paid";
462
226
  freeUnits?: number;
463
- /**
464
- * Usage limit for the meter
465
- * @example 10000
466
- */
467
227
  limit?: number;
468
- /**
469
- * Usage limits (shape varies by plan type)
470
- * @example {
471
- * "maxTransactions": 1000
472
- * }
473
- */
474
- limits?: {
228
+ limits: {
475
229
  [key: string]: unknown;
476
230
  };
477
- /**
478
- * Plan features (generic key/value, shape is provider-defined)
479
- * @example {
480
- * "apiAccess": true,
481
- * "prioritySupport": false
482
- * }
483
- */
484
- features?: {
231
+ metadata: {
485
232
  [key: string]: unknown;
486
233
  };
487
- /**
488
- * Whether this is a free tier plan
489
- * @example false
490
- */
491
- isFreeTier?: boolean;
492
- /**
493
- * Whether payment is required
494
- * @example true
495
- */
496
- requiresPayment?: boolean;
497
- /**
498
- * Plan status
499
- * @example active
500
- * @enum {string}
501
- */
234
+ features: {
235
+ [key: string]: unknown;
236
+ };
237
+ /** @enum {string} */
502
238
  status?: "active" | "inactive" | "archived";
503
- /**
504
- * Maximum number of active users
505
- * @example 10
506
- */
507
239
  maxActiveUsers?: number;
508
- /**
509
- * Access expiry in days
510
- * @example 30
511
- */
512
240
  accessExpiryDays?: number;
513
- /** @description Additional metadata */
514
- metadata?: {
515
- [key: string]: unknown;
516
- };
517
- /**
518
- * Whether this is the default plan
519
- * @example false
520
- */
521
241
  default?: boolean;
522
242
  };
523
243
  UpdatePlanRequest: {
524
- /**
525
- * Billing cycle
526
- * @example monthly
527
- * @enum {string}
528
- */
244
+ name?: string;
245
+ description?: string;
246
+ /** @enum {string} */
529
247
  billingCycle?: "weekly" | "monthly" | "quarterly" | "yearly" | "custom";
530
- /**
531
- * Plan price in cents
532
- * @example 2999
533
- */
534
248
  price?: number;
535
- /**
536
- * Currency code (ISO 4217)
537
- * @example USD
538
- */
249
+ pricePerUnit?: number;
539
250
  currency?: string;
540
- /**
541
- * Number of free units included
542
- * @example 100
543
- */
251
+ /** @enum {string} */
252
+ billingModel?: "pre-paid" | "post-paid";
544
253
  freeUnits?: number;
545
- /**
546
- * Usage limit for the meter
547
- * @example 10000
548
- */
549
254
  limit?: number;
550
- /**
551
- * Usage limits (shape varies by plan type)
552
- * @example {
553
- * "maxTransactions": 1000
554
- * }
555
- */
556
- limits?: {
255
+ limits: {
557
256
  [key: string]: unknown;
558
257
  };
559
- /**
560
- * Plan features (generic key/value, shape is provider-defined)
561
- * @example {
562
- * "apiAccess": true,
563
- * "prioritySupport": false
564
- * }
565
- */
566
- features?: {
258
+ features: {
567
259
  [key: string]: unknown;
568
260
  };
569
- /**
570
- * Whether this is a free tier plan
571
- * @example false
572
- */
573
- isFreeTier?: boolean;
574
- /**
575
- * Whether payment is required
576
- * @example true
577
- */
578
- requiresPayment?: boolean;
579
- /**
580
- * Plan status
581
- * @example active
582
- * @enum {string}
583
- */
261
+ /** @enum {string} */
584
262
  status?: "active" | "inactive" | "archived";
585
- /**
586
- * Maximum number of active users
587
- * @example 10
588
- */
589
263
  maxActiveUsers?: number;
590
- /**
591
- * Access expiry in days
592
- * @example 30
593
- */
594
264
  accessExpiryDays?: number;
595
- /** @description Additional metadata */
596
- metadata?: {
265
+ metadata: {
597
266
  [key: string]: unknown;
598
267
  };
599
- /**
600
- * Whether this is the default plan
601
- * @example false
602
- */
603
268
  default?: boolean;
604
269
  };
605
- ProductConfigDto: {
606
- /**
607
- * Fulfillment type
608
- * @example digital
609
- */
270
+ CreateProductRequest: {
271
+ name: string;
272
+ description?: string;
273
+ imageUrl?: string;
274
+ productType?: string;
275
+ isMcpPay?: boolean;
276
+ config: {
277
+ fulfillmentType?: string;
278
+ validityPeriod?: number;
279
+ deliveryMethod?: string;
280
+ };
281
+ metadata: {
282
+ [key: string]: unknown;
283
+ };
284
+ };
285
+ ProductConfigDto: {
286
+ /**
287
+ * Fulfillment type
288
+ * @example digital
289
+ */
610
290
  fulfillmentType?: string;
611
291
  /**
612
292
  * Validity period in days
@@ -619,36 +299,6 @@ interface components {
619
299
  */
620
300
  deliveryMethod?: string;
621
301
  };
622
- CreateProductRequest: {
623
- /**
624
- * Product name
625
- * @example AI Writing Assistant
626
- */
627
- name: string;
628
- /**
629
- * Product description
630
- * @example AI-powered writing tool
631
- */
632
- description?: string;
633
- /** @description URL to the product image */
634
- imageUrl?: string;
635
- /**
636
- * Free-form product type defined by the provider
637
- * @example Coding Assistant
638
- */
639
- productType?: string;
640
- /**
641
- * Whether this product uses MCP Pay proxy
642
- * @default false
643
- */
644
- isMcpPay: boolean;
645
- /** @description Product-specific configuration */
646
- config?: components["schemas"]["ProductConfigDto"];
647
- /** @description Arbitrary key-value metadata */
648
- metadata?: {
649
- [key: string]: unknown;
650
- };
651
- };
652
302
  SdkPlanResponse: {
653
303
  /**
654
304
  * Plan ID
@@ -696,8 +346,8 @@ interface components {
696
346
  */
697
347
  billingModel?: string;
698
348
  /**
699
- * Price per unit in cents
700
- * @example 10
349
+ * Price per usage unit in cents (supports decimals, e.g. 0.1 = 1/10 cent)
350
+ * @example 0.1
701
351
  */
702
352
  pricePerUnit?: number;
703
353
  /**
@@ -728,11 +378,6 @@ interface components {
728
378
  features?: {
729
379
  [key: string]: unknown;
730
380
  };
731
- /**
732
- * Whether this is a free tier plan
733
- * @example false
734
- */
735
- isFreeTier: boolean;
736
381
  /**
737
382
  * Whether payment is required
738
383
  * @example true
@@ -823,175 +468,59 @@ interface components {
823
468
  };
824
469
  };
825
470
  UpdateProductRequest: {
826
- /** @description Product name */
827
471
  name?: string;
828
- /** @description Product description */
829
472
  description?: string;
830
- /** @description URL to the product image */
831
473
  imageUrl?: string;
832
- /** @description Free-form product type defined by the provider */
833
474
  productType?: string;
834
- /**
835
- * Product status
836
- * @enum {string}
837
- */
475
+ /** @enum {string} */
838
476
  status?: "active" | "inactive" | "suspended";
839
- /** @description Product-specific configuration */
840
- config?: components["schemas"]["ProductConfigDto"];
841
- /** @description Arbitrary key-value metadata */
842
- metadata?: {
843
- [key: string]: unknown;
477
+ config: {
478
+ fulfillmentType?: string;
479
+ validityPeriod?: number;
480
+ deliveryMethod?: string;
844
481
  };
845
- };
846
- McpBootstrapFreePlanConfig: {
847
- /**
848
- * Free plan display name override
849
- * @example Starter
850
- */
851
- name?: string;
852
- /**
853
- * Included free units (default 1000)
854
- * @example 500
855
- */
856
- freeUnits?: number;
857
- };
858
- McpBootstrapPaidPlanInput: {
859
- /**
860
- * Logical plan key (must not be "free")
861
- * @example pro
862
- */
863
- key: string;
864
- /**
865
- * Plan display name
866
- * @example Pro
867
- */
868
- name: string;
869
- /**
870
- * Plan price in cents (must be > 0)
871
- * @example 2000
872
- */
873
- price: number;
874
- /**
875
- * Currency code (ISO 4217)
876
- * @example USD
877
- */
878
- currency: string;
879
- /**
880
- * Billing cycle for recurring plans
881
- * @example monthly
882
- * @enum {string}
883
- */
884
- billingCycle?: "weekly" | "monthly" | "quarterly" | "yearly" | "custom";
885
- /**
886
- * Plan type
887
- * @example recurring
888
- * @enum {string}
889
- */
890
- type?: "recurring" | "one-time";
891
- /**
892
- * Included free units
893
- * @example 1000
894
- */
895
- freeUnits?: number;
896
- /**
897
- * Meter id for usage tracking
898
- * @example 67f90f1f1b1c9c0b8df0f001
899
- */
900
- meterId?: string;
901
- /**
902
- * Plan usage limit
903
- * @example 10000
904
- */
905
- limit?: number;
906
- /** @description Plan features */
907
- features?: {
482
+ metadata: {
908
483
  [key: string]: unknown;
909
484
  };
910
485
  };
911
- McpBootstrapToolInput: {
912
- /**
913
- * Tool name
914
- * @example search_docs
915
- */
916
- name: string;
917
- /**
918
- * Tool description
919
- * @example Search indexed documents
920
- */
921
- description?: string;
922
- /**
923
- * If true, tool is publicly available without a plan
924
- * @example false
925
- */
926
- noPlan?: boolean;
927
- /**
928
- * Direct plan IDs allowed for this tool
929
- * @example [
930
- * "67f90f1f1b1c9c0b8df0f001"
931
- * ]
932
- */
933
- planIds?: string[];
934
- /**
935
- * Plan references allowed for this tool
936
- * @example [
937
- * "pln_ABC123"
938
- * ]
939
- */
940
- planRefs?: string[];
941
- /**
942
- * Bootstrap plan keys allowed for this tool (for example free or starter_paid)
943
- * @example [
944
- * "free"
945
- * ]
946
- */
947
- planKeys?: string[];
948
- };
949
- McpBootstrapRequest: {
950
- /**
951
- * Product name (optional when derivable from origin MCP metadata)
952
- * @example Acme MCP Toolkit
953
- */
486
+ McpBootstrapDto: {
954
487
  name?: string;
955
- /**
956
- * Product description
957
- * @example MCP toolkit with tiered access
958
- */
959
488
  description?: string;
960
- /** @description Product image URL */
961
489
  imageUrl?: string;
962
- /**
963
- * Free-form product type
964
- * @example MCP Server
965
- */
966
490
  productType?: string;
967
- /**
968
- * Origin MCP server URL (must be https)
969
- * @example https://origin.example.com/mcp
970
- */
491
+ /** Format: uri */
971
492
  originUrl: string;
972
- /**
973
- * Optional final MCP subdomain override (for example, value returned by bootstrap-subdomain-checks)
974
- * @example acme-docs
975
- */
976
493
  mcpDomain?: string;
977
- /**
978
- * Optional auth header name forwarded to origin server
979
- * @example X-API-Key
980
- */
981
494
  authHeaderName?: string;
982
- /**
983
- * Optional auth API key forwarded to origin server
984
- * @example sk-origin-123
985
- */
986
495
  authApiKey?: string;
987
- /** @description Free plan config overrides. A free plan is always created; this just customizes name/freeUnits. */
988
- freePlan?: components["schemas"]["McpBootstrapFreePlanConfig"];
989
- /** @description Paid plan definitions requiring price + currency */
990
- paidPlans?: components["schemas"]["McpBootstrapPaidPlanInput"][];
991
- /** @description Tool to plan mapping configuration */
992
- tools?: components["schemas"]["McpBootstrapToolInput"][];
993
- /** @description Arbitrary product metadata */
994
- metadata?: {
496
+ plans?: {
497
+ key: string;
498
+ name: string;
499
+ price: number;
500
+ currency: string;
501
+ /** @enum {string} */
502
+ billingCycle?: "weekly" | "monthly" | "quarterly" | "yearly" | "custom";
503
+ /** @enum {string} */
504
+ type?: "recurring" | "one-time" | "usage-based";
505
+ pricePerUnit?: number;
506
+ /** @enum {string} */
507
+ billingModel?: "pre-paid" | "post-paid";
508
+ freeUnits?: number;
509
+ meterId?: string;
510
+ limit?: number;
511
+ features?: {
512
+ [key: string]: unknown;
513
+ };
514
+ }[];
515
+ tools?: {
516
+ name: string;
517
+ description?: string;
518
+ noPlan?: boolean;
519
+ planIds?: string[];
520
+ planRefs?: string[];
521
+ planKeys?: string[];
522
+ }[];
523
+ metadata: {
995
524
  [key: string]: unknown;
996
525
  };
997
526
  };
@@ -1036,130 +565,138 @@ interface components {
1036
565
  description?: string;
1037
566
  }[];
1038
567
  };
1039
- McpBootstrapPreviewResult: {
1040
- /** @description Discovered tools from the origin MCP server */
1041
- discoveredTools: {
1042
- name?: string;
1043
- description?: string;
568
+ ConfigureMcpPlansDto: {
569
+ plans?: {
570
+ key: string;
571
+ name: string;
572
+ price: number;
573
+ currency: string;
574
+ /** @enum {string} */
575
+ billingCycle?: "weekly" | "monthly" | "quarterly" | "yearly" | "custom";
576
+ /** @enum {string} */
577
+ type?: "recurring" | "one-time" | "usage-based";
578
+ pricePerUnit?: number;
579
+ /** @enum {string} */
580
+ billingModel?: "pre-paid" | "post-paid";
581
+ freeUnits?: number;
582
+ meterId?: string;
583
+ limit?: number;
584
+ features?: {
585
+ [key: string]: unknown;
586
+ };
587
+ }[];
588
+ toolMapping?: {
589
+ name: string;
590
+ planKeys: string[];
1044
591
  }[];
1045
- /** @description Validation status for the provided bootstrap payload */
1046
- validation: {
1047
- valid?: boolean;
1048
- errors?: components["schemas"]["McpBootstrapPreviewValidationError"][];
592
+ };
593
+ ConfigureMcpPlansResult: {
594
+ /** @description Updated product */
595
+ product: components["schemas"]["SdkProductResponse"];
596
+ /** @description Updated MCP server identity */
597
+ mcpServer: {
598
+ [key: string]: unknown;
1049
599
  };
600
+ /** @description Resolved plan mapping by key (includes existing free plan) */
601
+ planMap: {
602
+ [key: string]: unknown;
603
+ };
604
+ };
605
+ CloneProductDto: {
606
+ name?: string;
607
+ };
608
+ CreateUsageRequest: {
609
+ customerId: string;
1050
610
  /**
1051
- * Product name derived from origin MCP metadata or hostname fallback
1052
- * @example acme-origin-mcp
611
+ * @default api_call
612
+ * @enum {string}
1053
613
  */
1054
- derivedName?: string;
614
+ actionType: "transaction" | "api_call" | "hour" | "email" | "storage" | "custom";
615
+ /** @default 1 */
616
+ units: number;
1055
617
  /**
1056
- * Product description derived from origin server instructions
1057
- * @example MCP toolkit for document retrieval and summarization.
618
+ * @default success
619
+ * @enum {string}
1058
620
  */
1059
- derivedDescription?: string;
1060
- /** @description Source of derived metadata */
1061
- metadataSource: {
1062
- /** @enum {string} */
1063
- name?: "request" | "origin" | "hostname";
1064
- /** @enum {string} */
1065
- description?: "request" | "instructions" | "none";
621
+ outcome: "success" | "paywall" | "fail";
622
+ productReference?: string;
623
+ purchaseReference?: string;
624
+ description?: string;
625
+ errorMessage?: string;
626
+ metadata: {
627
+ [key: string]: unknown;
1066
628
  };
1067
- /** @description Suggested default tool-to-plan mapping for UI review */
1068
- suggestedMapping: {
1069
- name?: string;
629
+ duration?: number;
630
+ /** Format: date-time */
631
+ timestamp: string;
632
+ idempotencyKey?: string;
633
+ };
634
+ BulkCreateUsageRequest: {
635
+ events: {
636
+ customerId: string;
637
+ /**
638
+ * @default api_call
639
+ * @enum {string}
640
+ */
641
+ actionType: "transaction" | "api_call" | "hour" | "email" | "storage" | "custom";
642
+ /** @default 1 */
643
+ units: number;
644
+ /**
645
+ * @default success
646
+ * @enum {string}
647
+ */
648
+ outcome: "success" | "paywall" | "fail";
649
+ productReference?: string;
650
+ purchaseReference?: string;
1070
651
  description?: string;
1071
- planKey?: string;
652
+ errorMessage?: string;
653
+ metadata?: {
654
+ [key: string]: unknown;
655
+ };
656
+ duration?: number;
657
+ /** Format: date-time */
658
+ timestamp: string;
659
+ idempotencyKey?: string;
1072
660
  }[];
1073
661
  };
1074
- RecordMeterEventDto: {
1075
- /**
1076
- * Meter name to record against
1077
- * @example requests
1078
- */
662
+ RecordMeterEventZodDto: {
1079
663
  meterName: string;
1080
- /**
1081
- * Customer reference
1082
- * @example cus_ABC123
1083
- */
1084
664
  customerId: string;
1085
- /**
1086
- * Numeric value (default 1)
1087
- * @default 1
1088
- * @example 1
1089
- */
1090
- value: number;
1091
- /**
1092
- * Arbitrary key-value tags
1093
- * @example {
1094
- * "endpoint": "/api/v1/search",
1095
- * "region": "us-east-1"
1096
- * }
1097
- */
1098
- properties?: {
665
+ value?: number;
666
+ properties: {
1099
667
  [key: string]: unknown;
1100
668
  };
1101
- /** @description Product ID to scope the usage event to */
1102
669
  productId?: string;
1103
- /** @description Product reference to scope the usage event to */
1104
670
  productReference?: string;
1105
- /** @description ISO 8601 timestamp (defaults to now) */
1106
671
  timestamp?: string;
1107
672
  };
1108
- RecordBulkMeterEventsDto: {
1109
- /** @description Array of events to record */
1110
- events: components["schemas"]["RecordMeterEventDto"][];
1111
- };
1112
- CreateCustomerSessionRequest: {
1113
- /**
1114
- * Customer reference identifier
1115
- * @example cus_3c4d5e6f7g8h
1116
- */
1117
- customerRef: string;
1118
- /**
1119
- * Optional product reference or ID to scope the customer manage page to a single product.
1120
- * @example prd_1a2b3c4d5e6f
1121
- */
1122
- productRef?: string;
1123
- };
1124
- CustomerSessionResponse: {
1125
- /**
1126
- * Customer session ID
1127
- * @example 507f1f77bcf86cd799439011
1128
- */
1129
- id: string;
1130
- /**
1131
- * Public session ID used in customer URL
1132
- * @example e3f1c2d4b6a89f001122334455667788
1133
- */
1134
- sessionId: string;
1135
- /**
1136
- * Session status
1137
- * @example active
1138
- */
1139
- status: string;
1140
- /**
1141
- * Customer URL to open the customer page
1142
- * @example https://solvapay.com/customer/manage?id=e3f1c2d4b6a89f001122334455667788
1143
- */
1144
- customerUrl: string;
673
+ RecordBulkMeterEventsZodDto: {
674
+ events: {
675
+ meterName: string;
676
+ customerId: string;
677
+ value?: number;
678
+ properties?: {
679
+ [key: string]: unknown;
680
+ };
681
+ productId?: string;
682
+ productReference?: string;
683
+ timestamp?: string;
684
+ }[];
1145
685
  };
1146
686
  CreateCustomerRequest: {
1147
- /**
1148
- * Customer email address (required)
1149
- * @example customer@example.com
1150
- */
687
+ /** Format: email */
1151
688
  email: string;
1152
- /**
1153
- * Customer full name (optional)
1154
- * @example John Doe
1155
- */
1156
689
  name?: string;
1157
- /**
1158
- * External reference ID from your auth system to map this customer to an auth user (optional)
1159
- * @example auth_user_12345
1160
- */
690
+ telephone?: string;
691
+ metadata: {
692
+ [key: string]: unknown;
693
+ };
1161
694
  externalRef?: string;
1162
695
  };
696
+ CreateCustomerSessionRequest: {
697
+ customerRef: string;
698
+ productRef?: string;
699
+ };
1163
700
  PurchaseInfo: {
1164
701
  /**
1165
702
  * Purchase reference
@@ -1187,15 +724,25 @@ interface components {
1187
724
  */
1188
725
  startDate: string;
1189
726
  /**
1190
- * Amount paid in original currency (in cents)
727
+ * Amount in USD cents (normalised for aggregation)
1191
728
  * @example 9900
1192
729
  */
1193
730
  amount: number;
1194
731
  /**
1195
- * Currency code
1196
- * @example USD
732
+ * Original amount in the payment currency (minor units)
733
+ * @example 7500
734
+ */
735
+ originalAmount?: number;
736
+ /**
737
+ * ISO 4217 currency code of the customer-facing charge
738
+ * @example GBP
1197
739
  */
1198
740
  currency: string;
741
+ /**
742
+ * Exchange rate from original currency to USD
743
+ * @example 1.32
744
+ */
745
+ exchangeRate?: number;
1199
746
  /**
1200
747
  * End date of purchase
1201
748
  * @example 2025-11-27T10:00:00Z
@@ -1286,15 +833,7 @@ interface components {
1286
833
  updatedAt: string;
1287
834
  };
1288
835
  UserInfoRequest: {
1289
- /**
1290
- * Customer reference
1291
- * @example cus_3C4D5E6F
1292
- */
1293
836
  customerRef: string;
1294
- /**
1295
- * Product reference
1296
- * @example prd_1A2B3C4D
1297
- */
1298
837
  productRef: string;
1299
838
  };
1300
839
  UserInfoUserDto: {
@@ -1371,457 +910,1430 @@ interface components {
1371
910
  user?: components["schemas"]["UserInfoUserDto"];
1372
911
  purchase?: components["schemas"]["UserInfoPurchaseDto"];
1373
912
  };
1374
- McpToolDto: {
913
+ PlanSnapshotDto: {
1375
914
  /**
1376
- * Tool name
1377
- * @example search_documents
915
+ * Plan reference
916
+ * @example pln_1A2B3C4D
1378
917
  */
1379
- name: string;
918
+ reference?: string;
1380
919
  /**
1381
- * Plan IDs that grant access to this tool
1382
- * @example [
1383
- * "pln_abc123"
1384
- * ]
920
+ * Plan price in cents
921
+ * @example 2999
1385
922
  */
1386
- planIds?: string[];
923
+ price: number;
1387
924
  /**
1388
- * If true, the tool is unprotected (no purchase check or usage tracking)
1389
- * @example false
925
+ * Currency code
926
+ * @example USD
1390
927
  */
1391
- noPlan?: boolean;
928
+ currency: string;
1392
929
  /**
1393
- * Human-readable tool description
1394
- * @example Search indexed documents
930
+ * Plan type
931
+ * @example recurring
1395
932
  */
1396
- description?: string;
933
+ planType: string;
1397
934
  /**
1398
- * Whether this is a virtual platform tool handled by SolvaPay
1399
- * @example false
935
+ * Billing cycle
936
+ * @example monthly
1400
937
  */
1401
- isVirtual?: boolean;
1402
- };
1403
- McpServerDto: {
1404
- /**
1405
- * Server ID
1406
- * @example 507f1f77bcf86cd799439011
1407
- */
1408
- id?: string;
938
+ billingCycle?: string | null;
939
+ /** @description Plan features */
940
+ features?: {
941
+ [key: string]: unknown;
942
+ } | null;
943
+ /** @description Usage limits */
944
+ limits?: {
945
+ [key: string]: unknown;
946
+ } | null;
1409
947
  /**
1410
- * Unique server reference
1411
- * @example mcp_abc123
948
+ * Meter ObjectId reference
949
+ * @example 507f1f77bcf86cd799439011
1412
950
  */
1413
- reference?: string;
951
+ meterId?: string;
1414
952
  /**
1415
- * Domain slug used to derive the MCP endpoint subdomain
1416
- * @example my-mcp-server
953
+ * Usage limit for the meter
954
+ * @example 5000
1417
955
  */
1418
- name: string;
956
+ limit?: number;
1419
957
  /**
1420
- * URL-safe subdomain derived from name
1421
- * @example my-mcp-server
958
+ * Number of free units included
959
+ * @example 100
1422
960
  */
1423
- subdomain: string;
961
+ freeUnits?: number;
1424
962
  /**
1425
- * SolvaPay proxy URL that MCP clients connect to
1426
- * @example https://mytelescope.mcp.solvapay.com/mcp
963
+ * Price per usage unit in cents (supports decimals, e.g. 0.1 = 1/10 cent)
964
+ * @example 0.1
1427
965
  */
1428
- mcpProxyUrl?: string;
966
+ pricePerUnit?: number;
967
+ };
968
+ UsageBillingDto: {
1429
969
  /**
1430
- * Origin URL of the actual MCP server
1431
- * @example https://origin.example.com/mcp
970
+ * Units consumed in current period
971
+ * @example 150
1432
972
  */
1433
- url: string;
973
+ used: number;
1434
974
  /**
1435
- * Avatar image URL
1436
- * @example https://example.com/avatar.png
975
+ * Units exceeding the plan limit
976
+ * @example 0
1437
977
  */
1438
- avatarUrl?: string;
1439
- /** @description Registered tools for this server */
1440
- tools?: components["schemas"]["McpToolDto"][];
978
+ overageUnits: number;
1441
979
  /**
1442
- * Default plan ID for tool access gating. Must belong to the linked product and be a free-tier plan (isFreeTier=true or price=0).
1443
- * @example pln_default
980
+ * Overage cost in cents
981
+ * @example 0
1444
982
  */
1445
- defaultPlanId?: string;
983
+ overageCost: number;
1446
984
  /**
1447
- * Associated product ID
1448
- * @example 507f1f77bcf86cd799439011
985
+ * Period start date
986
+ * @example 2025-10-01T00:00:00Z
1449
987
  */
1450
- productId?: string;
988
+ periodStart?: string;
1451
989
  /**
1452
- * Server status
1453
- * @example active
1454
- * @enum {string}
990
+ * Period end date
991
+ * @example 2025-11-01T00:00:00Z
1455
992
  */
1456
- status?: "active" | "inactive" | "suspended";
993
+ periodEnd?: string;
994
+ };
995
+ PurchaseResponse: {
1457
996
  /**
1458
- * Provider ID that owns this server
997
+ * Purchase ID
1459
998
  * @example 507f1f77bcf86cd799439011
1460
999
  */
1461
- providerId: string;
1000
+ id: string;
1462
1001
  /**
1463
- * Custom auth header name for origin requests
1464
- * @example X-API-Key
1002
+ * Purchase reference
1003
+ * @example pur_1A2B3C4D
1465
1004
  */
1466
- authHeaderName?: string;
1005
+ reference: string;
1467
1006
  /**
1468
- * Whether an auth API key is configured
1469
- * @example true
1007
+ * Customer reference
1008
+ * @example cus_3C4D5E6F
1470
1009
  */
1471
- hasAuthApiKey?: boolean;
1010
+ customerRef: string;
1472
1011
  /**
1473
- * Total number of tool-call transactions
1474
- * @example 42
1012
+ * Customer email
1013
+ * @example customer@example.com
1475
1014
  */
1476
- totalTransactions?: number;
1015
+ customerEmail: string;
1477
1016
  /**
1478
- * Current balance in cents
1479
- * @example 1500
1017
+ * Product reference
1018
+ * @example prd_1A2B3C4D
1480
1019
  */
1481
- balance?: number;
1482
- };
1483
- PlanSnapshotDto: {
1020
+ productRef: string;
1484
1021
  /**
1485
- * Plan reference
1486
- * @example pln_1A2B3C4D
1022
+ * Product ID
1023
+ * @example 507f1f77bcf86cd799439012
1487
1024
  */
1488
- reference?: string;
1025
+ productId?: string;
1489
1026
  /**
1490
- * Plan price in cents
1491
- * @example 2999
1027
+ * Product name
1028
+ * @example API Gateway Manager
1492
1029
  */
1493
- price: number;
1030
+ productName?: string;
1031
+ /** @description Plan snapshot at time of purchase (null for credit topups) */
1032
+ planSnapshot?: components["schemas"]["PlanSnapshotDto"];
1494
1033
  /**
1495
- * Currency code
1496
- * @example USD
1034
+ * Purchase status
1035
+ * @example active
1497
1036
  */
1498
- currency: string;
1037
+ status: string;
1499
1038
  /**
1500
- * Plan type
1501
- * @example recurring
1039
+ * Amount in USD cents (normalised for aggregation)
1040
+ * @example 9900
1502
1041
  */
1503
- planType: string;
1042
+ amount: number;
1504
1043
  /**
1505
- * Billing cycle
1506
- * @example monthly
1044
+ * Original amount in the payment currency (cents/pence)
1045
+ * @example 10000
1507
1046
  */
1508
- billingCycle?: string | null;
1509
- /** @description Plan features */
1510
- features?: {
1511
- [key: string]: unknown;
1512
- } | null;
1513
- /** @description Usage limits */
1514
- limits?: {
1515
- [key: string]: unknown;
1516
- } | null;
1047
+ originalAmount?: number;
1517
1048
  /**
1518
- * Meter ObjectId reference
1519
- * @example 507f1f77bcf86cd799439011
1049
+ * Original payment currency code
1050
+ * @example GBP
1520
1051
  */
1521
- meterId?: string;
1052
+ currency: string;
1522
1053
  /**
1523
- * Usage limit for the meter
1524
- * @example 5000
1054
+ * Exchange rate from original currency to USD
1055
+ * @example 1.3082
1525
1056
  */
1526
- limit?: number;
1057
+ exchangeRate?: number;
1058
+ /** @description Start date */
1059
+ startDate: string;
1060
+ /** @description End date */
1061
+ endDate?: string;
1062
+ /** @description Paid at timestamp */
1063
+ paidAt?: string;
1064
+ /** @description Usage billing state for usage-based plans */
1065
+ usage?: components["schemas"]["UsageBillingDto"];
1527
1066
  /**
1528
- * Number of free units included
1529
- * @example 100
1067
+ * Is recurring
1068
+ * @example true
1530
1069
  */
1531
- freeUnits?: number;
1070
+ isRecurring: boolean;
1532
1071
  /**
1533
- * Price per usage unit in cents
1534
- * @example 10
1072
+ * Billing cycle
1073
+ * @enum {string}
1535
1074
  */
1075
+ billingCycle?: "weekly" | "monthly" | "quarterly" | "yearly";
1076
+ /** @description Next billing date */
1077
+ nextBillingDate?: string;
1078
+ /** @description Auto-renew enabled */
1079
+ autoRenew?: boolean;
1080
+ /** @description Cancelled at */
1081
+ cancelledAt?: string;
1082
+ /** @description Cancellation reason */
1083
+ cancellationReason?: string;
1084
+ /** @description Arbitrary metadata attached to the purchase */
1085
+ metadata?: {
1086
+ [key: string]: unknown;
1087
+ };
1088
+ /** @description Created at */
1089
+ createdAt: string;
1090
+ };
1091
+ CheckLimitRequest: {
1092
+ customerRef: string;
1093
+ productRef: string;
1094
+ planRef?: string;
1095
+ meterName?: string;
1096
+ usageType?: string;
1097
+ };
1098
+ LimitPlanItemDto: {
1099
+ reference: string;
1100
+ name?: string;
1101
+ type: string;
1102
+ /** @description Price in smallest currency unit (e.g. cents) */
1103
+ price: number;
1104
+ currency: string;
1105
+ requiresPayment: boolean;
1106
+ freeUnits?: number;
1107
+ /** @description Price per usage unit in mils (usage-based plans) */
1536
1108
  pricePerUnit?: number;
1109
+ billingModel?: string;
1110
+ billingCycle?: string;
1537
1111
  };
1538
- UsageBillingDto: {
1112
+ LimitBalanceDto: {
1113
+ /** @description Credit balance in mils */
1114
+ creditBalance: number;
1115
+ /** @description Price per usage unit in mils */
1116
+ pricePerUnit: number;
1117
+ currency: string;
1118
+ /** @description Estimated whole units remaining from prepaid balance at current pricePerUnit */
1119
+ remainingUnits?: number;
1120
+ };
1121
+ LimitProductBriefDto: {
1122
+ id?: string;
1123
+ reference: string;
1124
+ name?: string;
1125
+ };
1126
+ LimitResponse: {
1539
1127
  /**
1540
- * Units consumed in current period
1541
- * @example 150
1128
+ * Whether the customer is within their usage limits
1129
+ * @example true
1542
1130
  */
1543
- used: number;
1131
+ withinLimits: boolean;
1544
1132
  /**
1545
- * Units exceeding the plan limit
1546
- * @example 0
1133
+ * Remaining usage units before hitting the limit
1134
+ * @example 997
1547
1135
  */
1548
- overageUnits: number;
1136
+ remaining: number;
1549
1137
  /**
1550
- * Overage cost in cents
1551
- * @example 0
1138
+ * Checkout session ID if payment is required
1139
+ * @example e3f1c2d4b6a89f001122334455667788
1552
1140
  */
1553
- overageCost: number;
1141
+ checkoutSessionId?: string;
1554
1142
  /**
1555
- * Period start date
1556
- * @example 2025-10-01T00:00:00Z
1143
+ * Checkout URL if payment is required
1144
+ * @example https://solvapay.com/customer/checkout?id=e3f1c2d4b6a89f001122334455667788
1557
1145
  */
1558
- periodStart?: string;
1146
+ checkoutUrl?: string;
1559
1147
  /**
1560
- * Period end date
1561
- * @example 2025-11-01T00:00:00Z
1148
+ * The meter name to use when tracking usage events
1149
+ * @example requests
1562
1150
  */
1563
- periodEnd?: string;
1151
+ meterName?: string;
1152
+ /** @description Credit balance in mils (for pre-paid usage-based plans) */
1153
+ creditBalance?: number;
1154
+ /** @description Price per usage unit in mils (for pre-paid usage-based plans) */
1155
+ pricePerUnit?: number;
1156
+ /** @description ISO 4217 currency code for credit fields */
1157
+ currency?: string;
1158
+ /** @description True when the customer must activate a priced default plan before usage is allowed */
1159
+ activationRequired?: boolean;
1160
+ /** @description Active plans on the product available for activation or checkout */
1161
+ plans?: components["schemas"]["LimitPlanItemDto"][];
1162
+ /** @description Prepaid usage balance context when the default plan is usage-based */
1163
+ balance?: components["schemas"]["LimitBalanceDto"];
1164
+ /** @description Product the limit check applies to */
1165
+ product?: components["schemas"]["LimitProductBriefDto"];
1166
+ /** @description Customer portal confirmation URL when activation is required (fallback when not starting checkout) */
1167
+ confirmationUrl?: string;
1168
+ };
1169
+ };
1170
+ responses: never;
1171
+ parameters: never;
1172
+ requestBodies: never;
1173
+ headers: never;
1174
+ pathItems: never;
1175
+ }
1176
+ interface operations {
1177
+ PaymentIntentSdkController_getPaymentIntents: {
1178
+ parameters: {
1179
+ query?: {
1180
+ /** @description Maximum number of results */
1181
+ limit?: number;
1182
+ /** @description Pagination offset */
1183
+ offset?: number;
1184
+ };
1185
+ header?: never;
1186
+ path?: never;
1187
+ cookie?: never;
1188
+ };
1189
+ requestBody?: never;
1190
+ responses: {
1191
+ /** @description Payment intents retrieved successfully */
1192
+ 200: {
1193
+ headers: {
1194
+ [name: string]: unknown;
1195
+ };
1196
+ content: {
1197
+ "application/json": unknown;
1198
+ };
1199
+ };
1200
+ };
1201
+ };
1202
+ PaymentIntentSdkController_createPaymentIntent: {
1203
+ parameters: {
1204
+ query?: never;
1205
+ header: {
1206
+ /** @description Unique idempotency key to prevent duplicate payments (required) */
1207
+ "idempotency-key": string;
1208
+ };
1209
+ path?: never;
1210
+ cookie?: never;
1211
+ };
1212
+ /** @description Payment intent creation data */
1213
+ requestBody: {
1214
+ content: {
1215
+ "application/json": components["schemas"]["CreatePaymentIntentDto"];
1216
+ };
1217
+ };
1218
+ responses: {
1219
+ /** @description Payment intent created successfully */
1220
+ 201: {
1221
+ headers: {
1222
+ [name: string]: unknown;
1223
+ };
1224
+ content: {
1225
+ "application/json": unknown;
1226
+ };
1227
+ };
1228
+ /** @description Missing required fields or invalid data */
1229
+ 400: {
1230
+ headers: {
1231
+ [name: string]: unknown;
1232
+ };
1233
+ content: {
1234
+ "application/json": unknown;
1235
+ };
1236
+ };
1237
+ };
1238
+ };
1239
+ PaymentIntentSdkController_getPaymentIntent: {
1240
+ parameters: {
1241
+ query?: never;
1242
+ header?: never;
1243
+ path: {
1244
+ /** @description Payment intent MongoDB ID */
1245
+ id: string;
1246
+ };
1247
+ cookie?: never;
1248
+ };
1249
+ requestBody?: never;
1250
+ responses: {
1251
+ /** @description Payment intent retrieved successfully */
1252
+ 200: {
1253
+ headers: {
1254
+ [name: string]: unknown;
1255
+ };
1256
+ content: {
1257
+ "application/json": unknown;
1258
+ };
1259
+ };
1260
+ /** @description Payment intent not found */
1261
+ 404: {
1262
+ headers: {
1263
+ [name: string]: unknown;
1264
+ };
1265
+ content: {
1266
+ "application/json": unknown;
1267
+ };
1268
+ };
1269
+ };
1270
+ };
1271
+ PaymentIntentSdkController_processPaymentIntent: {
1272
+ parameters: {
1273
+ query?: never;
1274
+ header?: never;
1275
+ path: {
1276
+ /** @description Stripe payment intent ID (format: pi_xxx) */
1277
+ id: string;
1278
+ };
1279
+ cookie?: never;
1280
+ };
1281
+ /** @description Payment processing data */
1282
+ requestBody: {
1283
+ content: {
1284
+ "application/json": components["schemas"]["ProcessPaymentIntentDto"];
1285
+ };
1286
+ };
1287
+ responses: {
1288
+ /** @description Payment intent status */
1289
+ 200: {
1290
+ headers: {
1291
+ [name: string]: unknown;
1292
+ };
1293
+ content: {
1294
+ "application/json": {
1295
+ /**
1296
+ * Payment intent status
1297
+ * @example succeeded
1298
+ * @enum {string}
1299
+ */
1300
+ status?: "succeeded" | "timeout" | "failed" | "cancelled";
1301
+ /**
1302
+ * Optional message, only present for timeout status
1303
+ * @example Timeout while waiting for payment intent confirmation, try again later. This could be due to Stripe webhooks not being configured correctly.
1304
+ */
1305
+ message?: string;
1306
+ };
1307
+ };
1308
+ };
1309
+ /** @description Payment not succeeded, invalid request, or forbidden */
1310
+ 400: {
1311
+ headers: {
1312
+ [name: string]: unknown;
1313
+ };
1314
+ content: {
1315
+ "application/json": unknown;
1316
+ };
1317
+ };
1318
+ };
1319
+ };
1320
+ CheckoutSessionSdkController_createCheckoutSession: {
1321
+ parameters: {
1322
+ query?: never;
1323
+ header?: never;
1324
+ path?: never;
1325
+ cookie?: never;
1326
+ };
1327
+ requestBody: {
1328
+ content: {
1329
+ "application/json": components["schemas"]["CreateCheckoutSessionRequest"];
1330
+ };
1331
+ };
1332
+ responses: {
1333
+ /** @description Checkout session created */
1334
+ 201: {
1335
+ headers: {
1336
+ [name: string]: unknown;
1337
+ };
1338
+ content: {
1339
+ "application/json": components["schemas"]["CreateCheckoutSessionResponse"];
1340
+ };
1341
+ };
1342
+ /** @description Missing customerRef or productRef */
1343
+ 400: {
1344
+ headers: {
1345
+ [name: string]: unknown;
1346
+ };
1347
+ content?: never;
1348
+ };
1349
+ };
1350
+ };
1351
+ PlanSdkController_listPlans: {
1352
+ parameters: {
1353
+ query?: {
1354
+ limit?: number;
1355
+ offset?: number;
1356
+ };
1357
+ header?: never;
1358
+ path: {
1359
+ /** @description Product reference or ID */
1360
+ productRef: string;
1361
+ };
1362
+ cookie?: never;
1363
+ };
1364
+ requestBody?: never;
1365
+ responses: {
1366
+ /** @description Plans retrieved successfully */
1367
+ 200: {
1368
+ headers: {
1369
+ [name: string]: unknown;
1370
+ };
1371
+ content: {
1372
+ "application/json": {
1373
+ plans?: components["schemas"]["Plan"][];
1374
+ /** @description Total number of plans for the product */
1375
+ total?: number;
1376
+ limit?: number;
1377
+ offset?: number;
1378
+ };
1379
+ };
1380
+ };
1381
+ /** @description Product not found */
1382
+ 404: {
1383
+ headers: {
1384
+ [name: string]: unknown;
1385
+ };
1386
+ content?: never;
1387
+ };
1388
+ };
1389
+ };
1390
+ PlanSdkController_createPlan: {
1391
+ parameters: {
1392
+ query?: never;
1393
+ header?: never;
1394
+ path: {
1395
+ /** @description Product reference or ID */
1396
+ productRef: string;
1397
+ };
1398
+ cookie?: never;
1399
+ };
1400
+ requestBody: {
1401
+ content: {
1402
+ "application/json": components["schemas"]["CreatePlanRequest"];
1403
+ };
1404
+ };
1405
+ responses: {
1406
+ /** @description Plan created successfully */
1407
+ 201: {
1408
+ headers: {
1409
+ [name: string]: unknown;
1410
+ };
1411
+ content: {
1412
+ "application/json": components["schemas"]["Plan"];
1413
+ };
1414
+ };
1415
+ /** @description Product not found */
1416
+ 404: {
1417
+ headers: {
1418
+ [name: string]: unknown;
1419
+ };
1420
+ content?: never;
1421
+ };
1422
+ };
1423
+ };
1424
+ PlanSdkController_getPlan: {
1425
+ parameters: {
1426
+ query?: never;
1427
+ header?: never;
1428
+ path: {
1429
+ /** @description Product reference or ID */
1430
+ productRef: string;
1431
+ /** @description Plan reference or ID */
1432
+ planRef: string;
1433
+ };
1434
+ cookie?: never;
1435
+ };
1436
+ requestBody?: never;
1437
+ responses: {
1438
+ /** @description Plan retrieved successfully */
1439
+ 200: {
1440
+ headers: {
1441
+ [name: string]: unknown;
1442
+ };
1443
+ content: {
1444
+ "application/json": components["schemas"]["Plan"];
1445
+ };
1446
+ };
1447
+ /** @description Plan or product not found */
1448
+ 404: {
1449
+ headers: {
1450
+ [name: string]: unknown;
1451
+ };
1452
+ content?: never;
1453
+ };
1454
+ };
1455
+ };
1456
+ PlanSdkController_updatePlan: {
1457
+ parameters: {
1458
+ query?: never;
1459
+ header?: never;
1460
+ path: {
1461
+ /** @description Product reference or ID */
1462
+ productRef: string;
1463
+ /** @description Plan reference or ID */
1464
+ planRef: string;
1465
+ };
1466
+ cookie?: never;
1467
+ };
1468
+ requestBody: {
1469
+ content: {
1470
+ "application/json": components["schemas"]["UpdatePlanRequest"];
1471
+ };
1472
+ };
1473
+ responses: {
1474
+ /** @description Plan updated successfully */
1475
+ 200: {
1476
+ headers: {
1477
+ [name: string]: unknown;
1478
+ };
1479
+ content: {
1480
+ "application/json": components["schemas"]["Plan"];
1481
+ };
1482
+ };
1483
+ /** @description Plan or product not found */
1484
+ 404: {
1485
+ headers: {
1486
+ [name: string]: unknown;
1487
+ };
1488
+ content?: never;
1489
+ };
1490
+ };
1491
+ };
1492
+ PlanSdkController_deletePlan: {
1493
+ parameters: {
1494
+ query?: never;
1495
+ header?: never;
1496
+ path: {
1497
+ /** @description Product reference or ID */
1498
+ productRef: string;
1499
+ /** @description Plan reference or ID */
1500
+ planRef: string;
1501
+ };
1502
+ cookie?: never;
1503
+ };
1504
+ requestBody?: never;
1505
+ responses: {
1506
+ /** @description Plan deleted successfully */
1507
+ 200: {
1508
+ headers: {
1509
+ [name: string]: unknown;
1510
+ };
1511
+ content?: never;
1512
+ };
1513
+ /** @description Plan or product not found */
1514
+ 404: {
1515
+ headers: {
1516
+ [name: string]: unknown;
1517
+ };
1518
+ content?: never;
1519
+ };
1520
+ };
1521
+ };
1522
+ ProductSdkController_listProducts: {
1523
+ parameters: {
1524
+ query?: {
1525
+ /** @description Max results (1-100) */
1526
+ limit?: number;
1527
+ /** @description Pagination offset */
1528
+ offset?: number;
1529
+ /** @description Search by name or description */
1530
+ search?: string;
1531
+ /** @description Filter by status */
1532
+ status?: "active" | "inactive" | "suspended";
1533
+ /** @description Filter MCP Pay products */
1534
+ isMcpPay?: boolean;
1535
+ };
1536
+ header?: never;
1537
+ path?: never;
1538
+ cookie?: never;
1539
+ };
1540
+ requestBody?: never;
1541
+ responses: {
1542
+ /** @description Products retrieved successfully */
1543
+ 200: {
1544
+ headers: {
1545
+ [name: string]: unknown;
1546
+ };
1547
+ content?: never;
1548
+ };
1549
+ };
1550
+ };
1551
+ ProductSdkController_createProduct: {
1552
+ parameters: {
1553
+ query?: never;
1554
+ header?: never;
1555
+ path?: never;
1556
+ cookie?: never;
1557
+ };
1558
+ requestBody: {
1559
+ content: {
1560
+ "application/json": components["schemas"]["CreateProductRequest"];
1561
+ };
1562
+ };
1563
+ responses: {
1564
+ /** @description Product created successfully */
1565
+ 201: {
1566
+ headers: {
1567
+ [name: string]: unknown;
1568
+ };
1569
+ content: {
1570
+ "application/json": components["schemas"]["SdkProductResponse"];
1571
+ };
1572
+ };
1573
+ /** @description Missing required fields or validation error */
1574
+ 400: {
1575
+ headers: {
1576
+ [name: string]: unknown;
1577
+ };
1578
+ content?: never;
1579
+ };
1580
+ };
1581
+ };
1582
+ ProductSdkController_getProduct: {
1583
+ parameters: {
1584
+ query?: never;
1585
+ header?: never;
1586
+ path: {
1587
+ /** @description Product reference or ID */
1588
+ productRef: string;
1589
+ };
1590
+ cookie?: never;
1591
+ };
1592
+ requestBody?: never;
1593
+ responses: {
1594
+ /** @description Product retrieved successfully */
1595
+ 200: {
1596
+ headers: {
1597
+ [name: string]: unknown;
1598
+ };
1599
+ content: {
1600
+ "application/json": components["schemas"]["SdkProductResponse"];
1601
+ };
1602
+ };
1603
+ /** @description Product not found */
1604
+ 404: {
1605
+ headers: {
1606
+ [name: string]: unknown;
1607
+ };
1608
+ content?: never;
1609
+ };
1610
+ };
1611
+ };
1612
+ ProductSdkController_updateProduct: {
1613
+ parameters: {
1614
+ query?: never;
1615
+ header?: never;
1616
+ path: {
1617
+ /** @description Product reference or ID */
1618
+ productRef: string;
1619
+ };
1620
+ cookie?: never;
1621
+ };
1622
+ requestBody: {
1623
+ content: {
1624
+ "application/json": components["schemas"]["UpdateProductRequest"];
1625
+ };
1626
+ };
1627
+ responses: {
1628
+ /** @description Product updated successfully */
1629
+ 200: {
1630
+ headers: {
1631
+ [name: string]: unknown;
1632
+ };
1633
+ content: {
1634
+ "application/json": components["schemas"]["SdkProductResponse"];
1635
+ };
1636
+ };
1637
+ /** @description Product not found */
1638
+ 404: {
1639
+ headers: {
1640
+ [name: string]: unknown;
1641
+ };
1642
+ content?: never;
1643
+ };
1644
+ };
1645
+ };
1646
+ ProductSdkController_deleteProduct: {
1647
+ parameters: {
1648
+ query?: never;
1649
+ header?: never;
1650
+ path: {
1651
+ /** @description Product reference or ID */
1652
+ productRef: string;
1653
+ };
1654
+ cookie?: never;
1655
+ };
1656
+ requestBody?: never;
1657
+ responses: {
1658
+ /** @description Product deleted or deactivated successfully */
1659
+ 200: {
1660
+ headers: {
1661
+ [name: string]: unknown;
1662
+ };
1663
+ content?: never;
1664
+ };
1665
+ /** @description Product not found */
1666
+ 404: {
1667
+ headers: {
1668
+ [name: string]: unknown;
1669
+ };
1670
+ content?: never;
1671
+ };
1672
+ };
1673
+ };
1674
+ ProductSdkController_bootstrapMcpProduct: {
1675
+ parameters: {
1676
+ query?: never;
1677
+ header?: never;
1678
+ path?: never;
1679
+ cookie?: never;
1680
+ };
1681
+ requestBody: {
1682
+ content: {
1683
+ "application/json": components["schemas"]["McpBootstrapDto"];
1684
+ };
1685
+ };
1686
+ responses: {
1687
+ /** @description MCP product bootstrapped successfully */
1688
+ 201: {
1689
+ headers: {
1690
+ [name: string]: unknown;
1691
+ };
1692
+ content: {
1693
+ "application/json": components["schemas"]["McpBootstrapResult"];
1694
+ };
1695
+ };
1696
+ /** @description Invalid bootstrap request */
1697
+ 400: {
1698
+ headers: {
1699
+ [name: string]: unknown;
1700
+ };
1701
+ content?: never;
1702
+ };
1703
+ };
1704
+ };
1705
+ ProductSdkController_configureMcpPlans: {
1706
+ parameters: {
1707
+ query?: never;
1708
+ header?: never;
1709
+ path: {
1710
+ /** @description Product reference or ID */
1711
+ productRef: string;
1712
+ };
1713
+ cookie?: never;
1714
+ };
1715
+ requestBody: {
1716
+ content: {
1717
+ "application/json": components["schemas"]["ConfigureMcpPlansDto"];
1718
+ };
1719
+ };
1720
+ responses: {
1721
+ /** @description MCP plans configured successfully */
1722
+ 200: {
1723
+ headers: {
1724
+ [name: string]: unknown;
1725
+ };
1726
+ content: {
1727
+ "application/json": components["schemas"]["ConfigureMcpPlansResult"];
1728
+ };
1729
+ };
1730
+ /** @description Invalid MCP plans request or product is not MCP-enabled */
1731
+ 400: {
1732
+ headers: {
1733
+ [name: string]: unknown;
1734
+ };
1735
+ content?: never;
1736
+ };
1737
+ /** @description Product not found */
1738
+ 404: {
1739
+ headers: {
1740
+ [name: string]: unknown;
1741
+ };
1742
+ content?: never;
1743
+ };
1744
+ };
1745
+ };
1746
+ ProductSdkController_cloneProduct: {
1747
+ parameters: {
1748
+ query?: never;
1749
+ header?: never;
1750
+ path: {
1751
+ /** @description Product reference or ID to clone */
1752
+ productRef: string;
1753
+ };
1754
+ cookie?: never;
1755
+ };
1756
+ requestBody: {
1757
+ content: {
1758
+ "application/json": components["schemas"]["CloneProductDto"];
1759
+ };
1760
+ };
1761
+ responses: {
1762
+ /** @description Product cloned successfully */
1763
+ 201: {
1764
+ headers: {
1765
+ [name: string]: unknown;
1766
+ };
1767
+ content: {
1768
+ "application/json": components["schemas"]["SdkProductResponse"];
1769
+ };
1770
+ };
1771
+ /** @description Product not found */
1772
+ 404: {
1773
+ headers: {
1774
+ [name: string]: unknown;
1775
+ };
1776
+ content?: never;
1777
+ };
1778
+ };
1779
+ };
1780
+ UsageSdkController_recordUsage: {
1781
+ parameters: {
1782
+ query?: never;
1783
+ header?: never;
1784
+ path?: never;
1785
+ cookie?: never;
1786
+ };
1787
+ requestBody: {
1788
+ content: {
1789
+ "application/json": components["schemas"]["CreateUsageRequest"];
1790
+ };
1791
+ };
1792
+ responses: {
1793
+ /** @description Usage recorded successfully */
1794
+ 200: {
1795
+ headers: {
1796
+ [name: string]: unknown;
1797
+ };
1798
+ content: {
1799
+ "application/json": {
1800
+ /** @example true */
1801
+ success?: boolean;
1802
+ /** @example usage_A1B2C3D4 */
1803
+ reference?: string;
1804
+ };
1805
+ };
1806
+ };
1807
+ /** @description Validation failed */
1808
+ 400: {
1809
+ headers: {
1810
+ [name: string]: unknown;
1811
+ };
1812
+ content?: never;
1813
+ };
1814
+ };
1815
+ };
1816
+ UsageSdkController_recordBulkUsage: {
1817
+ parameters: {
1818
+ query?: never;
1819
+ header?: never;
1820
+ path?: never;
1821
+ cookie?: never;
1822
+ };
1823
+ requestBody: {
1824
+ content: {
1825
+ "application/json": components["schemas"]["BulkCreateUsageRequest"];
1826
+ };
1827
+ };
1828
+ responses: {
1829
+ /** @description Bulk usage events processed */
1830
+ 200: {
1831
+ headers: {
1832
+ [name: string]: unknown;
1833
+ };
1834
+ content?: never;
1835
+ };
1836
+ /** @description Validation failed */
1837
+ 400: {
1838
+ headers: {
1839
+ [name: string]: unknown;
1840
+ };
1841
+ content?: never;
1842
+ };
1843
+ };
1844
+ };
1845
+ MeterEventsSdkController_recordEvent: {
1846
+ parameters: {
1847
+ query?: never;
1848
+ header?: never;
1849
+ path?: never;
1850
+ cookie?: never;
1851
+ };
1852
+ requestBody: {
1853
+ content: {
1854
+ "application/json": components["schemas"]["RecordMeterEventZodDto"];
1855
+ };
1856
+ };
1857
+ responses: {
1858
+ /** @description Event recorded */
1859
+ 200: {
1860
+ headers: {
1861
+ [name: string]: unknown;
1862
+ };
1863
+ content: {
1864
+ "application/json": {
1865
+ /** @example true */
1866
+ success?: boolean;
1867
+ };
1868
+ };
1869
+ };
1870
+ /** @description Invalid meter name or meter is archived */
1871
+ 400: {
1872
+ headers: {
1873
+ [name: string]: unknown;
1874
+ };
1875
+ content?: never;
1876
+ };
1877
+ };
1878
+ };
1879
+ MeterEventsSdkController_recordBulkEvents: {
1880
+ parameters: {
1881
+ query?: never;
1882
+ header?: never;
1883
+ path?: never;
1884
+ cookie?: never;
1885
+ };
1886
+ requestBody: {
1887
+ content: {
1888
+ "application/json": components["schemas"]["RecordBulkMeterEventsZodDto"];
1889
+ };
1890
+ };
1891
+ responses: {
1892
+ /** @description Events recorded */
1893
+ 200: {
1894
+ headers: {
1895
+ [name: string]: unknown;
1896
+ };
1897
+ content: {
1898
+ "application/json": {
1899
+ /** @example true */
1900
+ success?: boolean;
1901
+ /** @example 50 */
1902
+ inserted?: number;
1903
+ };
1904
+ };
1905
+ };
1906
+ /** @description Invalid meter name or meter is archived */
1907
+ 400: {
1908
+ headers: {
1909
+ [name: string]: unknown;
1910
+ };
1911
+ content?: never;
1912
+ };
1913
+ };
1914
+ };
1915
+ CustomerSdkController_getCustomerByQuery: {
1916
+ parameters: {
1917
+ query?: {
1918
+ /** @description Customer reference identifier (use exactly one query parameter) */
1919
+ reference?: string;
1920
+ /** @description External reference ID from your auth system (use exactly one query parameter) */
1921
+ externalRef?: string;
1922
+ /** @description Customer email address (use exactly one query parameter) */
1923
+ email?: string;
1924
+ };
1925
+ header?: never;
1926
+ path?: never;
1927
+ cookie?: never;
1928
+ };
1929
+ requestBody?: never;
1930
+ responses: {
1931
+ /** @description Customer retrieved successfully */
1932
+ 200: {
1933
+ headers: {
1934
+ [name: string]: unknown;
1935
+ };
1936
+ content: {
1937
+ "application/json": components["schemas"]["CustomerResponse"];
1938
+ };
1939
+ };
1940
+ /** @description Invalid request - must provide exactly one of reference, externalRef, or email */
1941
+ 400: {
1942
+ headers: {
1943
+ [name: string]: unknown;
1944
+ };
1945
+ content: {
1946
+ "application/json": unknown;
1947
+ };
1948
+ };
1949
+ /** @description Customer not found */
1950
+ 404: {
1951
+ headers: {
1952
+ [name: string]: unknown;
1953
+ };
1954
+ content: {
1955
+ "application/json": unknown;
1956
+ };
1957
+ };
1958
+ };
1959
+ };
1960
+ CustomerSdkController_createCustomer: {
1961
+ parameters: {
1962
+ query?: never;
1963
+ header?: never;
1964
+ path?: never;
1965
+ cookie?: never;
1966
+ };
1967
+ /** @description Customer creation data */
1968
+ requestBody: {
1969
+ content: {
1970
+ "application/json": components["schemas"]["CreateCustomerRequest"];
1971
+ };
1972
+ };
1973
+ responses: {
1974
+ /** @description Customer created successfully */
1975
+ 201: {
1976
+ headers: {
1977
+ [name: string]: unknown;
1978
+ };
1979
+ content: {
1980
+ "application/json": components["schemas"]["CustomerResponse"];
1981
+ };
1982
+ };
1983
+ /** @description Invalid email or missing required fields */
1984
+ 400: {
1985
+ headers: {
1986
+ [name: string]: unknown;
1987
+ };
1988
+ content: {
1989
+ "application/json": unknown;
1990
+ };
1991
+ };
1992
+ };
1993
+ };
1994
+ CustomerSdkController_getCustomer: {
1995
+ parameters: {
1996
+ query?: never;
1997
+ header?: never;
1998
+ path: {
1999
+ /** @description Customer reference identifier */
2000
+ reference: string;
2001
+ };
2002
+ cookie?: never;
2003
+ };
2004
+ requestBody?: never;
2005
+ responses: {
2006
+ /** @description Customer retrieved successfully */
2007
+ 200: {
2008
+ headers: {
2009
+ [name: string]: unknown;
2010
+ };
2011
+ content: {
2012
+ "application/json": components["schemas"]["CustomerResponse"];
2013
+ };
2014
+ };
2015
+ /** @description Customer not found */
2016
+ 404: {
2017
+ headers: {
2018
+ [name: string]: unknown;
2019
+ };
2020
+ content: {
2021
+ "application/json": unknown;
2022
+ };
2023
+ };
2024
+ };
2025
+ };
2026
+ CustomerSdkController_createCustomerSession: {
2027
+ parameters: {
2028
+ query?: never;
2029
+ header?: never;
2030
+ path?: never;
2031
+ cookie?: never;
2032
+ };
2033
+ /** @description Customer session creation request data */
2034
+ requestBody: {
2035
+ content: {
2036
+ "application/json": components["schemas"]["CreateCustomerSessionRequest"];
2037
+ };
2038
+ };
2039
+ responses: {
2040
+ /** @description Customer session created successfully */
2041
+ 201: {
2042
+ headers: {
2043
+ [name: string]: unknown;
2044
+ };
2045
+ content: {
2046
+ "application/json": components["schemas"]["CreateCustomerSessionResponse"];
2047
+ };
2048
+ };
2049
+ /** @description Invalid request data or customer not found */
2050
+ 400: {
2051
+ headers: {
2052
+ [name: string]: unknown;
2053
+ };
2054
+ content: {
2055
+ "application/json": unknown;
2056
+ };
2057
+ };
2058
+ /** @description Customer not found */
2059
+ 404: {
2060
+ headers: {
2061
+ [name: string]: unknown;
2062
+ };
2063
+ content: {
2064
+ "application/json": unknown;
2065
+ };
2066
+ };
2067
+ };
2068
+ };
2069
+ CustomerSdkController_getCustomerSession: {
2070
+ parameters: {
2071
+ query?: never;
2072
+ header?: never;
2073
+ path: {
2074
+ /** @description Customer session ID/token */
2075
+ sessionId: string;
2076
+ };
2077
+ cookie?: never;
2078
+ };
2079
+ requestBody?: never;
2080
+ responses: {
2081
+ /** @description Customer session retrieved successfully */
2082
+ 200: {
2083
+ headers: {
2084
+ [name: string]: unknown;
2085
+ };
2086
+ content: {
2087
+ "application/json": components["schemas"]["GetCustomerSessionResponse"];
2088
+ };
2089
+ };
2090
+ /** @description Customer session not found */
2091
+ 404: {
2092
+ headers: {
2093
+ [name: string]: unknown;
2094
+ };
2095
+ content: {
2096
+ "application/json": unknown;
2097
+ };
2098
+ };
1564
2099
  };
1565
- PurchaseResponse: {
1566
- /**
1567
- * Purchase ID
1568
- * @example 507f1f77bcf86cd799439011
1569
- */
1570
- id: string;
1571
- /**
1572
- * Purchase reference
1573
- * @example pur_1A2B3C4D
1574
- */
1575
- reference: string;
1576
- /**
1577
- * Customer reference
1578
- * @example cus_3C4D5E6F
1579
- */
1580
- customerRef: string;
1581
- /**
1582
- * Customer email
1583
- * @example customer@example.com
1584
- */
1585
- customerEmail: string;
1586
- /**
1587
- * Product reference
1588
- * @example prd_1A2B3C4D
1589
- */
1590
- productRef: string;
1591
- /**
1592
- * Product ID
1593
- * @example 507f1f77bcf86cd799439012
1594
- */
1595
- productId?: string;
1596
- /**
1597
- * Product name
1598
- * @example API Gateway Manager
1599
- */
1600
- productName?: string;
1601
- /** @description Plan snapshot at time of purchase */
1602
- planSnapshot: components["schemas"]["PlanSnapshotDto"];
1603
- /**
1604
- * Purchase status
1605
- * @example active
1606
- */
1607
- status: string;
1608
- /**
1609
- * Amount in cents
1610
- * @example 9900
1611
- */
1612
- amount: number;
1613
- /**
1614
- * Currency code
1615
- * @example USD
1616
- */
1617
- currency: string;
1618
- /** @description Start date */
1619
- startDate: string;
1620
- /** @description End date */
1621
- endDate?: string;
1622
- /** @description Paid at timestamp */
1623
- paidAt?: string;
1624
- /** @description Usage billing state for usage-based plans */
1625
- usage?: components["schemas"]["UsageBillingDto"];
1626
- /**
1627
- * Is recurring
1628
- * @example true
1629
- */
1630
- isRecurring: boolean;
1631
- /**
1632
- * Billing cycle
1633
- * @enum {string}
1634
- */
1635
- billingCycle?: "weekly" | "monthly" | "quarterly" | "yearly";
1636
- /** @description Next billing date */
1637
- nextBillingDate?: string;
1638
- /** @description Auto-renew enabled */
1639
- autoRenew?: boolean;
1640
- /** @description Whether this is a free tier purchase */
1641
- isFreeTier?: boolean;
1642
- /** @description Cancelled at */
1643
- cancelledAt?: string;
1644
- /** @description Cancellation reason */
1645
- cancellationReason?: string;
1646
- /** @description Created at */
1647
- createdAt: string;
2100
+ };
2101
+ UserInfoSdkController_getUserInfo: {
2102
+ parameters: {
2103
+ query?: never;
2104
+ header?: never;
2105
+ path?: never;
2106
+ cookie?: never;
2107
+ };
2108
+ requestBody: {
2109
+ content: {
2110
+ "application/json": components["schemas"]["UserInfoRequest"];
2111
+ };
1648
2112
  };
1649
- CancelPurchaseRequest: {
1650
- /** @description Reason for cancellation */
1651
- reason?: string;
2113
+ responses: {
2114
+ /** @description User info with purchase status */
2115
+ 200: {
2116
+ headers: {
2117
+ [name: string]: unknown;
2118
+ };
2119
+ content: {
2120
+ "application/json": components["schemas"]["UserInfoResponse"];
2121
+ };
2122
+ };
2123
+ /** @description Missing customerRef or productRef */
2124
+ 400: {
2125
+ headers: {
2126
+ [name: string]: unknown;
2127
+ };
2128
+ content?: never;
2129
+ };
2130
+ /** @description Customer or product not found */
2131
+ 404: {
2132
+ headers: {
2133
+ [name: string]: unknown;
2134
+ };
2135
+ content?: never;
2136
+ };
1652
2137
  };
1653
- CheckLimitRequest: {
1654
- /**
1655
- * Customer reference identifier
1656
- * @example cus_3C4D5E6F
1657
- */
1658
- customerRef: string;
1659
- /**
1660
- * Product reference identifier
1661
- * @example prd_1A2B3C4D
1662
- */
1663
- productRef: string;
1664
- /**
1665
- * 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.
1666
- * @example pln_2B3C4D5E
1667
- */
1668
- planRef?: string;
1669
- /**
1670
- * Canonical usage meter name used for limit checks (for example: requests, tokens).
1671
- * @example requests
1672
- */
1673
- meterName?: string;
1674
- /**
1675
- * Usage type alias for meterName. If both are provided, meterName takes precedence.
1676
- * @example requests
1677
- */
1678
- usageType?: string;
2138
+ };
2139
+ PurchaseSdkController_listPurchases: {
2140
+ parameters: {
2141
+ query?: {
2142
+ /** @description Filter by purchase status */
2143
+ status?: "pending" | "active" | "trialing" | "past_due" | "cancelled" | "expired" | "suspended" | "refunded";
2144
+ /** @description Filter by product ID */
2145
+ productId?: string;
2146
+ /** @description Filter by customer ID */
2147
+ customerId?: string;
2148
+ };
2149
+ header?: never;
2150
+ path?: never;
2151
+ cookie?: never;
2152
+ };
2153
+ requestBody?: never;
2154
+ responses: {
2155
+ /** @description Purchases retrieved successfully */
2156
+ 200: {
2157
+ headers: {
2158
+ [name: string]: unknown;
2159
+ };
2160
+ content: {
2161
+ "application/json": {
2162
+ purchases?: components["schemas"]["PurchaseResponse"][];
2163
+ };
2164
+ };
2165
+ };
1679
2166
  };
1680
- LimitResponse: {
1681
- /**
1682
- * Whether the customer is within their usage limits
1683
- * @example true
1684
- */
1685
- withinLimits: boolean;
1686
- /**
1687
- * Remaining usage units before hitting the limit
1688
- * @example 997
1689
- */
1690
- remaining: number;
1691
- /**
1692
- * Checkout session ID if payment is required
1693
- * @example e3f1c2d4b6a89f001122334455667788
1694
- */
1695
- checkoutSessionId?: string;
1696
- /**
1697
- * Checkout URL if payment is required
1698
- * @example https://solvapay.com/customer/checkout?id=e3f1c2d4b6a89f001122334455667788
1699
- */
1700
- checkoutUrl?: string;
1701
- /**
1702
- * The meter name to use when tracking usage events
1703
- * @example requests
1704
- */
1705
- meterName?: string;
2167
+ };
2168
+ PurchaseSdkController_getPurchasesForCustomer: {
2169
+ parameters: {
2170
+ query?: never;
2171
+ header?: never;
2172
+ path: {
2173
+ /** @description Customer reference or ID */
2174
+ customerRef: string;
2175
+ };
2176
+ cookie?: never;
2177
+ };
2178
+ requestBody?: never;
2179
+ responses: {
2180
+ /** @description Customer purchases retrieved successfully */
2181
+ 200: {
2182
+ headers: {
2183
+ [name: string]: unknown;
2184
+ };
2185
+ content: {
2186
+ "application/json": {
2187
+ purchases?: components["schemas"]["PurchaseResponse"][];
2188
+ };
2189
+ };
2190
+ };
2191
+ /** @description Customer not found */
2192
+ 404: {
2193
+ headers: {
2194
+ [name: string]: unknown;
2195
+ };
2196
+ content?: never;
2197
+ };
1706
2198
  };
1707
- ExecuteAnalyticsQuery: Record<string, never>;
1708
- ExecuteMultipleQueries: Record<string, never>;
1709
- CreateWebhookEndpointDto: {
1710
- /**
1711
- * Webhook endpoint URL
1712
- * @example https://example.com/webhook
1713
- */
1714
- url: string;
1715
- /**
1716
- * Webhook endpoint description
1717
- * @example Production webhook
1718
- */
1719
- description?: string;
2199
+ };
2200
+ PurchaseSdkController_getPurchasesForProduct: {
2201
+ parameters: {
2202
+ query?: never;
2203
+ header?: never;
2204
+ path: {
2205
+ /** @description Product reference or ID */
2206
+ productRef: string;
2207
+ };
2208
+ cookie?: never;
2209
+ };
2210
+ requestBody?: never;
2211
+ responses: {
2212
+ /** @description Product purchases retrieved successfully */
2213
+ 200: {
2214
+ headers: {
2215
+ [name: string]: unknown;
2216
+ };
2217
+ content: {
2218
+ "application/json": {
2219
+ purchases?: components["schemas"]["PurchaseResponse"][];
2220
+ };
2221
+ };
2222
+ };
2223
+ /** @description Product not found */
2224
+ 404: {
2225
+ headers: {
2226
+ [name: string]: unknown;
2227
+ };
2228
+ content?: never;
2229
+ };
1720
2230
  };
1721
- UpdateWebhookEndpointDto: {
1722
- /**
1723
- * Webhook endpoint URL
1724
- * @example https://example.com/webhook
1725
- */
1726
- url?: string;
1727
- /**
1728
- * Webhook endpoint description
1729
- * @example Updated webhook
1730
- */
1731
- description?: string;
2231
+ };
2232
+ PurchaseSdkController_getPurchase: {
2233
+ parameters: {
2234
+ query?: never;
2235
+ header?: never;
2236
+ path: {
2237
+ /** @description Purchase ID or reference */
2238
+ id: string;
2239
+ };
2240
+ cookie?: never;
2241
+ };
2242
+ requestBody?: never;
2243
+ responses: {
2244
+ /** @description Purchase retrieved successfully */
2245
+ 200: {
2246
+ headers: {
2247
+ [name: string]: unknown;
2248
+ };
2249
+ content: {
2250
+ "application/json": components["schemas"]["PurchaseResponse"];
2251
+ };
2252
+ };
2253
+ /** @description Purchase not found */
2254
+ 404: {
2255
+ headers: {
2256
+ [name: string]: unknown;
2257
+ };
2258
+ content?: never;
2259
+ };
1732
2260
  };
1733
- UpdateThemePreferenceDto: {
1734
- /**
1735
- * Selected UI theme mode
1736
- * @example dark
1737
- * @enum {string}
1738
- */
1739
- mode: "light" | "dark";
2261
+ };
2262
+ PurchaseSdkController_cancelPurchase: {
2263
+ parameters: {
2264
+ query?: never;
2265
+ header?: never;
2266
+ path: {
2267
+ /** @description Purchase reference or ID */
2268
+ purchaseRef: string;
2269
+ };
2270
+ cookie?: never;
1740
2271
  };
1741
- ThemeModeColorsDto: {
1742
- /**
1743
- * Page background color
1744
- * @example #f7f7f8
1745
- */
1746
- background?: string;
1747
- /**
1748
- * Card/surface background color
1749
- * @example #ffffff
1750
- */
1751
- surface?: string;
1752
- /**
1753
- * Primary text color
1754
- * @example #181818
1755
- */
1756
- text?: string;
1757
- /**
1758
- * Secondary/muted text color
1759
- * @example #5c5c5c
1760
- */
1761
- secondary?: string;
2272
+ requestBody: {
2273
+ content: {
2274
+ "application/json": components["schemas"]["CancelPurchaseRequest"];
2275
+ };
1762
2276
  };
1763
- ThemeOverridesDto: {
1764
- /** @description Light mode color overrides */
1765
- light?: components["schemas"]["ThemeModeColorsDto"];
1766
- /** @description Dark mode color overrides */
1767
- dark?: components["schemas"]["ThemeModeColorsDto"];
2277
+ responses: {
2278
+ /** @description Purchase cancelled successfully */
2279
+ 200: {
2280
+ headers: {
2281
+ [name: string]: unknown;
2282
+ };
2283
+ content: {
2284
+ "application/json": {
2285
+ success?: boolean;
2286
+ purchase?: components["schemas"]["PurchaseResponse"];
2287
+ };
2288
+ };
2289
+ };
2290
+ /** @description Purchase not found */
2291
+ 404: {
2292
+ headers: {
2293
+ [name: string]: unknown;
2294
+ };
2295
+ content?: never;
2296
+ };
1768
2297
  };
1769
- UpdateBrandThemeDto: {
1770
- /**
1771
- * Logo image URL displayed in hosted page headers
1772
- * @example /ui/files/download/provider-assets/provider-123/logos/logo.png
1773
- */
1774
- logo?: string;
1775
- /**
1776
- * Provider's brand name displayed on hosted pages
1777
- * @example Acme Corp
1778
- */
1779
- brandName: string;
1780
- /**
1781
- * Primary/accent color in hex format
1782
- * @example #3182ce
1783
- */
1784
- primaryColor: string;
1785
- /**
1786
- * Font family for hosted pages
1787
- * @default Inter
1788
- * @example Inter
1789
- */
1790
- fontFamily: string;
1791
- /**
1792
- * Base font size
1793
- * @default 16px
1794
- * @example 16px
1795
- */
1796
- fontSize: string;
1797
- /** @description Per-mode color overrides for light and dark themes */
1798
- themes?: components["schemas"]["ThemeOverridesDto"];
2298
+ };
2299
+ LimitsSdkController_checkLimits: {
2300
+ parameters: {
2301
+ query?: never;
2302
+ header?: never;
2303
+ path?: never;
2304
+ cookie?: never;
2305
+ };
2306
+ requestBody: {
2307
+ content: {
2308
+ "application/json": components["schemas"]["CheckLimitRequest"];
2309
+ };
1799
2310
  };
1800
- CreatePreregistrationDto: {
1801
- /** @example jane@company.com */
1802
- email: string;
1803
- /** @example Jane Smith */
1804
- fullName: string;
1805
- /** @example Acme Corp */
1806
- companyName: string;
1807
- /** @example SaaS */
1808
- businessType?: string;
1809
- /** @example Purchase billing for our platform */
1810
- useCase?: string;
1811
- customFields?: {
1812
- [key: string]: string;
1813
- };
1814
- };
1815
- /** @description Auto-generated fallback schema for unresolved reference: McpBootstrapPreviewValidationError */
1816
- McpBootstrapPreviewValidationError: {
1817
- [key: string]: unknown;
2311
+ responses: {
2312
+ /** @description Limit check result */
2313
+ 200: {
2314
+ headers: {
2315
+ [name: string]: unknown;
2316
+ };
2317
+ content: {
2318
+ "application/json": components["schemas"]["LimitResponse"];
2319
+ };
2320
+ };
2321
+ /** @description Missing customerRef or productRef */
2322
+ 400: {
2323
+ headers: {
2324
+ [name: string]: unknown;
2325
+ };
2326
+ content?: never;
2327
+ };
2328
+ /** @description Customer or product not found */
2329
+ 404: {
2330
+ headers: {
2331
+ [name: string]: unknown;
2332
+ };
2333
+ content?: never;
2334
+ };
1818
2335
  };
1819
2336
  };
1820
- responses: never;
1821
- parameters: never;
1822
- requestBodies: never;
1823
- headers: never;
1824
- pathItems: never;
1825
2337
  }
1826
2338
 
1827
2339
  /**
@@ -1830,17 +2342,12 @@ interface components {
1830
2342
  * Types related to the SolvaPay API client and backend communication.
1831
2343
  */
1832
2344
 
1833
- type UsageMeterType = 'requests' | 'tokens';
1834
- type CheckLimitsRequest = components['schemas']['CheckLimitRequest'] & {
1835
- meterName?: string;
1836
- usageType?: UsageMeterType;
1837
- };
2345
+ type CheckLimitsRequest = components['schemas']['CheckLimitRequest'];
1838
2346
  /**
1839
- * Extended LimitResponse with plan field
2347
+ * Extended LimitResponse with SDK-added plan field
1840
2348
  */
1841
2349
  type LimitResponseWithPlan = components['schemas']['LimitResponse'] & {
1842
2350
  plan: string;
1843
- meterName?: string;
1844
2351
  };
1845
2352
  /**
1846
2353
  * Extended CustomerResponse with proper field mapping
@@ -1879,46 +2386,7 @@ interface ProcessPaymentResult {
1879
2386
  oneTimePurchase?: OneTimePurchaseInfo;
1880
2387
  status: 'completed';
1881
2388
  }
1882
- interface McpBootstrapFreePlanConfig {
1883
- name?: string;
1884
- freeUnits?: number;
1885
- }
1886
- interface McpBootstrapPaidPlanInput {
1887
- key: string;
1888
- name: string;
1889
- /** Price in cents (e.g. 2000 = $20.00) */
1890
- price: number;
1891
- currency: string;
1892
- billingCycle?: 'weekly' | 'monthly' | 'quarterly' | 'yearly' | 'custom';
1893
- type?: 'recurring' | 'one-time';
1894
- freeUnits?: number;
1895
- meterId?: string;
1896
- limit?: number;
1897
- features?: Record<string, unknown>;
1898
- }
1899
- interface ToolPlanMappingInput {
1900
- name: string;
1901
- description?: string;
1902
- noPlan?: boolean;
1903
- planIds?: string[];
1904
- planRefs?: string[];
1905
- planKeys?: string[];
1906
- }
1907
- interface McpBootstrapRequest {
1908
- name?: string;
1909
- description?: string;
1910
- imageUrl?: string;
1911
- productType?: string;
1912
- originUrl: string;
1913
- /** Optional token combined with provider name to derive the final MCP subdomain. */
1914
- mcpDomain?: string;
1915
- authHeaderName?: string;
1916
- authApiKey?: string;
1917
- freePlan?: McpBootstrapFreePlanConfig;
1918
- paidPlans?: McpBootstrapPaidPlanInput[];
1919
- tools?: ToolPlanMappingInput[];
1920
- metadata?: Record<string, unknown>;
1921
- }
2389
+ type McpBootstrapRequest = components['schemas']['McpBootstrapDto'];
1922
2390
  interface McpBootstrapResponse {
1923
2391
  product: components['schemas']['SdkProductResponse'];
1924
2392
  mcpServer: {
@@ -1940,6 +2408,23 @@ interface McpBootstrapResponse {
1940
2408
  description?: string;
1941
2409
  }>;
1942
2410
  }
2411
+ type ConfigureMcpPlansRequest = components['schemas']['ConfigureMcpPlansDto'];
2412
+ interface ConfigureMcpPlansResponse {
2413
+ product: components['schemas']['SdkProductResponse'];
2414
+ mcpServer: {
2415
+ id?: string;
2416
+ reference?: string;
2417
+ subdomain?: string;
2418
+ mcpProxyUrl?: string;
2419
+ url: string;
2420
+ defaultPlanId?: string;
2421
+ };
2422
+ planMap: Record<string, {
2423
+ id: string;
2424
+ reference: string;
2425
+ name?: string;
2426
+ }>;
2427
+ }
1943
2428
  /**
1944
2429
  * SolvaPay API Client Interface
1945
2430
  *
@@ -1981,6 +2466,7 @@ interface SolvaPayClient {
1981
2466
  name: string;
1982
2467
  }>;
1983
2468
  bootstrapMcpProduct?(params: McpBootstrapRequest): Promise<McpBootstrapResponse>;
2469
+ configureMcpPlans?(productRef: string, params: ConfigureMcpPlansRequest): Promise<ConfigureMcpPlansResponse>;
1984
2470
  updateProduct?(productRef: string, params: components['schemas']['UpdateProductRequest']): Promise<components['schemas']['SdkProductResponse']>;
1985
2471
  deleteProduct?(productRef: string): Promise<void>;
1986
2472
  cloneProduct?(productRef: string, overrides?: {
@@ -1989,29 +2475,11 @@ interface SolvaPayClient {
1989
2475
  reference: string;
1990
2476
  name: string;
1991
2477
  }>;
1992
- listPlans?(productRef: string): Promise<Array<{
1993
- reference: string;
1994
- price?: number;
1995
- currency?: string;
1996
- interval?: string;
1997
- isFreeTier?: boolean;
1998
- freeUnits?: number;
1999
- measures?: string;
2000
- limit?: number;
2001
- pricePerUnit?: number;
2002
- billingModel?: string;
2003
- metadata?: Record<string, unknown>;
2004
- [key: string]: unknown;
2005
- }>>;
2478
+ listPlans?(productRef: string): Promise<components['schemas']['Plan'][]>;
2006
2479
  createPlan?(params: components['schemas']['CreatePlanRequest'] & {
2007
2480
  productRef: string;
2008
- }): Promise<{
2009
- reference: string;
2010
- }>;
2011
- updatePlan?(productRef: string, planRef: string, params: Partial<components['schemas']['CreatePlanRequest']>): Promise<{
2012
- reference: string;
2013
- [key: string]: unknown;
2014
- }>;
2481
+ }): Promise<components['schemas']['Plan']>;
2482
+ updatePlan?(productRef: string, planRef: string, params: components['schemas']['UpdatePlanRequest']): Promise<components['schemas']['Plan']>;
2015
2483
  deletePlan?(productRef: string, planRef: string): Promise<void>;
2016
2484
  createPaymentIntent?(params: {
2017
2485
  productRef: string;
@@ -2038,7 +2506,7 @@ interface SolvaPayClient {
2038
2506
  customerRef: string;
2039
2507
  productRef: string;
2040
2508
  }): Promise<components['schemas']['UserInfoResponse']>;
2041
- createCheckoutSession(params: components['schemas']['CreateCheckoutSessionRequest']): Promise<components['schemas']['CheckoutSessionResponse']>;
2509
+ createCheckoutSession(params: operations['CheckoutSessionSdkController_createCheckoutSession']['requestBody']['content']['application/json']): Promise<components['schemas']['CreateCheckoutSessionResponse']>;
2042
2510
  createCustomerSession(params: components['schemas']['CreateCustomerSessionRequest']): Promise<components['schemas']['CreateCustomerSessionResponse']>;
2043
2511
  }
2044
2512
 
@@ -2047,6 +2515,10 @@ interface SolvaPayClient {
2047
2515
  *
2048
2516
  * Types related to paywall protection, limits, and gating functionality.
2049
2517
  */
2518
+
2519
+ type LimitPlanSummary = components['schemas']['LimitPlanItemDto'];
2520
+ type LimitActivationBalance = components['schemas']['LimitBalanceDto'];
2521
+ type LimitActivationProduct = components['schemas']['LimitProductBriefDto'];
2050
2522
  /**
2051
2523
  * Arguments passed to protected handlers
2052
2524
  */
@@ -2065,14 +2537,29 @@ interface PaywallMetadata {
2065
2537
  usageType?: 'requests' | 'tokens';
2066
2538
  }
2067
2539
  /**
2068
- * Structured content for paywall errors
2540
+ * Structured content for paywall errors (MCP structuredContent and manual handling).
2069
2541
  */
2070
- interface PaywallStructuredContent {
2542
+ type PaywallStructuredContent = {
2071
2543
  kind: 'payment_required';
2544
+ /** Product ref from paywall metadata (or env default) */
2072
2545
  product: string;
2073
2546
  checkoutUrl: string;
2074
2547
  message: string;
2075
- }
2548
+ } | {
2549
+ kind: 'activation_required';
2550
+ /** Product ref from paywall metadata (or env default) */
2551
+ product: string;
2552
+ message: string;
2553
+ /**
2554
+ * Best URL for completing purchase or confirmation; mirrors confirmationUrl when present.
2555
+ */
2556
+ checkoutUrl: string;
2557
+ confirmationUrl?: string;
2558
+ plans?: LimitPlanSummary[];
2559
+ balance?: LimitActivationBalance;
2560
+ /** Rich product context from checkLimits (name, ref, provider slug/id) */
2561
+ productDetails?: LimitActivationProduct;
2562
+ };
2076
2563
  /**
2077
2564
  * MCP tool result with optional paywall information
2078
2565
  */
@@ -2084,7 +2571,7 @@ interface PaywallToolResult {
2084
2571
  mimeType?: string;
2085
2572
  }>;
2086
2573
  isError?: boolean;
2087
- structuredContent?: PaywallStructuredContent;
2574
+ structuredContent?: PaywallStructuredContent | Record<string, unknown>;
2088
2575
  }
2089
2576
 
2090
2577
  /**
@@ -2126,6 +2613,16 @@ interface RetryOptions {
2126
2613
  */
2127
2614
  onRetry?: (error: Error, attempt: number) => void;
2128
2615
  }
2616
+ interface McpToolExtra {
2617
+ authInfo?: {
2618
+ token: string;
2619
+ clientId: string;
2620
+ scopes: string[];
2621
+ expiresAt?: number;
2622
+ extra?: Record<string, unknown>;
2623
+ };
2624
+ [key: string]: unknown;
2625
+ }
2129
2626
  /**
2130
2627
  * Options for configuring payable protection
2131
2628
  */
@@ -2196,7 +2693,7 @@ interface McpAdapterOptions {
2196
2693
  /**
2197
2694
  * Extract customer reference from MCP args
2198
2695
  */
2199
- getCustomerRef?: (args: any) => string | Promise<string>;
2696
+ getCustomerRef?: (args: any, extra?: McpToolExtra) => string | Promise<string>;
2200
2697
  /**
2201
2698
  * Transform the response before wrapping in MCP format
2202
2699
  */
@@ -2273,7 +2770,7 @@ interface VirtualToolsOptions {
2273
2770
  /** Product reference (required) */
2274
2771
  product: string;
2275
2772
  /** Extract customer reference from MCP tool args */
2276
- getCustomerRef: (args: Record<string, unknown>) => string;
2773
+ getCustomerRef: (args: Record<string, unknown>, extra?: McpToolExtra) => string;
2277
2774
  /** Tool names to exclude from registration (optional) */
2278
2775
  exclude?: string[];
2279
2776
  }
@@ -2285,7 +2782,7 @@ interface VirtualToolDefinition {
2285
2782
  properties: Record<string, object>;
2286
2783
  required: string[];
2287
2784
  };
2288
- handler: (args: Record<string, unknown>) => Promise<{
2785
+ handler: (args: Record<string, unknown>, extra?: McpToolExtra) => Promise<{
2289
2786
  content: Array<{
2290
2787
  type: string;
2291
2788
  text: string;
@@ -2294,6 +2791,16 @@ interface VirtualToolDefinition {
2294
2791
  }>;
2295
2792
  }
2296
2793
 
2794
+ interface McpServerLike {
2795
+ registerTool: (name: string, config: Record<string, unknown>, handler: (args: Record<string, unknown>, extra?: McpToolExtra) => unknown) => unknown;
2796
+ }
2797
+ interface RegisterVirtualToolsMcpOptions extends Omit<VirtualToolsOptions, 'getCustomerRef'> {
2798
+ getCustomerRef?: VirtualToolsOptions['getCustomerRef'];
2799
+ filter?: (definition: VirtualToolDefinition) => boolean;
2800
+ mapDefinition?: (definition: VirtualToolDefinition) => VirtualToolDefinition;
2801
+ wrapHandler?: (handler: VirtualToolDefinition['handler'], definition: VirtualToolDefinition) => (args: Record<string, unknown>, extra?: McpToolExtra) => Promise<unknown> | unknown;
2802
+ }
2803
+
2297
2804
  /**
2298
2805
  * Configuration for creating a SolvaPay instance.
2299
2806
  *
@@ -2411,7 +2918,7 @@ interface PayableFunction {
2411
2918
  * });
2412
2919
  * ```
2413
2920
  */
2414
- mcp<T = any>(businessLogic: (args: any) => Promise<T>, options?: McpAdapterOptions): (args: Record<string, unknown>) => Promise<unknown>;
2921
+ mcp<T = any>(businessLogic: (args: any) => Promise<T>, options?: McpAdapterOptions): (args: Record<string, unknown>, extra?: McpToolExtra) => Promise<unknown>;
2415
2922
  /**
2416
2923
  * Pure function adapter for direct function protection.
2417
2924
  *
@@ -2612,14 +3119,17 @@ interface SolvaPay {
2612
3119
  customerRef: string;
2613
3120
  productRef: string;
2614
3121
  planRef?: string;
2615
- meterName?: 'requests' | 'tokens';
2616
- usageType?: 'requests' | 'tokens';
3122
+ meterName?: string;
3123
+ usageType?: string;
2617
3124
  }): Promise<{
2618
3125
  withinLimits: boolean;
2619
3126
  remaining: number;
2620
3127
  plan: string;
2621
3128
  checkoutUrl?: string;
2622
3129
  meterName?: string;
3130
+ creditBalance?: number;
3131
+ pricePerUnit?: number;
3132
+ currency?: string;
2623
3133
  }>;
2624
3134
  /**
2625
3135
  * Track usage for a customer action.
@@ -2683,6 +3193,7 @@ interface SolvaPay {
2683
3193
  createCustomer(params: {
2684
3194
  email: string;
2685
3195
  name?: string;
3196
+ metadata?: Record<string, unknown>;
2686
3197
  }): Promise<{
2687
3198
  customerRef: string;
2688
3199
  }>;
@@ -2784,6 +3295,13 @@ interface SolvaPay {
2784
3295
  * fast setup flows where you want one call for product + plans + MCP config.
2785
3296
  */
2786
3297
  bootstrapMcpProduct(params: McpBootstrapRequest): Promise<McpBootstrapResponse>;
3298
+ /**
3299
+ * Configure MCP plans and tool mappings for an existing MCP product.
3300
+ *
3301
+ * This helper wraps the backend MCP plans endpoint and supports adding/removing
3302
+ * paid plans as well as remapping tool access.
3303
+ */
3304
+ configureMcpPlans(productRef: string, params: ConfigureMcpPlansRequest): Promise<ConfigureMcpPlansResponse>;
2787
3305
  /**
2788
3306
  * Get virtual tool definitions with bound handlers for MCP server integration.
2789
3307
  *
@@ -2803,7 +3321,7 @@ interface SolvaPay {
2803
3321
  * ```typescript
2804
3322
  * const virtualTools = solvaPay.getVirtualTools({
2805
3323
  * product: 'prd_myapi',
2806
- * getCustomerRef: args => args._auth?.customer_ref || 'anonymous',
3324
+ * getCustomerRef: (_args, extra) => String(extra?.authInfo?.extra?.customer_ref || 'anonymous'),
2807
3325
  * });
2808
3326
  *
2809
3327
  * // Register on your MCP server
@@ -2813,6 +3331,13 @@ interface SolvaPay {
2813
3331
  * ```
2814
3332
  */
2815
3333
  getVirtualTools(options: VirtualToolsOptions): VirtualToolDefinition[];
3334
+ /**
3335
+ * Register virtual tools directly on an MCP server with one call.
3336
+ *
3337
+ * This helper converts virtual tool JSON schemas to Zod schemas and registers
3338
+ * each tool on an MCP server that supports `registerTool()`.
3339
+ */
3340
+ registerVirtualToolsMcp(server: McpServerLike, options: RegisterVirtualToolsMcpOptions): Promise<void>;
2816
3341
  /**
2817
3342
  * Direct access to the API client for advanced operations.
2818
3343
  *
@@ -2926,6 +3451,8 @@ declare class PaywallError extends Error {
2926
3451
  */
2927
3452
  constructor(message: string, structuredContent: PaywallStructuredContent);
2928
3453
  }
3454
+ /** JSON body shape for HTTP adapters and MCP text content (stable fields for clients). */
3455
+ declare function paywallErrorToClientPayload(error: PaywallError): Record<string, unknown>;
2929
3456
 
2930
3457
  /**
2931
3458
  * Utility functions for the SolvaPay Server SDK
@@ -3277,11 +3804,12 @@ declare function cancelPurchaseCore(request: Request, body: {
3277
3804
  * This is a public route - no authentication required.
3278
3805
  */
3279
3806
 
3807
+ type Plan = components['schemas']['Plan'];
3280
3808
  /**
3281
3809
  * List plans - core implementation
3282
3810
  */
3283
3811
  declare function listPlansCore(request: Request): Promise<{
3284
- plans: Record<string, unknown>[];
3812
+ plans: Plan[];
3285
3813
  productRef: string;
3286
3814
  } | ErrorResult>;
3287
3815
 
@@ -3298,4 +3826,4 @@ declare function verifyWebhook({ body, signature, secret, }: {
3298
3826
  secret: string;
3299
3827
  }): Promise<WebhookEvent>;
3300
3828
 
3301
- export { type AuthenticatedUser, type CreateSolvaPayConfig, type ErrorResult, type HttpAdapterOptions, type McpAdapterOptions, type NextAdapterOptions, type PayableFunction, type PayableOptions, type PaywallArgs, PaywallError, type PaywallMetadata, type PaywallStructuredContent, type PaywallToolResult, type RetryOptions, type ServerClientOptions, type SolvaPay, type SolvaPayClient, type WebhookEvent, type WebhookEventType, cancelPurchaseCore, createCheckoutSessionCore, createCustomerSessionCore, createPaymentIntentCore, createSolvaPay, createSolvaPayClient, getAuthenticatedUserCore, handleRouteError, isErrorResult, listPlansCore, processPaymentIntentCore, syncCustomerCore, verifyWebhook, withRetry };
3829
+ export { type AuthenticatedUser, type CreateSolvaPayConfig, type CustomerWebhookObject, type ErrorResult, type HttpAdapterOptions, type LimitActivationBalance, type LimitActivationProduct, type LimitPlanSummary, type McpAdapterOptions, type NextAdapterOptions, type PayableFunction, type PayableOptions, type PaywallArgs, PaywallError, type PaywallMetadata, type PaywallStructuredContent, type PaywallToolResult, type RetryOptions, type ServerClientOptions, type SolvaPay, type SolvaPayClient, type WebhookEvent, type WebhookEventForType, type WebhookEventObjectMap, type WebhookEventType, type WebhookProduct, cancelPurchaseCore, createCheckoutSessionCore, createCustomerSessionCore, createPaymentIntentCore, createSolvaPay, createSolvaPayClient, getAuthenticatedUserCore, handleRouteError, isErrorResult, listPlansCore, paywallErrorToClientPayload, processPaymentIntentCore, syncCustomerCore, verifyWebhook, withRetry };