@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/index.d.cts 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,176 +212,76 @@ 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
  };
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
+ };
605
285
  ProductConfigDto: {
606
286
  /**
607
287
  * Fulfillment type
@@ -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
@@ -809,189 +454,73 @@ interface components {
809
454
  plans?: components["schemas"]["SdkPlanResponse"][];
810
455
  /**
811
456
  * MCP linkage details for MCP-enabled products
812
- * @example {
813
- * "mcpServerId": "67f90f1f1b1c9c0b8df0f111",
814
- * "mcpServerReference": "mcp_ABC123",
815
- * "mcpSubdomain": "acme-docs",
816
- * "mcpProxyUrl": "https://acme-docs.mcp.solvapay.com/mcp",
817
- * "originUrl": "https://origin.example.com/mcp",
818
- * "defaultPlanId": "67f90f1f1b1c9c0b8df0f001"
819
- * }
820
- */
821
- mcp?: {
822
- [key: string]: unknown;
823
- };
824
- };
825
- UpdateProductRequest: {
826
- /** @description Product name */
827
- name?: string;
828
- /** @description Product description */
829
- description?: string;
830
- /** @description URL to the product image */
831
- imageUrl?: string;
832
- /** @description Free-form product type defined by the provider */
833
- productType?: string;
834
- /**
835
- * Product status
836
- * @enum {string}
837
- */
838
- 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;
844
- };
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
457
+ * @example {
458
+ * "mcpServerId": "67f90f1f1b1c9c0b8df0f111",
459
+ * "mcpServerReference": "mcp_ABC123",
460
+ * "mcpSubdomain": "acme-docs",
461
+ * "mcpProxyUrl": "https://acme-docs.mcp.solvapay.com/mcp",
462
+ * "originUrl": "https://origin.example.com/mcp",
463
+ * "defaultPlanId": "67f90f1f1b1c9c0b8df0f001"
464
+ * }
904
465
  */
905
- limit?: number;
906
- /** @description Plan features */
907
- features?: {
466
+ mcp?: {
908
467
  [key: string]: unknown;
909
468
  };
910
469
  };
911
- McpBootstrapToolInput: {
912
- /**
913
- * Tool name
914
- * @example search_docs
915
- */
916
- name: string;
917
- /**
918
- * Tool description
919
- * @example Search indexed documents
920
- */
470
+ UpdateProductRequest: {
471
+ name?: string;
921
472
  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[];
473
+ imageUrl?: string;
474
+ productType?: string;
475
+ /** @enum {string} */
476
+ status?: "active" | "inactive" | "suspended";
477
+ config: {
478
+ fulfillmentType?: string;
479
+ validityPeriod?: number;
480
+ deliveryMethod?: string;
481
+ };
482
+ metadata: {
483
+ [key: string]: unknown;
484
+ };
948
485
  };
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;
599
+ };
600
+ /** @description Resolved plan mapping by key (includes existing free plan) */
601
+ planMap: {
602
+ [key: string]: unknown;
1049
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: {
@@ -1311,174 +850,65 @@ interface components {
1311
850
  /** @example 1000 */
1312
851
  total: number;
1313
852
  /** @example 250 */
1314
- used: number;
1315
- /** @example 750 */
1316
- remaining: number;
1317
- /**
1318
- * Meter ObjectId reference
1319
- * @example 507f1f77bcf86cd799439011
1320
- */
1321
- meterId?: string;
1322
- /** @example 25 */
1323
- percentUsed?: number | null;
1324
- };
1325
- UserInfoPlanDto: {
1326
- /** @example pln_2B3C4D5E */
1327
- reference: string;
1328
- /**
1329
- * Price in minor currency units (e.g. cents)
1330
- * @example 2999
1331
- */
1332
- price: number;
1333
- /** @example USD */
1334
- currency: string;
1335
- /** @example recurring */
1336
- type: string;
1337
- /** @example monthly */
1338
- billingCycle?: string | null;
1339
- features?: string[] | null;
1340
- limits?: {
1341
- [key: string]: unknown;
1342
- } | null;
1343
- };
1344
- UserInfoPurchaseDto: {
1345
- /** @example pur_1A2B3C4D */
1346
- reference: string;
1347
- /** @example active */
1348
- status: string;
1349
- /** @example My API Product */
1350
- productName: string;
1351
- /** @example recurring */
1352
- planType: string;
1353
- /** @example 2025-10-27T10:00:00Z */
1354
- startDate?: string | null;
1355
- /** @example 2025-11-27T10:00:00Z */
1356
- endDate?: string | null;
1357
- usage?: components["schemas"]["UserInfoUsageDto"];
1358
- plan?: components["schemas"]["UserInfoPlanDto"];
1359
- };
1360
- UserInfoResponse: {
1361
- /**
1362
- * Human-readable status summary
1363
- * @example Active subscription: My API Product (25% usage consumed)
1364
- */
1365
- status: string;
1366
- /**
1367
- * Customer portal session URL
1368
- * @example https://solvapay.com/customer/manage?id=abc123
1369
- */
1370
- verifyUrl?: string | null;
1371
- user?: components["schemas"]["UserInfoUserDto"];
1372
- purchase?: components["schemas"]["UserInfoPurchaseDto"];
1373
- };
1374
- McpToolDto: {
1375
- /**
1376
- * Tool name
1377
- * @example search_documents
1378
- */
1379
- name: string;
1380
- /**
1381
- * Plan IDs that grant access to this tool
1382
- * @example [
1383
- * "pln_abc123"
1384
- * ]
1385
- */
1386
- planIds?: string[];
1387
- /**
1388
- * If true, the tool is unprotected (no purchase check or usage tracking)
1389
- * @example false
1390
- */
1391
- noPlan?: boolean;
1392
- /**
1393
- * Human-readable tool description
1394
- * @example Search indexed documents
1395
- */
1396
- description?: string;
1397
- /**
1398
- * Whether this is a virtual platform tool handled by SolvaPay
1399
- * @example false
1400
- */
1401
- isVirtual?: boolean;
1402
- };
1403
- McpServerDto: {
1404
- /**
1405
- * Server ID
1406
- * @example 507f1f77bcf86cd799439011
1407
- */
1408
- id?: string;
1409
- /**
1410
- * Unique server reference
1411
- * @example mcp_abc123
1412
- */
1413
- reference?: string;
1414
- /**
1415
- * Domain slug used to derive the MCP endpoint subdomain
1416
- * @example my-mcp-server
1417
- */
1418
- name: string;
1419
- /**
1420
- * URL-safe subdomain derived from name
1421
- * @example my-mcp-server
1422
- */
1423
- subdomain: string;
1424
- /**
1425
- * SolvaPay proxy URL that MCP clients connect to
1426
- * @example https://mytelescope.mcp.solvapay.com/mcp
1427
- */
1428
- mcpProxyUrl?: string;
1429
- /**
1430
- * Origin URL of the actual MCP server
1431
- * @example https://origin.example.com/mcp
1432
- */
1433
- url: string;
1434
- /**
1435
- * Avatar image URL
1436
- * @example https://example.com/avatar.png
1437
- */
1438
- avatarUrl?: string;
1439
- /** @description Registered tools for this server */
1440
- tools?: components["schemas"]["McpToolDto"][];
1441
- /**
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
1444
- */
1445
- defaultPlanId?: string;
1446
- /**
1447
- * Associated product ID
1448
- * @example 507f1f77bcf86cd799439011
1449
- */
1450
- productId?: string;
1451
- /**
1452
- * Server status
1453
- * @example active
1454
- * @enum {string}
1455
- */
1456
- status?: "active" | "inactive" | "suspended";
853
+ used: number;
854
+ /** @example 750 */
855
+ remaining: number;
1457
856
  /**
1458
- * Provider ID that owns this server
857
+ * Meter ObjectId reference
1459
858
  * @example 507f1f77bcf86cd799439011
1460
859
  */
1461
- providerId: string;
1462
- /**
1463
- * Custom auth header name for origin requests
1464
- * @example X-API-Key
1465
- */
1466
- authHeaderName?: string;
860
+ meterId?: string;
861
+ /** @example 25 */
862
+ percentUsed?: number | null;
863
+ };
864
+ UserInfoPlanDto: {
865
+ /** @example pln_2B3C4D5E */
866
+ reference: string;
1467
867
  /**
1468
- * Whether an auth API key is configured
1469
- * @example true
868
+ * Price in minor currency units (e.g. cents)
869
+ * @example 2999
1470
870
  */
1471
- hasAuthApiKey?: boolean;
871
+ price: number;
872
+ /** @example USD */
873
+ currency: string;
874
+ /** @example recurring */
875
+ type: string;
876
+ /** @example monthly */
877
+ billingCycle?: string | null;
878
+ features?: string[] | null;
879
+ limits?: {
880
+ [key: string]: unknown;
881
+ } | null;
882
+ };
883
+ UserInfoPurchaseDto: {
884
+ /** @example pur_1A2B3C4D */
885
+ reference: string;
886
+ /** @example active */
887
+ status: string;
888
+ /** @example My API Product */
889
+ productName: string;
890
+ /** @example recurring */
891
+ planType: string;
892
+ /** @example 2025-10-27T10:00:00Z */
893
+ startDate?: string | null;
894
+ /** @example 2025-11-27T10:00:00Z */
895
+ endDate?: string | null;
896
+ usage?: components["schemas"]["UserInfoUsageDto"];
897
+ plan?: components["schemas"]["UserInfoPlanDto"];
898
+ };
899
+ UserInfoResponse: {
1472
900
  /**
1473
- * Total number of tool-call transactions
1474
- * @example 42
901
+ * Human-readable status summary
902
+ * @example Active subscription: My API Product (25% usage consumed)
1475
903
  */
1476
- totalTransactions?: number;
904
+ status: string;
1477
905
  /**
1478
- * Current balance in cents
1479
- * @example 1500
906
+ * Customer portal session URL
907
+ * @example https://solvapay.com/customer/manage?id=abc123
1480
908
  */
1481
- balance?: number;
909
+ verifyUrl?: string | null;
910
+ user?: components["schemas"]["UserInfoUserDto"];
911
+ purchase?: components["schemas"]["UserInfoPurchaseDto"];
1482
912
  };
1483
913
  PlanSnapshotDto: {
1484
914
  /**
@@ -1530,8 +960,8 @@ interface components {
1530
960
  */
1531
961
  freeUnits?: number;
1532
962
  /**
1533
- * Price per usage unit in cents
1534
- * @example 10
963
+ * Price per usage unit in cents (supports decimals, e.g. 0.1 = 1/10 cent)
964
+ * @example 0.1
1535
965
  */
1536
966
  pricePerUnit?: number;
1537
967
  };
@@ -1598,23 +1028,33 @@ interface components {
1598
1028
  * @example API Gateway Manager
1599
1029
  */
1600
1030
  productName?: string;
1601
- /** @description Plan snapshot at time of purchase */
1602
- planSnapshot: components["schemas"]["PlanSnapshotDto"];
1031
+ /** @description Plan snapshot at time of purchase (null for credit topups) */
1032
+ planSnapshot?: components["schemas"]["PlanSnapshotDto"];
1603
1033
  /**
1604
1034
  * Purchase status
1605
1035
  * @example active
1606
1036
  */
1607
1037
  status: string;
1608
1038
  /**
1609
- * Amount in cents
1039
+ * Amount in USD cents (normalised for aggregation)
1610
1040
  * @example 9900
1611
1041
  */
1612
1042
  amount: number;
1613
1043
  /**
1614
- * Currency code
1615
- * @example USD
1044
+ * Original amount in the payment currency (cents/pence)
1045
+ * @example 10000
1046
+ */
1047
+ originalAmount?: number;
1048
+ /**
1049
+ * Original payment currency code
1050
+ * @example GBP
1616
1051
  */
1617
1052
  currency: string;
1053
+ /**
1054
+ * Exchange rate from original currency to USD
1055
+ * @example 1.3082
1056
+ */
1057
+ exchangeRate?: number;
1618
1058
  /** @description Start date */
1619
1059
  startDate: string;
1620
1060
  /** @description End date */
@@ -1637,191 +1077,1263 @@ interface components {
1637
1077
  nextBillingDate?: string;
1638
1078
  /** @description Auto-renew enabled */
1639
1079
  autoRenew?: boolean;
1640
- /** @description Whether this is a free tier purchase */
1641
- isFreeTier?: boolean;
1642
1080
  /** @description Cancelled at */
1643
1081
  cancelledAt?: string;
1644
1082
  /** @description Cancellation reason */
1645
1083
  cancellationReason?: string;
1084
+ /** @description Arbitrary metadata attached to the purchase */
1085
+ metadata?: {
1086
+ [key: string]: unknown;
1087
+ };
1646
1088
  /** @description Created at */
1647
1089
  createdAt: string;
1648
1090
  };
1649
- CancelPurchaseRequest: {
1650
- /** @description Reason for cancellation */
1651
- reason?: string;
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) */
1108
+ pricePerUnit?: number;
1109
+ billingModel?: string;
1110
+ billingCycle?: string;
1111
+ };
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: {
1127
+ /**
1128
+ * Whether the customer is within their usage limits
1129
+ * @example true
1130
+ */
1131
+ withinLimits: boolean;
1132
+ /**
1133
+ * Remaining usage units before hitting the limit
1134
+ * @example 997
1135
+ */
1136
+ remaining: number;
1137
+ /**
1138
+ * Checkout session ID if payment is required
1139
+ * @example e3f1c2d4b6a89f001122334455667788
1140
+ */
1141
+ checkoutSessionId?: string;
1142
+ /**
1143
+ * Checkout URL if payment is required
1144
+ * @example https://solvapay.com/customer/checkout?id=e3f1c2d4b6a89f001122334455667788
1145
+ */
1146
+ checkoutUrl?: string;
1147
+ /**
1148
+ * The meter name to use when tracking usage events
1149
+ * @example requests
1150
+ */
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
+ };
1652
1913
  };
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;
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
+ };
1679
1958
  };
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;
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
+ };
1706
1972
  };
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;
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
+ };
1720
1992
  };
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;
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
+ };
1732
2024
  };
1733
- UpdateThemePreferenceDto: {
1734
- /**
1735
- * Selected UI theme mode
1736
- * @example dark
1737
- * @enum {string}
1738
- */
1739
- mode: "light" | "dark";
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
+ };
1740
2038
  };
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;
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
+ };
1762
2099
  };
1763
- ThemeOverridesDto: {
1764
- /** @description Light mode color overrides */
1765
- light?: components["schemas"]["ThemeModeColorsDto"];
1766
- /** @description Dark mode color overrides */
1767
- dark?: components["schemas"]["ThemeModeColorsDto"];
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
+ };
1768
2112
  };
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"];
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
+ };
1799
2137
  };
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;
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
+ };
2166
+ };
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
+ };
2198
+ };
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
+ };
2230
+ };
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
+ };
2260
+ };
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;
2271
+ };
2272
+ requestBody: {
2273
+ content: {
2274
+ "application/json": components["schemas"]["CancelPurchaseRequest"];
2275
+ };
2276
+ };
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
+ };
2297
+ };
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
+ };
2310
+ };
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,10 @@ 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 McpBootstrapPlanInput = NonNullable<components['schemas']['McpBootstrapDto']['plans']>[number];
2390
+ type ToolPlanMappingInput = NonNullable<components['schemas']['McpBootstrapDto']['tools']>[number];
2391
+ type McpBootstrapRequest = components['schemas']['McpBootstrapDto'];
2392
+ type McpToolPlanMappingInput = NonNullable<components['schemas']['ConfigureMcpPlansDto']['toolMapping']>[number];
1922
2393
  interface McpBootstrapResponse {
1923
2394
  product: components['schemas']['SdkProductResponse'];
1924
2395
  mcpServer: {
@@ -1940,6 +2411,23 @@ interface McpBootstrapResponse {
1940
2411
  description?: string;
1941
2412
  }>;
1942
2413
  }
2414
+ type ConfigureMcpPlansRequest = components['schemas']['ConfigureMcpPlansDto'];
2415
+ interface ConfigureMcpPlansResponse {
2416
+ product: components['schemas']['SdkProductResponse'];
2417
+ mcpServer: {
2418
+ id?: string;
2419
+ reference?: string;
2420
+ subdomain?: string;
2421
+ mcpProxyUrl?: string;
2422
+ url: string;
2423
+ defaultPlanId?: string;
2424
+ };
2425
+ planMap: Record<string, {
2426
+ id: string;
2427
+ reference: string;
2428
+ name?: string;
2429
+ }>;
2430
+ }
1943
2431
  /**
1944
2432
  * SolvaPay API Client Interface
1945
2433
  *
@@ -1981,6 +2469,7 @@ interface SolvaPayClient {
1981
2469
  name: string;
1982
2470
  }>;
1983
2471
  bootstrapMcpProduct?(params: McpBootstrapRequest): Promise<McpBootstrapResponse>;
2472
+ configureMcpPlans?(productRef: string, params: ConfigureMcpPlansRequest): Promise<ConfigureMcpPlansResponse>;
1984
2473
  updateProduct?(productRef: string, params: components['schemas']['UpdateProductRequest']): Promise<components['schemas']['SdkProductResponse']>;
1985
2474
  deleteProduct?(productRef: string): Promise<void>;
1986
2475
  cloneProduct?(productRef: string, overrides?: {
@@ -1989,29 +2478,11 @@ interface SolvaPayClient {
1989
2478
  reference: string;
1990
2479
  name: string;
1991
2480
  }>;
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
- }>>;
2481
+ listPlans?(productRef: string): Promise<components['schemas']['Plan'][]>;
2006
2482
  createPlan?(params: components['schemas']['CreatePlanRequest'] & {
2007
2483
  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
- }>;
2484
+ }): Promise<components['schemas']['Plan']>;
2485
+ updatePlan?(productRef: string, planRef: string, params: components['schemas']['UpdatePlanRequest']): Promise<components['schemas']['Plan']>;
2015
2486
  deletePlan?(productRef: string, planRef: string): Promise<void>;
2016
2487
  createPaymentIntent?(params: {
2017
2488
  productRef: string;
@@ -2038,7 +2509,7 @@ interface SolvaPayClient {
2038
2509
  customerRef: string;
2039
2510
  productRef: string;
2040
2511
  }): Promise<components['schemas']['UserInfoResponse']>;
2041
- createCheckoutSession(params: components['schemas']['CreateCheckoutSessionRequest']): Promise<components['schemas']['CheckoutSessionResponse']>;
2512
+ createCheckoutSession(params: operations['CheckoutSessionSdkController_createCheckoutSession']['requestBody']['content']['application/json']): Promise<components['schemas']['CreateCheckoutSessionResponse']>;
2042
2513
  createCustomerSession(params: components['schemas']['CreateCustomerSessionRequest']): Promise<components['schemas']['CreateCustomerSessionResponse']>;
2043
2514
  }
2044
2515
 
@@ -2047,6 +2518,10 @@ interface SolvaPayClient {
2047
2518
  *
2048
2519
  * Types related to paywall protection, limits, and gating functionality.
2049
2520
  */
2521
+
2522
+ type LimitPlanSummary = components['schemas']['LimitPlanItemDto'];
2523
+ type LimitActivationBalance = components['schemas']['LimitBalanceDto'];
2524
+ type LimitActivationProduct = components['schemas']['LimitProductBriefDto'];
2050
2525
  /**
2051
2526
  * Arguments passed to protected handlers
2052
2527
  */
@@ -2065,14 +2540,29 @@ interface PaywallMetadata {
2065
2540
  usageType?: 'requests' | 'tokens';
2066
2541
  }
2067
2542
  /**
2068
- * Structured content for paywall errors
2543
+ * Structured content for paywall errors (MCP structuredContent and manual handling).
2069
2544
  */
2070
- interface PaywallStructuredContent {
2545
+ type PaywallStructuredContent = {
2071
2546
  kind: 'payment_required';
2547
+ /** Product ref from paywall metadata (or env default) */
2072
2548
  product: string;
2073
2549
  checkoutUrl: string;
2074
2550
  message: string;
2075
- }
2551
+ } | {
2552
+ kind: 'activation_required';
2553
+ /** Product ref from paywall metadata (or env default) */
2554
+ product: string;
2555
+ message: string;
2556
+ /**
2557
+ * Best URL for completing purchase or confirmation; mirrors confirmationUrl when present.
2558
+ */
2559
+ checkoutUrl: string;
2560
+ confirmationUrl?: string;
2561
+ plans?: LimitPlanSummary[];
2562
+ balance?: LimitActivationBalance;
2563
+ /** Rich product context from checkLimits (name, ref, provider slug/id) */
2564
+ productDetails?: LimitActivationProduct;
2565
+ };
2076
2566
  /**
2077
2567
  * MCP tool result with optional paywall information
2078
2568
  */
@@ -2084,7 +2574,7 @@ interface PaywallToolResult {
2084
2574
  mimeType?: string;
2085
2575
  }>;
2086
2576
  isError?: boolean;
2087
- structuredContent?: PaywallStructuredContent;
2577
+ structuredContent?: PaywallStructuredContent | Record<string, unknown>;
2088
2578
  }
2089
2579
 
2090
2580
  /**
@@ -2126,6 +2616,16 @@ interface RetryOptions {
2126
2616
  */
2127
2617
  onRetry?: (error: Error, attempt: number) => void;
2128
2618
  }
2619
+ interface McpToolExtra {
2620
+ authInfo?: {
2621
+ token: string;
2622
+ clientId: string;
2623
+ scopes: string[];
2624
+ expiresAt?: number;
2625
+ extra?: Record<string, unknown>;
2626
+ };
2627
+ [key: string]: unknown;
2628
+ }
2129
2629
  /**
2130
2630
  * Options for configuring payable protection
2131
2631
  */
@@ -2196,7 +2696,7 @@ interface McpAdapterOptions {
2196
2696
  /**
2197
2697
  * Extract customer reference from MCP args
2198
2698
  */
2199
- getCustomerRef?: (args: any) => string | Promise<string>;
2699
+ getCustomerRef?: (args: any, extra?: McpToolExtra) => string | Promise<string>;
2200
2700
  /**
2201
2701
  * Transform the response before wrapping in MCP format
2202
2702
  */
@@ -2215,7 +2715,7 @@ interface VirtualToolsOptions {
2215
2715
  /** Product reference (required) */
2216
2716
  product: string;
2217
2717
  /** Extract customer reference from MCP tool args */
2218
- getCustomerRef: (args: Record<string, unknown>) => string;
2718
+ getCustomerRef: (args: Record<string, unknown>, extra?: McpToolExtra) => string;
2219
2719
  /** Tool names to exclude from registration (optional) */
2220
2720
  exclude?: string[];
2221
2721
  }
@@ -2227,7 +2727,7 @@ interface VirtualToolDefinition {
2227
2727
  properties: Record<string, object>;
2228
2728
  required: string[];
2229
2729
  };
2230
- handler: (args: Record<string, unknown>) => Promise<{
2730
+ handler: (args: Record<string, unknown>, extra?: McpToolExtra) => Promise<{
2231
2731
  content: Array<{
2232
2732
  type: string;
2233
2733
  text: string;
@@ -2246,6 +2746,25 @@ declare const VIRTUAL_TOOL_DEFINITIONS: {
2246
2746
  }[];
2247
2747
  declare function createVirtualTools(apiClient: SolvaPayClient, options: VirtualToolsOptions): VirtualToolDefinition[];
2248
2748
 
2749
+ type ZodRawShape = Record<string, unknown>;
2750
+ type JsonSchemaProperty = {
2751
+ type?: string;
2752
+ enum?: unknown[];
2753
+ items?: JsonSchemaProperty;
2754
+ properties?: Record<string, JsonSchemaProperty>;
2755
+ };
2756
+ interface McpServerLike {
2757
+ registerTool: (name: string, config: Record<string, unknown>, handler: (args: Record<string, unknown>, extra?: McpToolExtra) => unknown) => unknown;
2758
+ }
2759
+ interface RegisterVirtualToolsMcpOptions extends Omit<VirtualToolsOptions, 'getCustomerRef'> {
2760
+ getCustomerRef?: VirtualToolsOptions['getCustomerRef'];
2761
+ filter?: (definition: VirtualToolDefinition) => boolean;
2762
+ mapDefinition?: (definition: VirtualToolDefinition) => VirtualToolDefinition;
2763
+ wrapHandler?: (handler: VirtualToolDefinition['handler'], definition: VirtualToolDefinition) => (args: Record<string, unknown>, extra?: McpToolExtra) => Promise<unknown> | unknown;
2764
+ }
2765
+ declare function jsonSchemaToZodRawShape(properties: Record<string, JsonSchemaProperty>, required?: string[]): ZodRawShape;
2766
+ declare function registerVirtualToolsMcpImpl(server: McpServerLike, apiClient: SolvaPayClient, options: RegisterVirtualToolsMcpOptions): void;
2767
+
2249
2768
  /**
2250
2769
  * Configuration for creating a SolvaPay instance.
2251
2770
  *
@@ -2363,7 +2882,7 @@ interface PayableFunction {
2363
2882
  * });
2364
2883
  * ```
2365
2884
  */
2366
- mcp<T = any>(businessLogic: (args: any) => Promise<T>, options?: McpAdapterOptions): (args: Record<string, unknown>) => Promise<unknown>;
2885
+ mcp<T = any>(businessLogic: (args: any) => Promise<T>, options?: McpAdapterOptions): (args: Record<string, unknown>, extra?: McpToolExtra) => Promise<unknown>;
2367
2886
  /**
2368
2887
  * Pure function adapter for direct function protection.
2369
2888
  *
@@ -2564,14 +3083,17 @@ interface SolvaPay {
2564
3083
  customerRef: string;
2565
3084
  productRef: string;
2566
3085
  planRef?: string;
2567
- meterName?: 'requests' | 'tokens';
2568
- usageType?: 'requests' | 'tokens';
3086
+ meterName?: string;
3087
+ usageType?: string;
2569
3088
  }): Promise<{
2570
3089
  withinLimits: boolean;
2571
3090
  remaining: number;
2572
3091
  plan: string;
2573
3092
  checkoutUrl?: string;
2574
3093
  meterName?: string;
3094
+ creditBalance?: number;
3095
+ pricePerUnit?: number;
3096
+ currency?: string;
2575
3097
  }>;
2576
3098
  /**
2577
3099
  * Track usage for a customer action.
@@ -2635,6 +3157,7 @@ interface SolvaPay {
2635
3157
  createCustomer(params: {
2636
3158
  email: string;
2637
3159
  name?: string;
3160
+ metadata?: Record<string, unknown>;
2638
3161
  }): Promise<{
2639
3162
  customerRef: string;
2640
3163
  }>;
@@ -2736,6 +3259,13 @@ interface SolvaPay {
2736
3259
  * fast setup flows where you want one call for product + plans + MCP config.
2737
3260
  */
2738
3261
  bootstrapMcpProduct(params: McpBootstrapRequest): Promise<McpBootstrapResponse>;
3262
+ /**
3263
+ * Configure MCP plans and tool mappings for an existing MCP product.
3264
+ *
3265
+ * This helper wraps the backend MCP plans endpoint and supports adding/removing
3266
+ * paid plans as well as remapping tool access.
3267
+ */
3268
+ configureMcpPlans(productRef: string, params: ConfigureMcpPlansRequest): Promise<ConfigureMcpPlansResponse>;
2739
3269
  /**
2740
3270
  * Get virtual tool definitions with bound handlers for MCP server integration.
2741
3271
  *
@@ -2755,7 +3285,7 @@ interface SolvaPay {
2755
3285
  * ```typescript
2756
3286
  * const virtualTools = solvaPay.getVirtualTools({
2757
3287
  * product: 'prd_myapi',
2758
- * getCustomerRef: args => args._auth?.customer_ref || 'anonymous',
3288
+ * getCustomerRef: (_args, extra) => String(extra?.authInfo?.extra?.customer_ref || 'anonymous'),
2759
3289
  * });
2760
3290
  *
2761
3291
  * // Register on your MCP server
@@ -2765,6 +3295,13 @@ interface SolvaPay {
2765
3295
  * ```
2766
3296
  */
2767
3297
  getVirtualTools(options: VirtualToolsOptions): VirtualToolDefinition[];
3298
+ /**
3299
+ * Register virtual tools directly on an MCP server with one call.
3300
+ *
3301
+ * This helper converts virtual tool JSON schemas to Zod schemas and registers
3302
+ * each tool on an MCP server that supports `registerTool()`.
3303
+ */
3304
+ registerVirtualToolsMcp(server: McpServerLike, options: RegisterVirtualToolsMcpOptions): Promise<void>;
2768
3305
  /**
2769
3306
  * Direct access to the API client for advanced operations.
2770
3307
  *
@@ -2936,6 +3473,78 @@ declare class PaywallError extends Error {
2936
3473
  */
2937
3474
  constructor(message: string, structuredContent: PaywallStructuredContent);
2938
3475
  }
3476
+ /** JSON body shape for HTTP adapters and MCP text content (stable fields for clients). */
3477
+ declare function paywallErrorToClientPayload(error: PaywallError): Record<string, unknown>;
3478
+
3479
+ /**
3480
+ * MCP OAuth helper utilities.
3481
+ *
3482
+ * These helpers are intentionally lightweight and do not verify JWT signatures.
3483
+ * Use them after token validation (for example via /v1/customer/auth/userinfo).
3484
+ */
3485
+ declare class McpBearerAuthError extends Error {
3486
+ constructor(message: string);
3487
+ }
3488
+ type McpBearerCustomerRefOptions = {
3489
+ claimPriority?: string[];
3490
+ };
3491
+ declare function extractBearerToken(authorization?: string | null): string | null;
3492
+ declare function decodeJwtPayload(token: string): Record<string, unknown>;
3493
+ declare function getCustomerRefFromJwtPayload(payload: Record<string, unknown>, options?: McpBearerCustomerRefOptions): string;
3494
+ declare function getCustomerRefFromBearerAuthHeader(authorization?: string | null, options?: McpBearerCustomerRefOptions): string;
3495
+
3496
+ interface BuildAuthInfoFromBearerOptions extends McpBearerCustomerRefOptions {
3497
+ clientId?: string;
3498
+ defaultScopes?: string[];
3499
+ includePayload?: boolean;
3500
+ }
3501
+ declare function buildAuthInfoFromBearer(authorization?: string | null, options?: BuildAuthInfoFromBearerOptions): McpToolExtra['authInfo'] | null;
3502
+
3503
+ type RequestLike = {
3504
+ method?: string;
3505
+ path?: string;
3506
+ headers?: Record<string, string | string[] | undefined>;
3507
+ body?: unknown;
3508
+ auth?: unknown;
3509
+ };
3510
+ type ResponseLike = {
3511
+ status: (code: number) => ResponseLike;
3512
+ json: (payload: unknown) => void;
3513
+ setHeader: (name: string, value: string) => void;
3514
+ };
3515
+ type NextLike = () => void;
3516
+ type Middleware = (req: RequestLike, res: ResponseLike, next: NextLike) => void;
3517
+ interface OAuthAuthorizationServerOptions {
3518
+ apiBaseUrl: string;
3519
+ productRef: string;
3520
+ }
3521
+ interface McpOAuthBridgeOptions {
3522
+ publicBaseUrl: string;
3523
+ apiBaseUrl: string;
3524
+ productRef: string;
3525
+ mcpPath?: string;
3526
+ requireAuth?: boolean;
3527
+ authInfo?: BuildAuthInfoFromBearerOptions;
3528
+ protectedResourcePath?: string;
3529
+ authorizationServerPath?: string;
3530
+ }
3531
+ declare function getOAuthProtectedResourceResponse(publicBaseUrl: string): {
3532
+ resource: string;
3533
+ authorization_servers: string[];
3534
+ scopes_supported: string[];
3535
+ };
3536
+ declare function getOAuthAuthorizationServerResponse({ apiBaseUrl, productRef, }: OAuthAuthorizationServerOptions): {
3537
+ issuer: string;
3538
+ authorization_endpoint: string;
3539
+ token_endpoint: string;
3540
+ registration_endpoint: string;
3541
+ token_endpoint_auth_methods_supported: string[];
3542
+ response_types_supported: string[];
3543
+ grant_types_supported: string[];
3544
+ scopes_supported: string[];
3545
+ code_challenge_methods_supported: string[];
3546
+ };
3547
+ declare function createMcpOAuthBridge(options: McpOAuthBridgeOptions): Middleware[];
2939
3548
 
2940
3549
  /**
2941
3550
  * Utility functions for the SolvaPay Server SDK
@@ -2980,23 +3589,6 @@ declare class PaywallError extends Error {
2980
3589
  */
2981
3590
  declare function withRetry<T>(fn: () => Promise<T>, options?: RetryOptions): Promise<T>;
2982
3591
 
2983
- /**
2984
- * MCP OAuth helper utilities.
2985
- *
2986
- * These helpers are intentionally lightweight and do not verify JWT signatures.
2987
- * Use them after token validation (for example via /v1/customer/auth/userinfo).
2988
- */
2989
- declare class McpBearerAuthError extends Error {
2990
- constructor(message: string);
2991
- }
2992
- type McpBearerCustomerRefOptions = {
2993
- claimPriority?: string[];
2994
- };
2995
- declare function extractBearerToken(authorization?: string | null): string | null;
2996
- declare function decodeJwtPayload(token: string): Record<string, unknown>;
2997
- declare function getCustomerRefFromJwtPayload(payload: Record<string, unknown>, options?: McpBearerCustomerRefOptions): string;
2998
- declare function getCustomerRefFromBearerAuthHeader(authorization?: string | null, options?: McpBearerCustomerRefOptions): string;
2999
-
3000
3592
  /**
3001
3593
  * Helper Types
3002
3594
  *
@@ -3304,11 +3896,12 @@ declare function cancelPurchaseCore(request: Request, body: {
3304
3896
  * This is a public route - no authentication required.
3305
3897
  */
3306
3898
 
3899
+ type Plan = components['schemas']['Plan'];
3307
3900
  /**
3308
3901
  * List plans - core implementation
3309
3902
  */
3310
3903
  declare function listPlansCore(request: Request): Promise<{
3311
- plans: Record<string, unknown>[];
3904
+ plans: Plan[];
3312
3905
  productRef: string;
3313
3906
  } | ErrorResult>;
3314
3907
 
@@ -3367,4 +3960,4 @@ declare function verifyWebhook({ body, signature, secret, }: {
3367
3960
  secret: string;
3368
3961
  }): WebhookEvent;
3369
3962
 
3370
- export { type AuthenticatedUser, type CreateSolvaPayConfig, type CustomerResponseMapped, type ErrorResult, type HttpAdapterOptions, type McpAdapterOptions, McpBearerAuthError, type McpBootstrapFreePlanConfig, type McpBootstrapPaidPlanInput, type McpBootstrapRequest, type McpBootstrapResponse, type NextAdapterOptions, type OneTimePurchaseInfo, type PayableFunction, type PayableOptions, type PaywallArgs, PaywallError, type PaywallMetadata, type PaywallStructuredContent, type PaywallToolResult, type ProcessPaymentResult, type RetryOptions, type ServerClientOptions, type SolvaPay, type SolvaPayClient, type ToolPlanMappingInput, VIRTUAL_TOOL_DEFINITIONS, type VirtualToolDefinition, type VirtualToolsOptions, type WebhookEvent, type WebhookEventType, cancelPurchaseCore, createCheckoutSessionCore, createCustomerSessionCore, createPaymentIntentCore, createSolvaPay, createSolvaPayClient, createVirtualTools, decodeJwtPayload, extractBearerToken, getAuthenticatedUserCore, getCustomerRefFromBearerAuthHeader, getCustomerRefFromJwtPayload, handleRouteError, isErrorResult, listPlansCore, processPaymentIntentCore, syncCustomerCore, verifyWebhook, withRetry };
3963
+ export { type AuthenticatedUser, type ConfigureMcpPlansRequest, type ConfigureMcpPlansResponse, type CreateSolvaPayConfig, type CustomerResponseMapped, type CustomerWebhookObject, type ErrorResult, type HttpAdapterOptions, type LimitActivationBalance, type LimitActivationProduct, type LimitPlanSummary, type McpAdapterOptions, McpBearerAuthError, type McpBootstrapPlanInput, type McpBootstrapRequest, type McpBootstrapResponse, type McpServerLike, type McpToolExtra, type McpToolPlanMappingInput, type NextAdapterOptions, type OneTimePurchaseInfo, type PayableFunction, type PayableOptions, type PaywallArgs, PaywallError, type PaywallMetadata, type PaywallStructuredContent, type PaywallToolResult, type ProcessPaymentResult, type RegisterVirtualToolsMcpOptions, type RetryOptions, type ServerClientOptions, type SolvaPay, type SolvaPayClient, type ToolPlanMappingInput, VIRTUAL_TOOL_DEFINITIONS, type VirtualToolDefinition, type VirtualToolsOptions, type WebhookEvent, type WebhookEventForType, type WebhookEventObjectMap, type WebhookEventType, type WebhookProduct, buildAuthInfoFromBearer, cancelPurchaseCore, type components, createCheckoutSessionCore, createCustomerSessionCore, createMcpOAuthBridge, createPaymentIntentCore, createSolvaPay, createSolvaPayClient, createVirtualTools, decodeJwtPayload, extractBearerToken, getAuthenticatedUserCore, getCustomerRefFromBearerAuthHeader, getCustomerRefFromJwtPayload, getOAuthAuthorizationServerResponse, getOAuthProtectedResourceResponse, handleRouteError, isErrorResult, jsonSchemaToZodRawShape, listPlansCore, paywallErrorToClientPayload, processPaymentIntentCore, registerVirtualToolsMcpImpl, syncCustomerCore, verifyWebhook, withRetry };