@solvapay/server 1.0.6 → 1.0.8-preview.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/edge.d.ts CHANGED
@@ -49,198 +49,35 @@ type WebhookEvent = {
49
49
 
50
50
  interface components {
51
51
  schemas: {
52
- UpdateProviderDto: {
53
- /** @description Legal entity information */
54
- legalEntity?: Record<string, never>;
55
- /**
56
- * Provider description
57
- * @example My business
58
- */
59
- description?: string;
60
- /**
61
- * Business website URL
62
- * @example https://example.com
63
- */
64
- website?: string;
65
- /**
66
- * Business type
67
- * @example individual
68
- * @enum {string}
69
- */
70
- businessType?: "individual" | "company";
71
- /**
72
- * Business email address
73
- * @example business@example.com
74
- */
75
- businessEmail?: string;
76
- /**
77
- * Support email address
78
- * @example support@example.com
79
- */
80
- supportEmail?: string;
81
- /**
82
- * Business telephone number
83
- * @example +1234567890
84
- */
85
- telephone?: string;
86
- /**
87
- * Support telephone number
88
- * @example +1234567890
89
- */
90
- supportTelephone?: string;
91
- /**
92
- * Default currency code
93
- * @example usd
94
- */
95
- defaultCurrency?: string;
96
- /** @description Arbitrary metadata */
97
- metadata?: Record<string, never>;
98
- /** @description Terms of Service acceptance */
99
- tosAcceptance?: Record<string, never>;
100
- };
101
- CreateSecretKey: Record<string, never>;
102
- CreateUser: Record<string, never>;
103
- UpdateUser: Record<string, never>;
104
- UpdateProfile: Record<string, never>;
105
- UpdatePreferences: Record<string, never>;
106
- RequestEmailChange: {
107
- newEmail: string;
108
- };
109
- VerifyEmailChange: {
110
- code: string;
111
- };
112
- CreateUiCheckoutSessionRequest: {
113
- /**
114
- * Customer reference
115
- * @example cus_3c4d5e6f7g8h
116
- */
52
+ CreatePaymentIntentDto: {
53
+ productRef?: string;
117
54
  customerRef: string;
118
- /**
119
- * Plan reference (optional)
120
- * @example pln_2b3c4d5e6f7g
121
- */
122
55
  planRef?: string;
56
+ pricingTier?: string;
123
57
  /**
124
- * Product reference (required)
125
- * @example prd_1a2b3c4d5e6f
126
- */
127
- productRef: string;
128
- };
129
- CreateUiCheckoutSessionResponse: {
130
- /**
131
- * Checkout session ID
132
- * @example 507f1f77bcf86cd799439011
133
- */
134
- id: string;
135
- /**
136
- * Public session ID used in checkout URL
137
- * @example a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6
138
- */
139
- sessionId: string;
140
- /**
141
- * Amount in cents
142
- * @example 2999
143
- */
144
- amount: number;
145
- /**
146
- * Currency code
147
- * @example USD
148
- */
149
- currency: string;
150
- /**
151
- * Session status
152
- * @example active
153
- */
154
- status: string;
155
- /**
156
- * Checkout URL to open the checkout page
157
- * @example https://solvapay.com/customer/checkout?id=a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6
158
- */
159
- checkoutUrl: string;
160
- };
161
- SelectCustomerSessionProductRequest: {
162
- /**
163
- * Product reference or ID to scope the customer manage session
164
- * @example prd_1a2b3c4d5e6f
165
- */
166
- productRef: string;
167
- };
168
- CancelRenewalRequest: {
169
- /** @description Reason for cancelling renewal */
170
- reason?: string;
171
- };
172
- ExternalAccount: {
173
- /**
174
- * Country code
175
- * @example US
176
- */
177
- country: string;
178
- /**
179
- * Currency code
180
- * @example usd
181
- */
182
- currency: string;
183
- /**
184
- * Account holder name
185
- * @example John Doe
186
- */
187
- accountHolderName: string;
188
- /**
189
- * Account holder type
190
- * @example individual
58
+ * @default product
191
59
  * @enum {string}
192
60
  */
193
- accountHolderType: "individual" | "company";
194
- /**
195
- * Routing number
196
- * @example 110000000
197
- */
198
- routingNumber: string;
199
- /**
200
- * Account number
201
- * @example 000123456789
202
- */
203
- accountNumber: string;
204
- };
205
- TosAcceptance: {
206
- /**
207
- * IP address of user accepting ToS
208
- * @example 192.168.1.1
209
- */
210
- ip: string;
211
- };
212
- UpdateConnectedAccount: {
213
- /**
214
- * Business website URL
215
- * @example https://example.com
216
- */
217
- website?: string;
218
- /** @description External bank account */
219
- externalAccount?: components["schemas"]["ExternalAccount"];
220
- /** @description Terms of Service acceptance */
221
- tosAcceptance?: components["schemas"]["TosAcceptance"];
61
+ purpose: "product" | "credit_topup" | "usage_billing";
62
+ amount?: number;
63
+ currency?: string;
64
+ description?: string;
222
65
  };
223
66
  CreateCheckoutSessionRequest: {
224
- /**
225
- * Customer reference identifier
226
- * @example cus_3c4d5e6f7g8h
227
- */
228
67
  customerRef: string;
229
- /**
230
- * Product reference identifier
231
- * @example prd_1A2B3C4D
232
- */
233
- productRef: string;
234
- /**
235
- * Plan reference identifier (optional)
236
- * @example pln_2b3c4d5e6f7g
237
- */
68
+ productRef?: string;
238
69
  planRef?: string;
239
- /**
240
- * URL to redirect to after successful payment (optional)
241
- * @example https://example.com/payment-success
242
- */
243
70
  returnUrl?: string;
71
+ /** @enum {string} */
72
+ purpose?: "credit_topup";
73
+ };
74
+ CancelPurchaseRequest: {
75
+ reason?: string;
76
+ };
77
+ ProcessPaymentIntentDto: {
78
+ productRef: string;
79
+ customerRef: string;
80
+ planRef?: string;
244
81
  };
245
82
  CreateCheckoutSessionResponse: {
246
83
  /**
@@ -254,151 +91,33 @@ interface components {
254
91
  */
255
92
  checkoutUrl: string;
256
93
  };
257
- Signup: {
258
- name: string;
259
- email: string;
260
- /** @enum {string} */
261
- type?: "provider" | "admin" | "super_admin";
262
- };
263
- AuthUserDto: {
264
- id: string;
265
- name: string;
266
- email: string;
267
- /** @enum {string} */
268
- type: "provider" | "admin" | "super_admin";
269
- emailVerified: boolean;
270
- /** @enum {string} */
271
- authProvider: "local" | "google" | "github" | "facebook";
272
- providerId?: string;
273
- providerRole?: string;
274
- preferences?: Record<string, never>;
275
- };
276
- AuthResponse: {
277
- user: components["schemas"]["AuthUserDto"];
278
- accessToken?: string;
279
- refreshToken?: string;
280
- expiresIn?: number;
281
- message?: string;
282
- requiresMfa?: boolean;
283
- requiresMfaSetup?: boolean;
284
- };
285
- Login: {
286
- /** @description Email to send a 6-digit login code to */
287
- email: string;
288
- };
289
- VerifyLoginCode: {
290
- email: string;
291
- /** @description 6-digit login code sent to email */
292
- code: string;
293
- };
294
- VerifyEmail: {
295
- emailVerificationCode: string;
296
- };
297
- DynamicClientRegistrationDto: {
298
- /** @example My AI Agent */
299
- client_name: string;
300
- /**
301
- * @example [
302
- * "https://agent.example.com/callback"
303
- * ]
304
- */
305
- redirect_uris: string[];
306
- /**
307
- * @example [
308
- * "authorization_code",
309
- * "refresh_token"
310
- * ]
311
- */
312
- grant_types?: string[];
313
- /**
314
- * @example [
315
- * "code"
316
- * ]
317
- */
318
- response_types?: string[];
319
- /** @example agent-123 */
320
- software_id?: string;
321
- /** @example 1.0.0 */
322
- software_version?: string;
323
- /** @example https://example.com/logo.png */
324
- logo_uri?: string;
325
- /** @example https://example.com/tos */
326
- tos_uri?: string;
327
- /** @example https://example.com/policy */
328
- policy_uri?: string;
329
- /** @example https://example.com */
330
- client_uri?: string;
331
- };
332
- DynamicClientRegistrationResponseDto: {
333
- /** @example client-id-123 */
334
- client_id: string;
335
- /** @example client-secret-456 */
336
- client_secret: string;
337
- /** @example 1734567890 */
338
- client_id_issued_at: number;
339
- /** @example 0 */
340
- client_secret_expires_at: number;
341
- /** @example My AI Agent */
342
- client_name: string;
343
- /**
344
- * @example [
345
- * "https://agent.example.com/callback"
346
- * ]
347
- */
348
- redirect_uris: string[];
349
- /**
350
- * @example [
351
- * "authorization_code",
352
- * "refresh_token"
353
- * ]
354
- */
355
- grant_types: string[];
356
- /**
357
- * @example [
358
- * "code"
359
- * ]
360
- */
361
- response_types: string[];
362
- /** @example openid profile email */
363
- scope: string;
364
- /** @example client_secret_basic */
365
- token_endpoint_auth_method: string;
366
- };
367
- GoogleLoginDto: {
368
- /** @description The authorization code returned by Google */
369
- code: string;
370
- /** @description The redirect URI used in the initial authorization request */
371
- redirect_uri: string;
372
- /** @description The state parameter returned by Google (contains client_id) */
373
- state: string;
374
- };
375
- GithubLoginDto: {
376
- /** @description The authorization code returned by GitHub */
377
- code: string;
378
- /** @description The redirect URI used in the initial authorization request */
379
- redirect_uri: string;
380
- /** @description The state parameter returned by GitHub (contains client_id) */
381
- state: string;
382
- };
383
- CreateOAuthClientDto: Record<string, never>;
384
- UpdateOAuthClientDto: Record<string, never>;
385
94
  Plan: {
386
95
  /**
387
96
  * Plan type exposed in SDK
388
97
  * @example recurring
389
98
  * @enum {string}
390
99
  */
391
- type: "recurring" | "one-time";
392
- /**
393
- * Plan ID
394
- * @example 507f1f77bcf86cd799439011
395
- */
396
- id: string;
100
+ type: "recurring" | "one-time" | "usage-based" | "hybrid";
397
101
  /**
398
102
  * Plan reference
399
103
  * @example pln_1A2B3C4D
400
104
  */
401
105
  reference: string;
106
+ /**
107
+ * Meter reference for usage-based plans
108
+ * @example mtr_1A2B3C4D
109
+ */
110
+ meterRef?: 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;
402
121
  /**
403
122
  * Plan price in cents
404
123
  * @example 2999
@@ -441,10 +160,10 @@ interface components {
441
160
  */
442
161
  billingModel?: "pre-paid" | "post-paid";
443
162
  /**
444
- * Price per usage unit
445
- * @example 0.01
163
+ * Credits per usage unit (integer, >= 1)
164
+ * @example 1
446
165
  */
447
- pricePerUnit?: number;
166
+ creditsPerUnit?: number;
448
167
  /**
449
168
  * What the plan measures for usage tracking
450
169
  * @example requests
@@ -468,11 +187,6 @@ interface components {
468
187
  features?: {
469
188
  [key: string]: unknown;
470
189
  };
471
- /**
472
- * Whether this is a free tier plan
473
- * @example false
474
- */
475
- isFreeTier: boolean;
476
190
  /**
477
191
  * Whether payment is required
478
192
  * @example true
@@ -498,176 +212,87 @@ interface components {
498
212
  updatedAt: string;
499
213
  };
500
214
  CreatePlanRequest: {
501
- /**
502
- * Plan type exposed in SDK
503
- * @example recurring
504
- * @enum {string}
505
- */
506
- type?: "recurring" | "one-time";
507
- /**
508
- * Billing cycle (required for recurring/hybrid, optional for post-paid usage-based)
509
- * @example monthly
510
- * @enum {string}
511
- */
215
+ name?: string;
216
+ description?: string;
217
+ /** @enum {string} */
218
+ type?: "recurring" | "usage-based" | "one-time" | "hybrid";
219
+ /** @enum {string} */
512
220
  billingCycle?: "weekly" | "monthly" | "quarterly" | "yearly" | "custom";
513
- /**
514
- * Plan price in cents
515
- * @example 2999
516
- */
517
221
  price?: number;
518
- /**
519
- * Currency code (ISO 4217)
520
- * @example USD
521
- * @enum {string}
522
- */
523
- 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";
524
- /**
525
- * Number of free units included
526
- * @example 100
527
- */
222
+ creditsPerUnit?: number;
223
+ currency?: string;
224
+ /** @enum {string} */
225
+ billingModel?: "pre-paid" | "post-paid";
528
226
  freeUnits?: number;
529
- /**
530
- * Usage limit for the meter
531
- * @example 10000
532
- */
533
227
  limit?: number;
534
- /**
535
- * Usage limits (shape varies by plan type)
536
- * @example {
537
- * "maxTransactions": 1000
538
- * }
539
- */
540
- limits?: {
228
+ basePrice?: number;
229
+ setupFee?: number;
230
+ trialDays?: number;
231
+ rolloverUnusedUnits?: boolean;
232
+ autoRenew?: boolean;
233
+ usageTracking: {
234
+ /** @enum {string} */
235
+ method?: "automatic" | "manual" | "hybrid";
236
+ /** @enum {string} */
237
+ granularity?: "hourly" | "daily" | "weekly" | "monthly";
238
+ };
239
+ limits: {
541
240
  [key: string]: unknown;
542
241
  };
543
- /**
544
- * Plan features (generic key/value, shape is provider-defined)
545
- * @example {
546
- * "apiAccess": true,
547
- * "prioritySupport": false
548
- * }
549
- */
550
- features?: {
242
+ metadata: {
551
243
  [key: string]: unknown;
552
244
  };
553
- /**
554
- * Whether this is a free tier plan
555
- * @example false
556
- */
557
- isFreeTier?: boolean;
558
- /**
559
- * Whether payment is required
560
- * @example true
561
- */
562
- requiresPayment?: boolean;
563
- /**
564
- * Plan status
565
- * @example active
566
- * @enum {string}
567
- */
245
+ features: {
246
+ [key: string]: unknown;
247
+ };
248
+ /** @enum {string} */
568
249
  status?: "active" | "inactive" | "archived";
569
- /**
570
- * Maximum number of active users
571
- * @example 10
572
- */
573
250
  maxActiveUsers?: number;
574
- /**
575
- * Access expiry in days
576
- * @example 30
577
- */
578
251
  accessExpiryDays?: number;
579
- /** @description Additional metadata */
580
- metadata?: {
581
- [key: string]: unknown;
582
- };
583
- /**
584
- * Whether this is the default plan
585
- * @example false
586
- */
587
252
  default?: boolean;
588
253
  };
589
254
  UpdatePlanRequest: {
590
- /**
591
- * Billing cycle
592
- * @example monthly
593
- * @enum {string}
594
- */
255
+ name?: string;
256
+ description?: string;
257
+ /** @enum {string} */
595
258
  billingCycle?: "weekly" | "monthly" | "quarterly" | "yearly" | "custom";
596
- /**
597
- * Plan price in cents
598
- * @example 2999
599
- */
600
259
  price?: number;
601
- /**
602
- * Currency code (ISO 4217)
603
- * @example USD
604
- */
260
+ creditsPerUnit?: number;
605
261
  currency?: string;
606
- /**
607
- * Number of free units included
608
- * @example 100
609
- */
262
+ /** @enum {string} */
263
+ billingModel?: "pre-paid" | "post-paid";
610
264
  freeUnits?: number;
611
- /**
612
- * Usage limit for the meter
613
- * @example 10000
614
- */
615
265
  limit?: number;
616
- /**
617
- * Usage limits (shape varies by plan type)
618
- * @example {
619
- * "maxTransactions": 1000
620
- * }
621
- */
622
- limits?: {
266
+ limits: {
623
267
  [key: string]: unknown;
624
268
  };
625
- /**
626
- * Plan features (generic key/value, shape is provider-defined)
627
- * @example {
628
- * "apiAccess": true,
629
- * "prioritySupport": false
630
- * }
631
- */
632
- features?: {
269
+ features: {
633
270
  [key: string]: unknown;
634
271
  };
635
- /**
636
- * Whether this is a free tier plan
637
- * @example false
638
- */
639
- isFreeTier?: boolean;
640
- /**
641
- * Whether payment is required
642
- * @example true
643
- */
644
- requiresPayment?: boolean;
645
- /**
646
- * Plan status
647
- * @example active
648
- * @enum {string}
649
- */
272
+ /** @enum {string} */
650
273
  status?: "active" | "inactive" | "archived";
651
- /**
652
- * Maximum number of active users
653
- * @example 10
654
- */
655
274
  maxActiveUsers?: number;
656
- /**
657
- * Access expiry in days
658
- * @example 30
659
- */
660
275
  accessExpiryDays?: number;
661
- /** @description Additional metadata */
662
- metadata?: {
276
+ metadata: {
663
277
  [key: string]: unknown;
664
278
  };
665
- /**
666
- * Whether this is the default plan
667
- * @example false
668
- */
669
279
  default?: boolean;
670
280
  };
281
+ CreateProductRequest: {
282
+ name: string;
283
+ description?: string;
284
+ imageUrl?: string;
285
+ productType?: string;
286
+ isMcpPay?: boolean;
287
+ config: {
288
+ fulfillmentType?: string;
289
+ validityPeriod?: number;
290
+ deliveryMethod?: string;
291
+ };
292
+ metadata: {
293
+ [key: string]: unknown;
294
+ };
295
+ };
671
296
  ProductConfigDto: {
672
297
  /**
673
298
  * Fulfillment type
@@ -685,42 +310,7 @@ interface components {
685
310
  */
686
311
  deliveryMethod?: string;
687
312
  };
688
- CreateProductRequest: {
689
- /**
690
- * Product name
691
- * @example AI Writing Assistant
692
- */
693
- name: string;
694
- /**
695
- * Product description
696
- * @example AI-powered writing tool
697
- */
698
- description?: string;
699
- /** @description URL to the product image */
700
- imageUrl?: string;
701
- /**
702
- * Free-form product type defined by the provider
703
- * @example Coding Assistant
704
- */
705
- productType?: string;
706
- /**
707
- * Whether this product uses MCP Pay proxy
708
- * @default false
709
- */
710
- isMcpPay: boolean;
711
- /** @description Product-specific configuration */
712
- config?: components["schemas"]["ProductConfigDto"];
713
- /** @description Arbitrary key-value metadata */
714
- metadata?: {
715
- [key: string]: unknown;
716
- };
717
- };
718
313
  SdkPlanResponse: {
719
- /**
720
- * Plan ID
721
- * @example 507f1f77bcf86cd799439011
722
- */
723
- id: string;
724
314
  /**
725
315
  * Plan reference
726
316
  * @example pln_1A2B3C4D
@@ -762,15 +352,20 @@ interface components {
762
352
  */
763
353
  billingModel?: string;
764
354
  /**
765
- * Price per unit in cents
766
- * @example 10
355
+ * Credits per usage unit (integer, >= 1)
356
+ * @example 1
767
357
  */
768
- pricePerUnit?: number;
358
+ creditsPerUnit?: number;
769
359
  /**
770
360
  * What the plan measures for usage tracking
771
361
  * @example requests
772
362
  */
773
363
  measures?: string;
364
+ /**
365
+ * Meter reference for usage-based limits
366
+ * @example mtr_1A2B3C4D
367
+ */
368
+ meterRef?: string;
774
369
  /**
775
370
  * Usage limit for the meter
776
371
  * @example 10000
@@ -794,11 +389,6 @@ interface components {
794
389
  features?: {
795
390
  [key: string]: unknown;
796
391
  };
797
- /**
798
- * Whether this is a free tier plan
799
- * @example false
800
- */
801
- isFreeTier: boolean;
802
392
  /**
803
393
  * Whether payment is required
804
394
  * @example true
@@ -820,11 +410,6 @@ interface components {
820
410
  updatedAt: string;
821
411
  };
822
412
  SdkProductResponse: {
823
- /**
824
- * Product ID
825
- * @example 507f1f77bcf86cd799439011
826
- */
827
- id: string;
828
413
  /**
829
414
  * Product reference
830
415
  * @example prd_1A2B3C4D
@@ -876,12 +461,11 @@ interface components {
876
461
  /**
877
462
  * MCP linkage details for MCP-enabled products
878
463
  * @example {
879
- * "mcpServerId": "67f90f1f1b1c9c0b8df0f111",
880
- * "mcpServerReference": "mcp_ABC123",
464
+ * "mcpServerRef": "mcp_ABC123",
881
465
  * "mcpSubdomain": "acme-docs",
882
466
  * "mcpProxyUrl": "https://acme-docs.mcp.solvapay.com/mcp",
883
467
  * "originUrl": "https://origin.example.com/mcp",
884
- * "defaultPlanId": "67f90f1f1b1c9c0b8df0f001"
468
+ * "defaultPlanRef": "pln_FREE123"
885
469
  * }
886
470
  */
887
471
  mcp?: {
@@ -889,175 +473,56 @@ interface components {
889
473
  };
890
474
  };
891
475
  UpdateProductRequest: {
892
- /** @description Product name */
893
476
  name?: string;
894
- /** @description Product description */
895
477
  description?: string;
896
- /** @description URL to the product image */
897
478
  imageUrl?: string;
898
- /** @description Free-form product type defined by the provider */
899
479
  productType?: string;
900
- /**
901
- * Product status
902
- * @enum {string}
903
- */
480
+ /** @enum {string} */
904
481
  status?: "active" | "inactive" | "suspended";
905
- /** @description Product-specific configuration */
906
- config?: components["schemas"]["ProductConfigDto"];
907
- /** @description Arbitrary key-value metadata */
908
- metadata?: {
909
- [key: string]: unknown;
482
+ config: {
483
+ fulfillmentType?: string;
484
+ validityPeriod?: number;
485
+ deliveryMethod?: string;
910
486
  };
911
- };
912
- McpBootstrapFreePlanConfig: {
913
- /**
914
- * Free plan display name override
915
- * @example Starter
916
- */
917
- name?: string;
918
- /**
919
- * Included free units (default 1000)
920
- * @example 500
921
- */
922
- freeUnits?: number;
923
- };
924
- McpBootstrapPaidPlanInput: {
925
- /**
926
- * Logical plan key (must not be "free")
927
- * @example pro
928
- */
929
- key: string;
930
- /**
931
- * Plan display name
932
- * @example Pro
933
- */
934
- name: string;
935
- /**
936
- * Plan price in cents (must be > 0)
937
- * @example 2000
938
- */
939
- price: number;
940
- /**
941
- * Currency code (ISO 4217)
942
- * @example USD
943
- */
944
- currency: string;
945
- /**
946
- * Billing cycle for recurring plans
947
- * @example monthly
948
- * @enum {string}
949
- */
950
- billingCycle?: "weekly" | "monthly" | "quarterly" | "yearly" | "custom";
951
- /**
952
- * Plan type
953
- * @example recurring
954
- * @enum {string}
955
- */
956
- type?: "recurring" | "one-time";
957
- /**
958
- * Included free units
959
- * @example 1000
960
- */
961
- freeUnits?: number;
962
- /**
963
- * Meter id for usage tracking
964
- * @example 67f90f1f1b1c9c0b8df0f001
965
- */
966
- meterId?: string;
967
- /**
968
- * Plan usage limit
969
- * @example 10000
970
- */
971
- limit?: number;
972
- /** @description Plan features */
973
- features?: {
487
+ metadata: {
974
488
  [key: string]: unknown;
975
489
  };
976
490
  };
977
- McpBootstrapToolInput: {
978
- /**
979
- * Tool name
980
- * @example search_docs
981
- */
982
- name: string;
983
- /**
984
- * Tool description
985
- * @example Search indexed documents
986
- */
987
- description?: string;
988
- /**
989
- * If true, tool is publicly available without a plan
990
- * @example false
991
- */
992
- noPlan?: boolean;
993
- /**
994
- * Direct plan IDs allowed for this tool
995
- * @example [
996
- * "67f90f1f1b1c9c0b8df0f001"
997
- * ]
998
- */
999
- planIds?: string[];
1000
- /**
1001
- * Plan references allowed for this tool
1002
- * @example [
1003
- * "pln_ABC123"
1004
- * ]
1005
- */
1006
- planRefs?: string[];
1007
- /**
1008
- * Bootstrap plan keys allowed for this tool (for example free or starter_paid)
1009
- * @example [
1010
- * "free"
1011
- * ]
1012
- */
1013
- planKeys?: string[];
1014
- };
1015
- McpBootstrapRequest: {
1016
- /**
1017
- * Product name (optional when derivable from origin MCP metadata)
1018
- * @example Acme MCP Toolkit
1019
- */
491
+ McpBootstrapDto: {
1020
492
  name?: string;
1021
- /**
1022
- * Product description
1023
- * @example MCP toolkit with tiered access
1024
- */
1025
493
  description?: string;
1026
- /** @description Product image URL */
1027
494
  imageUrl?: string;
1028
- /**
1029
- * Free-form product type
1030
- * @example MCP Server
1031
- */
1032
495
  productType?: string;
1033
- /**
1034
- * Origin MCP server URL (must be https)
1035
- * @example https://origin.example.com/mcp
1036
- */
496
+ /** Format: uri */
1037
497
  originUrl: string;
1038
- /**
1039
- * Optional final MCP subdomain override (for example, value returned by bootstrap-subdomain-checks)
1040
- * @example acme-docs
1041
- */
1042
498
  mcpDomain?: string;
1043
- /**
1044
- * Optional auth header name forwarded to origin server
1045
- * @example X-API-Key
1046
- */
1047
499
  authHeaderName?: string;
1048
- /**
1049
- * Optional auth API key forwarded to origin server
1050
- * @example sk-origin-123
1051
- */
1052
500
  authApiKey?: string;
1053
- /** @description Free plan config overrides. A free plan is always created; this just customizes name/freeUnits. */
1054
- freePlan?: components["schemas"]["McpBootstrapFreePlanConfig"];
1055
- /** @description Paid plan definitions requiring price + currency */
1056
- paidPlans?: components["schemas"]["McpBootstrapPaidPlanInput"][];
1057
- /** @description Tool to plan mapping configuration */
1058
- tools?: components["schemas"]["McpBootstrapToolInput"][];
1059
- /** @description Arbitrary product metadata */
1060
- metadata?: {
501
+ plans?: {
502
+ key: string;
503
+ name: string;
504
+ price: number;
505
+ currency: string;
506
+ /** @enum {string} */
507
+ billingCycle?: "weekly" | "monthly" | "quarterly" | "yearly" | "custom";
508
+ /** @enum {string} */
509
+ type?: "recurring" | "one-time" | "usage-based";
510
+ creditsPerUnit?: number;
511
+ /** @enum {string} */
512
+ billingModel?: "pre-paid" | "post-paid";
513
+ freeUnits?: number;
514
+ limit?: number;
515
+ features?: {
516
+ [key: string]: unknown;
517
+ };
518
+ }[];
519
+ tools?: {
520
+ name: string;
521
+ description?: string;
522
+ noPlan?: boolean;
523
+ planKeys?: string[];
524
+ }[];
525
+ metadata: {
1061
526
  [key: string]: unknown;
1062
527
  };
1063
528
  };
@@ -1067,12 +532,11 @@ interface components {
1067
532
  /**
1068
533
  * Created or updated MCP server identity
1069
534
  * @example {
1070
- * "id": "67f90f1f1b1c9c0b8df0f111",
1071
535
  * "reference": "mcp_ABC123",
1072
536
  * "subdomain": "acme-docs",
1073
537
  * "mcpProxyUrl": "https://acme-docs.mcp.solvapay.com/mcp",
1074
538
  * "url": "https://origin.example.com/mcp",
1075
- * "defaultPlanId": "67f90f1f1b1c9c0b8df0f001"
539
+ * "defaultPlanRef": "pln_FREE123"
1076
540
  * }
1077
541
  */
1078
542
  mcpServer: {
@@ -1082,7 +546,6 @@ interface components {
1082
546
  * Resolved plan mapping by bootstrap key
1083
547
  * @example {
1084
548
  * "free": {
1085
- * "id": "67f90f1f1b1c9c0b8df0f001",
1086
549
  * "reference": "pln_FREE123",
1087
550
  * "name": "Free"
1088
551
  * }
@@ -1102,27 +565,29 @@ interface components {
1102
565
  description?: string;
1103
566
  }[];
1104
567
  };
1105
- McpToolPlanMapping: {
1106
- /**
1107
- * Tool name
1108
- * @example deep_research
1109
- */
1110
- name: string;
1111
- /**
1112
- * Plan keys this tool should be gated to
1113
- * @example [
1114
- * "pro"
1115
- * ]
1116
- */
1117
- planKeys: string[];
1118
- };
1119
- ConfigureMcpPlansRequest: {
1120
- /** @description Required free plan configuration for updates. Applies to the existing default free plan only. */
1121
- freePlan: components["schemas"]["McpBootstrapFreePlanConfig"];
1122
- /** @description Optional paid plan definitions. [] reverts to free-only, omitted leaves existing paid plans unchanged. */
1123
- paidPlans?: components["schemas"]["McpBootstrapPaidPlanInput"][];
1124
- /** @description Optional tool-to-plan remapping. If paidPlans is omitted, only this remapping is applied. */
1125
- toolMapping?: components["schemas"]["McpToolPlanMapping"][];
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
+ creditsPerUnit?: number;
579
+ /** @enum {string} */
580
+ billingModel?: "pre-paid" | "post-paid";
581
+ freeUnits?: number;
582
+ limit?: number;
583
+ features?: {
584
+ [key: string]: unknown;
585
+ };
586
+ }[];
587
+ toolMapping?: {
588
+ name: string;
589
+ planKeys: string[];
590
+ }[];
1126
591
  };
1127
592
  ConfigureMcpPlansResult: {
1128
593
  /** @description Updated product */
@@ -1136,461 +601,123 @@ interface components {
1136
601
  [key: string]: unknown;
1137
602
  };
1138
603
  };
1139
- McpBootstrapPreviewResult: {
1140
- /** @description Discovered tools from the origin MCP server */
1141
- discoveredTools: {
1142
- name?: string;
1143
- description?: string;
1144
- }[];
1145
- /** @description Validation status for the provided bootstrap payload */
1146
- validation: {
1147
- valid?: boolean;
1148
- errors?: components["schemas"]["McpBootstrapPreviewValidationError"][];
1149
- };
604
+ CloneProductDto: {
605
+ name?: string;
606
+ };
607
+ CreateUsageRequest: {
608
+ customerRef: string;
1150
609
  /**
1151
- * Product name derived from origin MCP metadata or hostname fallback
1152
- * @example acme-origin-mcp
610
+ * @default api_call
611
+ * @enum {string}
1153
612
  */
1154
- derivedName?: string;
613
+ actionType: "transaction" | "api_call" | "hour" | "email" | "storage" | "custom";
614
+ /** @default 1 */
615
+ units: number;
1155
616
  /**
1156
- * Product description derived from origin server instructions
1157
- * @example MCP toolkit for document retrieval and summarization.
617
+ * @default success
618
+ * @enum {string}
1158
619
  */
1159
- derivedDescription?: string;
1160
- /** @description Source of derived metadata */
1161
- metadataSource: {
1162
- /** @enum {string} */
1163
- name?: "request" | "origin" | "hostname";
1164
- /** @enum {string} */
1165
- description?: "request" | "instructions" | "none";
620
+ outcome: "success" | "paywall" | "fail";
621
+ productRef?: string;
622
+ purchaseRef?: string;
623
+ description?: string;
624
+ errorMessage?: string;
625
+ metadata: {
626
+ [key: string]: unknown;
1166
627
  };
1167
- /** @description Suggested default tool-to-plan mapping for UI review */
1168
- suggestedMapping: {
1169
- name?: string;
628
+ duration?: number;
629
+ /** Format: date-time */
630
+ timestamp: string;
631
+ idempotencyKey?: string;
632
+ };
633
+ BulkCreateUsageRequest: {
634
+ events: {
635
+ customerRef: string;
636
+ /**
637
+ * @default api_call
638
+ * @enum {string}
639
+ */
640
+ actionType: "transaction" | "api_call" | "hour" | "email" | "storage" | "custom";
641
+ /** @default 1 */
642
+ units: number;
643
+ /**
644
+ * @default success
645
+ * @enum {string}
646
+ */
647
+ outcome: "success" | "paywall" | "fail";
648
+ productRef?: string;
649
+ purchaseRef?: string;
1170
650
  description?: string;
1171
- planKey?: string;
651
+ errorMessage?: string;
652
+ metadata?: {
653
+ [key: string]: unknown;
654
+ };
655
+ duration?: number;
656
+ /** Format: date-time */
657
+ timestamp: string;
658
+ idempotencyKey?: string;
1172
659
  }[];
1173
660
  };
1174
- RecordMeterEventDto: {
1175
- /**
1176
- * Meter name to record against
1177
- * @example requests
1178
- */
661
+ RecordMeterEventZodDto: {
1179
662
  meterName: string;
1180
- /**
1181
- * Customer reference
1182
- * @example cus_ABC123
1183
- */
1184
- customerId: string;
1185
- /**
1186
- * Numeric value (default 1)
1187
- * @default 1
1188
- * @example 1
1189
- */
1190
- value: number;
1191
- /**
1192
- * Arbitrary key-value tags
1193
- * @example {
1194
- * "endpoint": "/api/v1/search",
1195
- * "region": "us-east-1"
1196
- * }
1197
- */
1198
- properties?: {
663
+ customerRef: string;
664
+ value?: number;
665
+ properties: {
1199
666
  [key: string]: unknown;
1200
667
  };
1201
- /** @description Product ID to scope the usage event to */
1202
- productId?: string;
1203
- /** @description Product reference to scope the usage event to */
1204
- productReference?: string;
1205
- /** @description ISO 8601 timestamp (defaults to now) */
668
+ productRef?: string;
1206
669
  timestamp?: string;
1207
670
  };
1208
- RecordBulkMeterEventsDto: {
1209
- /** @description Array of events to record */
1210
- events: components["schemas"]["RecordMeterEventDto"][];
671
+ RecordBulkMeterEventsZodDto: {
672
+ events: {
673
+ meterName: string;
674
+ customerRef: string;
675
+ value?: number;
676
+ properties?: {
677
+ [key: string]: unknown;
678
+ };
679
+ productRef?: string;
680
+ timestamp?: string;
681
+ }[];
1211
682
  };
1212
- CreateCustomerSessionRequest: {
1213
- /**
1214
- * Customer reference identifier
1215
- * @example cus_3c4d5e6f7g8h
1216
- */
1217
- customerRef: string;
683
+ UsageBillingDto: {
1218
684
  /**
1219
- * Optional product reference or ID to scope the customer manage page to a single product.
1220
- * @example prd_1a2b3c4d5e6f
685
+ * Units consumed in current period
686
+ * @example 150
1221
687
  */
1222
- productRef?: string;
1223
- };
1224
- CustomerSessionResponse: {
688
+ used: number;
1225
689
  /**
1226
- * Customer session ID
1227
- * @example 507f1f77bcf86cd799439011
690
+ * Units exceeding the plan limit
691
+ * @example 0
1228
692
  */
1229
- id: string;
693
+ overageUnits: number;
1230
694
  /**
1231
- * Public session ID used in customer URL
1232
- * @example e3f1c2d4b6a89f001122334455667788
695
+ * Overage cost in cents
696
+ * @example 0
1233
697
  */
1234
- sessionId: string;
698
+ overageCost: number;
1235
699
  /**
1236
- * Session status
1237
- * @example active
700
+ * Period start date
701
+ * @example 2025-10-01T00:00:00Z
1238
702
  */
1239
- status: string;
703
+ periodStart?: string;
1240
704
  /**
1241
- * Customer URL to open the customer page
1242
- * @example https://solvapay.com/customer/manage?id=e3f1c2d4b6a89f001122334455667788
705
+ * Period end date
706
+ * @example 2025-11-01T00:00:00Z
1243
707
  */
1244
- customerUrl: string;
708
+ periodEnd?: string;
1245
709
  };
1246
- CreateCustomerRequest: {
710
+ SdkPlanSnapshotDto: {
1247
711
  /**
1248
- * Customer email address (required)
1249
- * @example customer@example.com
712
+ * Plan reference
713
+ * @example pln_1A2B3C4D
1250
714
  */
1251
- email: string;
715
+ reference?: string;
1252
716
  /**
1253
- * Customer full name (optional)
1254
- * @example John Doe
717
+ * Plan price in cents
718
+ * @example 2999
1255
719
  */
1256
- name?: string;
1257
- /**
1258
- * External reference ID from your auth system to map this customer to an auth user (optional)
1259
- * @example auth_user_12345
1260
- */
1261
- externalRef?: string;
1262
- };
1263
- PurchaseInfo: {
1264
- /**
1265
- * Purchase reference
1266
- * @example pur_1A2B3C4D
1267
- */
1268
- reference: string;
1269
- /**
1270
- * Product name
1271
- * @example API Gateway Manager
1272
- */
1273
- productName: string;
1274
- /**
1275
- * Product reference
1276
- * @example prd_abc123
1277
- */
1278
- productReference?: string;
1279
- /**
1280
- * Purchase status
1281
- * @example active
1282
- */
1283
- status: string;
1284
- /**
1285
- * Start date
1286
- * @example 2025-10-27T10:00:00Z
1287
- */
1288
- startDate: string;
1289
- /**
1290
- * Amount paid in original currency (in cents)
1291
- * @example 9900
1292
- */
1293
- amount: number;
1294
- /**
1295
- * Currency code
1296
- * @example USD
1297
- */
1298
- currency: string;
1299
- /**
1300
- * End date of purchase
1301
- * @example 2025-11-27T10:00:00Z
1302
- */
1303
- endDate?: string;
1304
- /**
1305
- * When purchase was cancelled
1306
- * @example 2025-10-28T10:00:00Z
1307
- */
1308
- cancelledAt?: string;
1309
- /**
1310
- * Reason for cancellation
1311
- * @example Customer request
1312
- */
1313
- cancellationReason?: string;
1314
- /** @description Snapshot of the plan at time of purchase */
1315
- planSnapshot?: Record<string, never>;
1316
- };
1317
- CustomerResponse: {
1318
- /**
1319
- * Customer reference identifier
1320
- * @example cus_3c4d5e6f7g8h
1321
- */
1322
- reference: string;
1323
- /**
1324
- * Customer full name
1325
- * @example John Doe
1326
- */
1327
- name: string;
1328
- /**
1329
- * Customer email address
1330
- * @example customer@example.com
1331
- */
1332
- email: string;
1333
- /**
1334
- * External reference ID from your auth system (if set during creation or update)
1335
- * @example auth_user_12345
1336
- */
1337
- externalRef?: string;
1338
- /** @description Active purchases */
1339
- purchases?: components["schemas"]["PurchaseInfo"][];
1340
- };
1341
- CreateCustomerSessionResponse: {
1342
- /**
1343
- * Customer session ID/token
1344
- * @example e3f1c2d4b6a89f001122334455667788
1345
- */
1346
- sessionId: string;
1347
- /**
1348
- * Full customer URL based on backend configuration (ready to redirect customer)
1349
- * @example https://solvapay.com/customer/manage?id=e3f1c2d4b6a89f001122334455667788
1350
- */
1351
- customerUrl: string;
1352
- };
1353
- GetCustomerSessionResponse: {
1354
- /**
1355
- * Customer session ID/token
1356
- * @example e3f1c2d4b6a89f001122334455667788
1357
- */
1358
- sessionId: string;
1359
- /**
1360
- * Session status
1361
- * @example active
1362
- * @enum {string}
1363
- */
1364
- status: "active" | "expired" | "used";
1365
- /**
1366
- * Full customer URL based on backend configuration (ready to redirect customer)
1367
- * @example https://solvapay.com/customer/manage?id=e3f1c2d4b6a89f001122334455667788
1368
- */
1369
- customerUrl: string;
1370
- /**
1371
- * Session expiration date
1372
- * @example 2025-01-01T12:00:00.000Z
1373
- */
1374
- expiresAt: string;
1375
- /** @description Customer object from session data */
1376
- customer: components["schemas"]["CustomerResponse"];
1377
- /**
1378
- * Session creation date
1379
- * @example 2025-01-01T11:45:00.000Z
1380
- */
1381
- createdAt: string;
1382
- /**
1383
- * Session last update date
1384
- * @example 2025-01-01T11:45:00.000Z
1385
- */
1386
- updatedAt: string;
1387
- };
1388
- UserInfoRequest: {
1389
- /**
1390
- * Customer reference
1391
- * @example cus_3C4D5E6F
1392
- */
1393
- customerRef: string;
1394
- /**
1395
- * Product reference
1396
- * @example prd_1A2B3C4D
1397
- */
1398
- productRef: string;
1399
- };
1400
- UserInfoUserDto: {
1401
- /** @example cus_3C4D5E6F */
1402
- reference: string;
1403
- /** @example John Doe */
1404
- name?: string | null;
1405
- /** @example john@example.com */
1406
- email: string;
1407
- /** @example auth_user_12345 */
1408
- externalRef?: string | null;
1409
- };
1410
- UserInfoUsageDto: {
1411
- /** @example 1000 */
1412
- total: number;
1413
- /** @example 250 */
1414
- used: number;
1415
- /** @example 750 */
1416
- remaining: number;
1417
- /**
1418
- * Meter ObjectId reference
1419
- * @example 507f1f77bcf86cd799439011
1420
- */
1421
- meterId?: string;
1422
- /** @example 25 */
1423
- percentUsed?: number | null;
1424
- };
1425
- UserInfoPlanDto: {
1426
- /** @example pln_2B3C4D5E */
1427
- reference: string;
1428
- /**
1429
- * Price in minor currency units (e.g. cents)
1430
- * @example 2999
1431
- */
1432
- price: number;
1433
- /** @example USD */
1434
- currency: string;
1435
- /** @example recurring */
1436
- type: string;
1437
- /** @example monthly */
1438
- billingCycle?: string | null;
1439
- features?: string[] | null;
1440
- limits?: {
1441
- [key: string]: unknown;
1442
- } | null;
1443
- };
1444
- UserInfoPurchaseDto: {
1445
- /** @example pur_1A2B3C4D */
1446
- reference: string;
1447
- /** @example active */
1448
- status: string;
1449
- /** @example My API Product */
1450
- productName: string;
1451
- /** @example recurring */
1452
- planType: string;
1453
- /** @example 2025-10-27T10:00:00Z */
1454
- startDate?: string | null;
1455
- /** @example 2025-11-27T10:00:00Z */
1456
- endDate?: string | null;
1457
- usage?: components["schemas"]["UserInfoUsageDto"];
1458
- plan?: components["schemas"]["UserInfoPlanDto"];
1459
- };
1460
- UserInfoResponse: {
1461
- /**
1462
- * Human-readable status summary
1463
- * @example Active subscription: My API Product (25% usage consumed)
1464
- */
1465
- status: string;
1466
- /**
1467
- * Customer portal session URL
1468
- * @example https://solvapay.com/customer/manage?id=abc123
1469
- */
1470
- verifyUrl?: string | null;
1471
- user?: components["schemas"]["UserInfoUserDto"];
1472
- purchase?: components["schemas"]["UserInfoPurchaseDto"];
1473
- };
1474
- McpToolDto: {
1475
- /**
1476
- * Tool name
1477
- * @example search_documents
1478
- */
1479
- name: string;
1480
- /**
1481
- * Plan IDs that grant access to this tool
1482
- * @example [
1483
- * "pln_abc123"
1484
- * ]
1485
- */
1486
- planIds?: string[];
1487
- /**
1488
- * If true, the tool is unprotected (no purchase check or usage tracking)
1489
- * @example false
1490
- */
1491
- noPlan?: boolean;
1492
- /**
1493
- * Human-readable tool description
1494
- * @example Search indexed documents
1495
- */
1496
- description?: string;
1497
- /**
1498
- * Whether this is a virtual platform tool handled by SolvaPay
1499
- * @example false
1500
- */
1501
- isVirtual?: boolean;
1502
- };
1503
- McpServerDto: {
1504
- /**
1505
- * Server ID
1506
- * @example 507f1f77bcf86cd799439011
1507
- */
1508
- id?: string;
1509
- /**
1510
- * Unique server reference
1511
- * @example mcp_abc123
1512
- */
1513
- reference?: string;
1514
- /**
1515
- * Domain slug used to derive the MCP endpoint subdomain
1516
- * @example my-mcp-server
1517
- */
1518
- name: string;
1519
- /**
1520
- * URL-safe subdomain derived from name
1521
- * @example my-mcp-server
1522
- */
1523
- subdomain: string;
1524
- /**
1525
- * SolvaPay proxy URL that MCP clients connect to
1526
- * @example https://mytelescope.mcp.solvapay.com/mcp
1527
- */
1528
- mcpProxyUrl?: string;
1529
- /**
1530
- * Origin URL of the actual MCP server
1531
- * @example https://origin.example.com/mcp
1532
- */
1533
- url: string;
1534
- /**
1535
- * Avatar image URL
1536
- * @example https://example.com/avatar.png
1537
- */
1538
- avatarUrl?: string;
1539
- /** @description Registered tools for this server */
1540
- tools?: components["schemas"]["McpToolDto"][];
1541
- /**
1542
- * Default plan ID for tool access gating. Must belong to the linked product and be a free-tier plan (isFreeTier=true or price=0).
1543
- * @example pln_default
1544
- */
1545
- defaultPlanId?: string;
1546
- /**
1547
- * Associated product ID
1548
- * @example 507f1f77bcf86cd799439011
1549
- */
1550
- productId?: string;
1551
- /**
1552
- * Server status
1553
- * @example active
1554
- * @enum {string}
1555
- */
1556
- status?: "active" | "inactive" | "suspended";
1557
- /**
1558
- * Provider ID that owns this server
1559
- * @example 507f1f77bcf86cd799439011
1560
- */
1561
- providerId: string;
1562
- /**
1563
- * Custom auth header name for origin requests
1564
- * @example X-API-Key
1565
- */
1566
- authHeaderName?: string;
1567
- /**
1568
- * Whether an auth API key is configured
1569
- * @example true
1570
- */
1571
- hasAuthApiKey?: boolean;
1572
- /**
1573
- * Total number of tool-call transactions
1574
- * @example 42
1575
- */
1576
- totalTransactions?: number;
1577
- /**
1578
- * Current balance in cents
1579
- * @example 1500
1580
- */
1581
- balance?: number;
1582
- };
1583
- PlanSnapshotDto: {
1584
- /**
1585
- * Plan reference
1586
- * @example pln_1A2B3C4D
1587
- */
1588
- reference?: string;
1589
- /**
1590
- * Plan price in cents
1591
- * @example 2999
1592
- */
1593
- price: number;
720
+ price: number;
1594
721
  /**
1595
722
  * Currency code
1596
723
  * @example USD
@@ -1615,59 +742,27 @@ interface components {
1615
742
  [key: string]: unknown;
1616
743
  } | null;
1617
744
  /**
1618
- * Meter ObjectId reference
1619
- * @example 507f1f77bcf86cd799439011
745
+ * Meter reference
746
+ * @example mtr_1A2B3C4D
1620
747
  */
1621
- meterId?: string;
748
+ meterRef?: string;
1622
749
  /**
1623
750
  * Usage limit for the meter
1624
751
  * @example 5000
1625
752
  */
1626
- limit?: number;
1627
- /**
1628
- * Number of free units included
1629
- * @example 100
1630
- */
1631
- freeUnits?: number;
1632
- /**
1633
- * Price per usage unit in cents
1634
- * @example 10
1635
- */
1636
- pricePerUnit?: number;
1637
- };
1638
- UsageBillingDto: {
1639
- /**
1640
- * Units consumed in current period
1641
- * @example 150
1642
- */
1643
- used: number;
1644
- /**
1645
- * Units exceeding the plan limit
1646
- * @example 0
1647
- */
1648
- overageUnits: number;
1649
- /**
1650
- * Overage cost in cents
1651
- * @example 0
1652
- */
1653
- overageCost: number;
1654
- /**
1655
- * Period start date
1656
- * @example 2025-10-01T00:00:00Z
1657
- */
1658
- periodStart?: string;
753
+ limit?: number;
1659
754
  /**
1660
- * Period end date
1661
- * @example 2025-11-01T00:00:00Z
755
+ * Number of free units included
756
+ * @example 100
1662
757
  */
1663
- periodEnd?: string;
1664
- };
1665
- PurchaseResponse: {
758
+ freeUnits?: number;
1666
759
  /**
1667
- * Purchase ID
1668
- * @example 507f1f77bcf86cd799439011
760
+ * Credits per usage unit (integer, >= 1)
761
+ * @example 1
1669
762
  */
1670
- id: string;
763
+ creditsPerUnit?: number;
764
+ };
765
+ SdkPurchaseResponse: {
1671
766
  /**
1672
767
  * Purchase reference
1673
768
  * @example pur_1A2B3C4D
@@ -1688,33 +783,38 @@ interface components {
1688
783
  * @example prd_1A2B3C4D
1689
784
  */
1690
785
  productRef: string;
1691
- /**
1692
- * Product ID
1693
- * @example 507f1f77bcf86cd799439012
1694
- */
1695
- productId?: string;
1696
786
  /**
1697
787
  * Product name
1698
788
  * @example API Gateway Manager
1699
789
  */
1700
790
  productName?: string;
1701
- /** @description Plan snapshot at time of purchase */
1702
- planSnapshot: components["schemas"]["PlanSnapshotDto"];
791
+ /** @description Plan snapshot at time of purchase (null for credit topups) */
792
+ planSnapshot?: components["schemas"]["SdkPlanSnapshotDto"];
1703
793
  /**
1704
794
  * Purchase status
1705
795
  * @example active
1706
796
  */
1707
797
  status: string;
1708
798
  /**
1709
- * Amount in cents
799
+ * Amount in USD cents (normalised for aggregation)
1710
800
  * @example 9900
1711
801
  */
1712
802
  amount: number;
1713
803
  /**
1714
- * Currency code
1715
- * @example USD
804
+ * Original amount in the payment currency (cents/pence)
805
+ * @example 10000
806
+ */
807
+ originalAmount?: number;
808
+ /**
809
+ * Original payment currency code
810
+ * @example GBP
1716
811
  */
1717
812
  currency: string;
813
+ /**
814
+ * Exchange rate from original currency to USD
815
+ * @example 1.3082
816
+ */
817
+ exchangeRate?: number;
1718
818
  /** @description Start date */
1719
819
  startDate: string;
1720
820
  /** @description End date */
@@ -1737,46 +837,50 @@ interface components {
1737
837
  nextBillingDate?: string;
1738
838
  /** @description Auto-renew enabled */
1739
839
  autoRenew?: boolean;
1740
- /** @description Whether this is a free tier purchase */
1741
- isFreeTier?: boolean;
1742
840
  /** @description Cancelled at */
1743
841
  cancelledAt?: string;
1744
842
  /** @description Cancellation reason */
1745
843
  cancellationReason?: string;
844
+ /** @description Arbitrary metadata attached to the purchase */
845
+ metadata?: {
846
+ [key: string]: unknown;
847
+ };
1746
848
  /** @description Created at */
1747
849
  createdAt: string;
1748
850
  };
1749
- CancelPurchaseRequest: {
1750
- /** @description Reason for cancellation */
1751
- reason?: string;
1752
- };
1753
851
  CheckLimitRequest: {
1754
- /**
1755
- * Customer reference identifier
1756
- * @example cus_3C4D5E6F
1757
- */
1758
852
  customerRef: string;
1759
- /**
1760
- * Product reference identifier
1761
- * @example prd_1A2B3C4D
1762
- */
1763
853
  productRef: string;
1764
- /**
1765
- * 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.
1766
- * @example pln_2B3C4D5E
1767
- */
1768
- planRef?: string;
1769
- /**
1770
- * Canonical usage meter name used for limit checks (for example: requests, tokens).
1771
- * @example requests
1772
- */
1773
854
  meterName?: string;
1774
- /**
1775
- * Usage type alias for meterName. If both are provided, meterName takes precedence.
1776
- * @example requests
1777
- */
1778
855
  usageType?: string;
1779
856
  };
857
+ LimitPlanItemDto: {
858
+ reference: string;
859
+ name?: string;
860
+ type: string;
861
+ /** @description Price in smallest currency unit (e.g. cents) */
862
+ price: number;
863
+ currency: string;
864
+ requiresPayment: boolean;
865
+ freeUnits?: number;
866
+ /** @description Credits per usage unit (usage-based plans) */
867
+ creditsPerUnit?: number;
868
+ billingModel?: string;
869
+ billingCycle?: string;
870
+ };
871
+ LimitBalanceDto: {
872
+ /** @description Credit balance in mils */
873
+ creditBalance: number;
874
+ /** @description Credits per usage unit */
875
+ creditsPerUnit: number;
876
+ currency: string;
877
+ /** @description Estimated whole units remaining from prepaid credit balance */
878
+ remainingUnits?: number;
879
+ };
880
+ LimitProductBriefDto: {
881
+ reference: string;
882
+ name?: string;
883
+ };
1780
884
  LimitResponse: {
1781
885
  /**
1782
886
  * Whether the customer is within their usage limits
@@ -1803,213 +907,270 @@ interface components {
1803
907
  * @example requests
1804
908
  */
1805
909
  meterName?: string;
910
+ /** @description Credit balance in mils (for pre-paid usage-based plans) */
911
+ creditBalance?: number;
912
+ /** @description Credits per usage unit (for pre-paid usage-based plans) */
913
+ creditsPerUnit?: number;
914
+ /** @description ISO 4217 currency code for credit fields */
915
+ currency?: string;
916
+ /** @description True when the customer must activate a priced default plan before usage is allowed */
917
+ activationRequired?: boolean;
918
+ /** @description Active plans on the product available for activation or checkout */
919
+ plans?: components["schemas"]["LimitPlanItemDto"][];
920
+ /** @description Prepaid usage balance context when the default plan is usage-based */
921
+ balance?: components["schemas"]["LimitBalanceDto"];
922
+ /** @description Product the limit check applies to */
923
+ product?: components["schemas"]["LimitProductBriefDto"];
924
+ /** @description Customer portal confirmation URL when activation is required (fallback when not starting checkout) */
925
+ confirmationUrl?: string;
926
+ };
927
+ ActivatePlanDto: {
928
+ customerRef: string;
929
+ productRef: string;
930
+ planRef: string;
931
+ };
932
+ ActivatePlanResponseDto: {
933
+ /** @enum {string} */
934
+ status: "activated" | "already_active" | "topup_required" | "payment_required" | "invalid";
935
+ purchaseRef?: string;
936
+ message?: string;
937
+ creditBalance?: number;
938
+ creditsPerUnit?: number;
939
+ currency?: string;
940
+ checkoutUrl?: string;
941
+ checkoutSessionId?: string;
942
+ };
943
+ CreateCustomerRequest: {
944
+ /** Format: email */
945
+ email: string;
946
+ name?: string;
947
+ telephone?: string;
948
+ metadata: {
949
+ [key: string]: unknown;
950
+ };
951
+ externalRef?: string;
952
+ };
953
+ CreateCustomerSessionRequest: {
954
+ customerRef: string;
955
+ productRef?: string;
1806
956
  };
1807
- ExecuteAnalyticsQuery: Record<string, never>;
1808
- ExecuteMultipleQueries: Record<string, never>;
1809
- CreateWebhookEndpointDto: {
957
+ PurchaseInfo: {
1810
958
  /**
1811
- * Webhook endpoint URL
1812
- * @example https://example.com/webhook
959
+ * Purchase reference
960
+ * @example pur_1A2B3C4D
1813
961
  */
1814
- url: string;
962
+ reference: string;
1815
963
  /**
1816
- * Webhook endpoint description
1817
- * @example Production webhook
964
+ * Product name
965
+ * @example API Gateway Manager
1818
966
  */
1819
- description?: string;
1820
- };
1821
- UpdateWebhookEndpointDto: {
967
+ productName: string;
1822
968
  /**
1823
- * Webhook endpoint URL
1824
- * @example https://example.com/webhook
969
+ * Product reference
970
+ * @example prd_abc123
1825
971
  */
1826
- url?: string;
972
+ productRef?: string;
1827
973
  /**
1828
- * Webhook endpoint description
1829
- * @example Updated webhook
974
+ * Purchase status
975
+ * @example active
1830
976
  */
1831
- description?: string;
1832
- };
1833
- UpdateThemePreferenceDto: {
977
+ status: string;
1834
978
  /**
1835
- * Selected UI theme mode
1836
- * @example dark
1837
- * @enum {string}
979
+ * Start date
980
+ * @example 2025-10-27T10:00:00Z
981
+ */
982
+ startDate: string;
983
+ /**
984
+ * Amount in USD cents (normalised for aggregation)
985
+ * @example 9900
986
+ */
987
+ amount: number;
988
+ /**
989
+ * Original amount in the payment currency (minor units)
990
+ * @example 7500
991
+ */
992
+ originalAmount?: number;
993
+ /**
994
+ * ISO 4217 currency code of the customer-facing charge
995
+ * @example GBP
996
+ */
997
+ currency: string;
998
+ /**
999
+ * Exchange rate from original currency to USD
1000
+ * @example 1.32
1001
+ */
1002
+ exchangeRate?: number;
1003
+ /**
1004
+ * End date of purchase
1005
+ * @example 2025-11-27T10:00:00Z
1006
+ */
1007
+ endDate?: string;
1008
+ /**
1009
+ * When purchase was cancelled
1010
+ * @example 2025-10-28T10:00:00Z
1011
+ */
1012
+ cancelledAt?: string;
1013
+ /**
1014
+ * Reason for cancellation
1015
+ * @example Customer request
1016
+ */
1017
+ cancellationReason?: string;
1018
+ /**
1019
+ * Plan reference from the plan snapshot, for reliable plan matching
1020
+ * @example pln_abc123
1838
1021
  */
1839
- mode: "light" | "dark";
1022
+ planRef?: string;
1023
+ /** @description Snapshot of the plan at time of purchase */
1024
+ planSnapshot?: Record<string, never>;
1840
1025
  };
1841
- ThemeModeColorsDto: {
1026
+ CustomerResponse: {
1842
1027
  /**
1843
- * Page background color
1844
- * @example #f7f7f8
1028
+ * Customer reference identifier
1029
+ * @example cus_3c4d5e6f7g8h
1845
1030
  */
1846
- background?: string;
1031
+ reference: string;
1847
1032
  /**
1848
- * Card/surface background color
1849
- * @example #ffffff
1033
+ * Customer full name
1034
+ * @example John Doe
1850
1035
  */
1851
- surface?: string;
1036
+ name: string;
1852
1037
  /**
1853
- * Primary text color
1854
- * @example #181818
1038
+ * Customer email address
1039
+ * @example customer@example.com
1855
1040
  */
1856
- text?: string;
1041
+ email: string;
1857
1042
  /**
1858
- * Secondary/muted text color
1859
- * @example #5c5c5c
1043
+ * External reference ID from your auth system (if set during creation or update)
1044
+ * @example auth_user_12345
1860
1045
  */
1861
- secondary?: string;
1046
+ externalRef?: string;
1047
+ /** @description Active purchases */
1048
+ purchases?: components["schemas"]["PurchaseInfo"][];
1862
1049
  };
1863
- ThemeOverridesDto: {
1864
- /** @description Light mode color overrides */
1865
- light?: components["schemas"]["ThemeModeColorsDto"];
1866
- /** @description Dark mode color overrides */
1867
- dark?: components["schemas"]["ThemeModeColorsDto"];
1050
+ CreateCustomerSessionResponse: {
1051
+ /**
1052
+ * Customer session ID/token
1053
+ * @example e3f1c2d4b6a89f001122334455667788
1054
+ */
1055
+ sessionId: string;
1056
+ /**
1057
+ * Full customer URL based on backend configuration (ready to redirect customer)
1058
+ * @example https://solvapay.com/customer/manage?id=e3f1c2d4b6a89f001122334455667788
1059
+ */
1060
+ customerUrl: string;
1868
1061
  };
1869
- UpdateBrandThemeDto: {
1062
+ GetCustomerSessionResponse: {
1063
+ /**
1064
+ * Customer session ID/token
1065
+ * @example e3f1c2d4b6a89f001122334455667788
1066
+ */
1067
+ sessionId: string;
1870
1068
  /**
1871
- * Logo image URL displayed in hosted page headers
1872
- * @example /ui/files/download/provider-assets/provider-123/logos/logo.png
1069
+ * Session status
1070
+ * @example active
1071
+ * @enum {string}
1873
1072
  */
1874
- logo?: string;
1073
+ status: "active" | "expired" | "used";
1875
1074
  /**
1876
- * Provider's brand name displayed on hosted pages
1877
- * @example Acme Corp
1075
+ * Full customer URL based on backend configuration (ready to redirect customer)
1076
+ * @example https://solvapay.com/customer/manage?id=e3f1c2d4b6a89f001122334455667788
1878
1077
  */
1879
- brandName: string;
1078
+ customerUrl: string;
1880
1079
  /**
1881
- * Primary/accent color in hex format
1882
- * @example #3182ce
1080
+ * Session expiration date
1081
+ * @example 2025-01-01T12:00:00.000Z
1883
1082
  */
1884
- primaryColor: string;
1083
+ expiresAt: string;
1084
+ /** @description Customer object from session data */
1085
+ customer: components["schemas"]["CustomerResponse"];
1885
1086
  /**
1886
- * Font family for hosted pages
1887
- * @default Inter
1888
- * @example Inter
1087
+ * Session creation date
1088
+ * @example 2025-01-01T11:45:00.000Z
1889
1089
  */
1890
- fontFamily: string;
1090
+ createdAt: string;
1891
1091
  /**
1892
- * Base font size
1893
- * @default 16px
1894
- * @example 16px
1092
+ * Session last update date
1093
+ * @example 2025-01-01T11:45:00.000Z
1895
1094
  */
1896
- fontSize: string;
1897
- /** @description Per-mode color overrides for light and dark themes */
1898
- themes?: components["schemas"]["ThemeOverridesDto"];
1095
+ updatedAt: string;
1096
+ };
1097
+ UserInfoRequest: {
1098
+ customerRef: string;
1099
+ productRef: string;
1899
1100
  };
1900
- CreatePreregistrationDto: {
1901
- /** @example jane@company.com */
1101
+ UserInfoUserDto: {
1102
+ /** @example cus_3C4D5E6F */
1103
+ reference: string;
1104
+ /** @example John Doe */
1105
+ name?: string | null;
1106
+ /** @example john@example.com */
1902
1107
  email: string;
1903
- /** @example Jane Smith */
1904
- fullName: string;
1905
- /** @example Acme Corp */
1906
- companyName: string;
1907
- /** @example SaaS */
1908
- businessType?: string;
1909
- /** @example Purchase billing for our platform */
1910
- useCase?: string;
1911
- customFields?: {
1912
- [key: string]: string;
1913
- };
1914
- };
1915
- RevenueDataDto: {
1916
- grossRevenue: number;
1917
- refunds: number;
1918
- platformFees: number;
1919
- netRevenue: number;
1920
- costOfRevenue: number;
1921
- grossProfit?: Record<string, never> | null;
1922
- grossMargin?: Record<string, never> | null;
1923
- recognisedRevenue: number;
1924
- deferredRevenue: number;
1925
- hasCostTransactions: boolean;
1926
- };
1927
- BalanceDataDto: {
1928
- openingBalance: number;
1929
- paymentsReceived: number;
1930
- refundsIssued: number;
1931
- platformFees: number;
1932
- costsPaid: number;
1933
- closingBalance: number;
1934
- netChange: number;
1935
- };
1936
- MonthlyFinancialsDto: {
1937
- month: string;
1938
- revenue: components["schemas"]["RevenueDataDto"];
1939
- balance: components["schemas"]["BalanceDataDto"];
1940
- };
1941
- RevenueResponseDto: {
1942
- current: components["schemas"]["RevenueDataDto"];
1943
- prior: components["schemas"]["RevenueDataDto"];
1944
- monthly: components["schemas"]["MonthlyFinancialsDto"][];
1945
- periodLabel: string;
1108
+ /** @example auth_user_12345 */
1109
+ externalRef?: string | null;
1110
+ };
1111
+ UserInfoUsageDto: {
1112
+ /** @example 1000 */
1113
+ total: number;
1114
+ /** @example 250 */
1115
+ used: number;
1116
+ /** @example 750 */
1117
+ remaining: number;
1946
1118
  /**
1947
- * ISO 4217 currency code
1948
- * @example SEK
1119
+ * Meter reference
1120
+ * @example meter_ABC123
1949
1121
  */
1950
- currency: string;
1122
+ meterRef?: string | null;
1123
+ /** @example 25 */
1124
+ percentUsed?: number | null;
1951
1125
  };
1952
- BalanceResponseDto: {
1953
- current: components["schemas"]["BalanceDataDto"];
1954
- monthly: components["schemas"]["MonthlyFinancialsDto"][];
1955
- periodLabel: string;
1126
+ UserInfoPlanDto: {
1127
+ /** @example pln_2B3C4D5E */
1128
+ reference: string;
1956
1129
  /**
1957
- * ISO 4217 currency code
1958
- * @example SEK
1130
+ * Price in minor currency units (e.g. cents)
1131
+ * @example 2999
1959
1132
  */
1133
+ price: number;
1134
+ /** @example USD */
1960
1135
  currency: string;
1136
+ /** @example recurring */
1137
+ type: string;
1138
+ /** @example monthly */
1139
+ billingCycle?: string | null;
1140
+ features?: string[] | null;
1141
+ limits?: {
1142
+ [key: string]: unknown;
1143
+ } | null;
1961
1144
  };
1962
- ProductRevenueRowDto: {
1963
- productRef: string;
1145
+ UserInfoPurchaseDto: {
1146
+ /** @example pur_1A2B3C4D */
1147
+ reference: string;
1148
+ /** @example active */
1149
+ status: string;
1150
+ /** @example My API Product */
1964
1151
  productName: string;
1965
- productType: string;
1966
- revenue: number;
1967
- costs: number;
1968
- grossProfit?: Record<string, never> | null;
1969
- share: number;
1970
- estimatedARR: number;
1971
- transactionCount: number;
1972
- };
1973
- TopProductDto: {
1974
- name: string;
1975
- revenue: number;
1152
+ /** @example recurring */
1153
+ planType: string;
1154
+ /** @example 2025-10-27T10:00:00Z */
1155
+ startDate?: string | null;
1156
+ /** @example 2025-11-27T10:00:00Z */
1157
+ endDate?: string | null;
1158
+ usage?: components["schemas"]["UserInfoUsageDto"];
1159
+ plan?: components["schemas"]["UserInfoPlanDto"];
1976
1160
  };
1977
- RevenueByProductResponseDto: {
1978
- products: components["schemas"]["ProductRevenueRowDto"][];
1979
- activeProductCount: number;
1980
- totalMRR: number;
1981
- topProduct?: components["schemas"]["TopProductDto"] | null;
1161
+ UserInfoResponse: {
1982
1162
  /**
1983
- * ISO 4217 currency code
1984
- * @example SEK
1163
+ * Human-readable status summary
1164
+ * @example Active subscription: My API Product (25% usage consumed)
1985
1165
  */
1986
- currency: string;
1987
- };
1988
- LedgerEntryDto: {
1989
- date: string;
1990
- reference: string;
1991
- description: string;
1992
- type: string;
1993
- direction: string;
1994
- account: string;
1995
- debit: number;
1996
- credit: number;
1997
1166
  status: string;
1998
- };
1999
- LedgerResponseDto: {
2000
- entries: components["schemas"]["LedgerEntryDto"][];
2001
- total: number;
2002
- totalCredit: number;
2003
- totalDebit: number;
2004
1167
  /**
2005
- * ISO 4217 currency code
2006
- * @example SEK
1168
+ * Customer portal session URL
1169
+ * @example https://solvapay.com/customer/manage?id=abc123
2007
1170
  */
2008
- currency: string;
2009
- };
2010
- /** @description Auto-generated fallback schema for unresolved reference: McpBootstrapPreviewValidationError */
2011
- McpBootstrapPreviewValidationError: {
2012
- [key: string]: unknown;
1171
+ verifyUrl?: string | null;
1172
+ user?: components["schemas"]["UserInfoUserDto"];
1173
+ purchase?: components["schemas"]["UserInfoPurchaseDto"];
2013
1174
  };
2014
1175
  };
2015
1176
  responses: never;
@@ -2057,28 +1218,7 @@ interface operations {
2057
1218
  /** @description Payment intent creation data */
2058
1219
  requestBody: {
2059
1220
  content: {
2060
- "application/json": {
2061
- /**
2062
- * Plan reference to purchase
2063
- * @example pln_2b3c4d5e6f7g
2064
- */
2065
- planRef: string;
2066
- /**
2067
- * Product reference that owns the plan
2068
- * @example prd_1A2B3C4D
2069
- */
2070
- productRef: string;
2071
- /**
2072
- * Customer reference identifier
2073
- * @example cus_3c4d5e6f7g8h
2074
- */
2075
- customerReference: string;
2076
- /**
2077
- * Name of the pricing tier to purchase (for plans with pricingTiers). If not specified, uses the plan base price.
2078
- * @example Pro
2079
- */
2080
- pricingTier?: string;
2081
- };
1221
+ "application/json": components["schemas"]["CreatePaymentIntentDto"];
2082
1222
  };
2083
1223
  };
2084
1224
  responses: {
@@ -2107,8 +1247,8 @@ interface operations {
2107
1247
  query?: never;
2108
1248
  header?: never;
2109
1249
  path: {
2110
- /** @description Payment intent MongoDB ID */
2111
- id: string;
1250
+ /** @description Payment intent reference or processor payment ID */
1251
+ reference: string;
2112
1252
  };
2113
1253
  cookie?: never;
2114
1254
  };
@@ -2139,31 +1279,15 @@ interface operations {
2139
1279
  query?: never;
2140
1280
  header?: never;
2141
1281
  path: {
2142
- /** @description Stripe payment intent ID (format: pi_xxx) */
2143
- id: string;
1282
+ /** @description Payment processor ID returned from createPaymentIntent */
1283
+ processorPaymentId: string;
2144
1284
  };
2145
1285
  cookie?: never;
2146
1286
  };
2147
1287
  /** @description Payment processing data */
2148
1288
  requestBody: {
2149
1289
  content: {
2150
- "application/json": {
2151
- /**
2152
- * Product reference that owns the plan
2153
- * @example prd_123
2154
- */
2155
- productRef: string;
2156
- /**
2157
- * Customer reference identifier
2158
- * @example cus_456
2159
- */
2160
- customerRef: string;
2161
- /**
2162
- * Plan reference - helps determine if payment is for purchase
2163
- * @example pln_789
2164
- */
2165
- planRef?: string;
2166
- };
1290
+ "application/json": components["schemas"]["ProcessPaymentIntentDto"];
2167
1291
  };
2168
1292
  };
2169
1293
  responses: {
@@ -2182,7 +1306,7 @@ interface operations {
2182
1306
  status?: "succeeded" | "timeout" | "failed" | "cancelled";
2183
1307
  /**
2184
1308
  * Optional message, only present for timeout status
2185
- * @example Timeout while waiting for payment intent confirmation, try again later. This could be due to Stripe webhooks not being configured correctly.
1309
+ * @example Timeout while waiting for payment intent confirmation, try again later. This could be due to payment webhooks not being configured correctly.
2186
1310
  */
2187
1311
  message?: string;
2188
1312
  };
@@ -2562,7 +1686,7 @@ interface operations {
2562
1686
  };
2563
1687
  requestBody: {
2564
1688
  content: {
2565
- "application/json": components["schemas"]["McpBootstrapRequest"];
1689
+ "application/json": components["schemas"]["McpBootstrapDto"];
2566
1690
  };
2567
1691
  };
2568
1692
  responses: {
@@ -2596,7 +1720,7 @@ interface operations {
2596
1720
  };
2597
1721
  requestBody: {
2598
1722
  content: {
2599
- "application/json": components["schemas"]["ConfigureMcpPlansRequest"];
1723
+ "application/json": components["schemas"]["ConfigureMcpPlansDto"];
2600
1724
  };
2601
1725
  };
2602
1726
  responses: {
@@ -2635,7 +1759,11 @@ interface operations {
2635
1759
  };
2636
1760
  cookie?: never;
2637
1761
  };
2638
- requestBody?: never;
1762
+ requestBody: {
1763
+ content: {
1764
+ "application/json": components["schemas"]["CloneProductDto"];
1765
+ };
1766
+ };
2639
1767
  responses: {
2640
1768
  /** @description Product cloned successfully */
2641
1769
  201: {
@@ -2664,44 +1792,7 @@ interface operations {
2664
1792
  };
2665
1793
  requestBody: {
2666
1794
  content: {
2667
- "application/json": {
2668
- /**
2669
- * Customer identifier
2670
- * @example cus_3C4D5E6F
2671
- */
2672
- customerId: string;
2673
- /**
2674
- * Action type (default: api_call)
2675
- * @example api_call
2676
- * @enum {string}
2677
- */
2678
- actionType?: "transaction" | "api_call" | "hour" | "email" | "storage" | "custom";
2679
- /**
2680
- * Number of usage units (default: 1)
2681
- * @example 1
2682
- */
2683
- units?: number;
2684
- /** @description Product reference */
2685
- productReference?: string;
2686
- /** @description Purchase reference */
2687
- purchaseReference?: string;
2688
- /**
2689
- * Outcome (default: success)
2690
- * @enum {string}
2691
- */
2692
- outcome?: "success" | "paywall" | "fail";
2693
- /** @description Arbitrary event properties */
2694
- metadata?: {
2695
- [key: string]: unknown;
2696
- };
2697
- /**
2698
- * Format: date-time
2699
- * @description ISO 8601 timestamp (defaults to now)
2700
- */
2701
- timestamp?: string;
2702
- /** @description Unique key to prevent duplicate recording (max 256 chars) */
2703
- idempotencyKey?: string;
2704
- };
1795
+ "application/json": components["schemas"]["CreateUsageRequest"];
2705
1796
  };
2706
1797
  };
2707
1798
  responses: {
@@ -2737,24 +1828,7 @@ interface operations {
2737
1828
  };
2738
1829
  requestBody: {
2739
1830
  content: {
2740
- "application/json": {
2741
- events: {
2742
- customerId: string;
2743
- /** @enum {string} */
2744
- actionType?: "transaction" | "api_call" | "hour" | "email" | "storage" | "custom";
2745
- units?: number;
2746
- productReference?: string;
2747
- purchaseReference?: string;
2748
- /** @enum {string} */
2749
- outcome?: "success" | "paywall" | "fail";
2750
- metadata?: {
2751
- [key: string]: unknown;
2752
- };
2753
- /** Format: date-time */
2754
- timestamp?: string;
2755
- idempotencyKey?: string;
2756
- }[];
2757
- };
1831
+ "application/json": components["schemas"]["BulkCreateUsageRequest"];
2758
1832
  };
2759
1833
  };
2760
1834
  responses: {
@@ -2783,7 +1857,7 @@ interface operations {
2783
1857
  };
2784
1858
  requestBody: {
2785
1859
  content: {
2786
- "application/json": components["schemas"]["RecordMeterEventDto"];
1860
+ "application/json": components["schemas"]["RecordMeterEventZodDto"];
2787
1861
  };
2788
1862
  };
2789
1863
  responses: {
@@ -2817,7 +1891,7 @@ interface operations {
2817
1891
  };
2818
1892
  requestBody: {
2819
1893
  content: {
2820
- "application/json": components["schemas"]["RecordBulkMeterEventsDto"];
1894
+ "application/json": components["schemas"]["RecordBulkMeterEventsZodDto"];
2821
1895
  };
2822
1896
  };
2823
1897
  responses: {
@@ -2844,15 +1918,15 @@ interface operations {
2844
1918
  };
2845
1919
  };
2846
1920
  };
2847
- CustomerSdkController_getCustomerByQuery: {
1921
+ PurchaseSdkController_listPurchases: {
2848
1922
  parameters: {
2849
1923
  query?: {
2850
- /** @description Customer reference identifier (use exactly one query parameter) */
2851
- reference?: string;
2852
- /** @description External reference ID from your auth system (use exactly one query parameter) */
2853
- externalRef?: string;
2854
- /** @description Customer email address (use exactly one query parameter) */
2855
- email?: string;
1924
+ /** @description Filter by purchase status */
1925
+ status?: "pending" | "active" | "trialing" | "past_due" | "cancelled" | "expired" | "suspended" | "refunded";
1926
+ /** @description Filter by product reference */
1927
+ productRef?: string;
1928
+ /** @description Filter by customer reference */
1929
+ customerRef?: string;
2856
1930
  };
2857
1931
  header?: never;
2858
1932
  path?: never;
@@ -2860,22 +1934,40 @@ interface operations {
2860
1934
  };
2861
1935
  requestBody?: never;
2862
1936
  responses: {
2863
- /** @description Customer retrieved successfully */
1937
+ /** @description Purchases retrieved successfully */
2864
1938
  200: {
2865
1939
  headers: {
2866
1940
  [name: string]: unknown;
2867
1941
  };
2868
1942
  content: {
2869
- "application/json": components["schemas"]["CustomerResponse"];
1943
+ "application/json": {
1944
+ purchases?: components["schemas"]["SdkPurchaseResponse"][];
1945
+ };
2870
1946
  };
2871
1947
  };
2872
- /** @description Invalid request - must provide exactly one of reference, externalRef, or email */
2873
- 400: {
1948
+ };
1949
+ };
1950
+ PurchaseSdkController_getPurchasesForCustomer: {
1951
+ parameters: {
1952
+ query?: never;
1953
+ header?: never;
1954
+ path: {
1955
+ /** @description Customer reference or ID */
1956
+ customerRef: string;
1957
+ };
1958
+ cookie?: never;
1959
+ };
1960
+ requestBody?: never;
1961
+ responses: {
1962
+ /** @description Customer purchases retrieved successfully */
1963
+ 200: {
2874
1964
  headers: {
2875
1965
  [name: string]: unknown;
2876
1966
  };
2877
1967
  content: {
2878
- "application/json": unknown;
1968
+ "application/json": {
1969
+ purchases?: components["schemas"]["SdkPurchaseResponse"][];
1970
+ };
2879
1971
  };
2880
1972
  };
2881
1973
  /** @description Customer not found */
@@ -2883,154 +1975,150 @@ interface operations {
2883
1975
  headers: {
2884
1976
  [name: string]: unknown;
2885
1977
  };
2886
- content: {
2887
- "application/json": unknown;
2888
- };
1978
+ content?: never;
2889
1979
  };
2890
1980
  };
2891
1981
  };
2892
- CustomerSdkController_createCustomer: {
1982
+ PurchaseSdkController_getPurchasesForProduct: {
2893
1983
  parameters: {
2894
1984
  query?: never;
2895
1985
  header?: never;
2896
- path?: never;
2897
- cookie?: never;
2898
- };
2899
- /** @description Customer creation data */
2900
- requestBody: {
2901
- content: {
2902
- "application/json": components["schemas"]["CreateCustomerRequest"];
1986
+ path: {
1987
+ /** @description Product reference or ID */
1988
+ productRef: string;
2903
1989
  };
1990
+ cookie?: never;
2904
1991
  };
1992
+ requestBody?: never;
2905
1993
  responses: {
2906
- /** @description Customer created successfully */
2907
- 201: {
1994
+ /** @description Product purchases retrieved successfully */
1995
+ 200: {
2908
1996
  headers: {
2909
1997
  [name: string]: unknown;
2910
1998
  };
2911
1999
  content: {
2912
- "application/json": components["schemas"]["CustomerResponse"];
2000
+ "application/json": {
2001
+ purchases?: components["schemas"]["SdkPurchaseResponse"][];
2002
+ };
2913
2003
  };
2914
2004
  };
2915
- /** @description Invalid email or missing required fields */
2916
- 400: {
2005
+ /** @description Product not found */
2006
+ 404: {
2917
2007
  headers: {
2918
2008
  [name: string]: unknown;
2919
2009
  };
2920
- content: {
2921
- "application/json": unknown;
2922
- };
2010
+ content?: never;
2923
2011
  };
2924
2012
  };
2925
2013
  };
2926
- CustomerSdkController_getCustomer: {
2014
+ PurchaseSdkController_getPurchase: {
2927
2015
  parameters: {
2928
2016
  query?: never;
2929
2017
  header?: never;
2930
2018
  path: {
2931
- /** @description Customer reference identifier */
2932
- reference: string;
2019
+ /** @description Purchase reference or ID */
2020
+ purchaseRef: string;
2933
2021
  };
2934
2022
  cookie?: never;
2935
2023
  };
2936
2024
  requestBody?: never;
2937
2025
  responses: {
2938
- /** @description Customer retrieved successfully */
2026
+ /** @description Purchase retrieved successfully */
2939
2027
  200: {
2940
2028
  headers: {
2941
2029
  [name: string]: unknown;
2942
2030
  };
2943
2031
  content: {
2944
- "application/json": components["schemas"]["CustomerResponse"];
2032
+ "application/json": components["schemas"]["SdkPurchaseResponse"];
2945
2033
  };
2946
2034
  };
2947
- /** @description Customer not found */
2035
+ /** @description Purchase not found */
2948
2036
  404: {
2949
2037
  headers: {
2950
2038
  [name: string]: unknown;
2951
2039
  };
2952
- content: {
2953
- "application/json": unknown;
2954
- };
2040
+ content?: never;
2955
2041
  };
2956
2042
  };
2957
2043
  };
2958
- CustomerSdkController_createCustomerSession: {
2044
+ PurchaseSdkController_cancelPurchase: {
2959
2045
  parameters: {
2960
2046
  query?: never;
2961
2047
  header?: never;
2962
- path?: never;
2048
+ path: {
2049
+ /** @description Purchase reference or ID */
2050
+ purchaseRef: string;
2051
+ };
2963
2052
  cookie?: never;
2964
2053
  };
2965
- /** @description Customer session creation request data */
2966
2054
  requestBody: {
2967
2055
  content: {
2968
- "application/json": components["schemas"]["CreateCustomerSessionRequest"];
2056
+ "application/json": components["schemas"]["CancelPurchaseRequest"];
2969
2057
  };
2970
2058
  };
2971
2059
  responses: {
2972
- /** @description Customer session created successfully */
2973
- 201: {
2974
- headers: {
2975
- [name: string]: unknown;
2976
- };
2977
- content: {
2978
- "application/json": components["schemas"]["CreateCustomerSessionResponse"];
2979
- };
2980
- };
2981
- /** @description Invalid request data or customer not found */
2982
- 400: {
2060
+ /** @description Purchase cancelled successfully */
2061
+ 200: {
2983
2062
  headers: {
2984
2063
  [name: string]: unknown;
2985
2064
  };
2986
2065
  content: {
2987
- "application/json": unknown;
2066
+ "application/json": {
2067
+ success?: boolean;
2068
+ purchase?: components["schemas"]["SdkPurchaseResponse"];
2069
+ };
2988
2070
  };
2989
2071
  };
2990
- /** @description Customer not found */
2072
+ /** @description Purchase not found */
2991
2073
  404: {
2992
2074
  headers: {
2993
2075
  [name: string]: unknown;
2994
2076
  };
2995
- content: {
2996
- "application/json": unknown;
2997
- };
2077
+ content?: never;
2998
2078
  };
2999
2079
  };
3000
2080
  };
3001
- CustomerSdkController_getCustomerSession: {
2081
+ PurchaseSdkController_reactivatePurchase: {
3002
2082
  parameters: {
3003
2083
  query?: never;
3004
2084
  header?: never;
3005
2085
  path: {
3006
- /** @description Customer session ID/token */
3007
- sessionId: string;
2086
+ /** @description Purchase reference or ID */
2087
+ purchaseRef: string;
3008
2088
  };
3009
2089
  cookie?: never;
3010
2090
  };
3011
2091
  requestBody?: never;
3012
2092
  responses: {
3013
- /** @description Customer session retrieved successfully */
2093
+ /** @description Purchase reactivated successfully */
3014
2094
  200: {
3015
2095
  headers: {
3016
2096
  [name: string]: unknown;
3017
2097
  };
3018
2098
  content: {
3019
- "application/json": components["schemas"]["GetCustomerSessionResponse"];
2099
+ "application/json": {
2100
+ success?: boolean;
2101
+ purchase?: components["schemas"]["SdkPurchaseResponse"];
2102
+ };
3020
2103
  };
3021
2104
  };
3022
- /** @description Customer session not found */
3023
- 404: {
2105
+ /** @description Purchase cannot be reactivated */
2106
+ 400: {
3024
2107
  headers: {
3025
2108
  [name: string]: unknown;
3026
2109
  };
3027
- content: {
3028
- "application/json": unknown;
2110
+ content?: never;
2111
+ };
2112
+ /** @description Purchase not found */
2113
+ 404: {
2114
+ headers: {
2115
+ [name: string]: unknown;
3029
2116
  };
2117
+ content?: never;
3030
2118
  };
3031
2119
  };
3032
2120
  };
3033
- UserInfoSdkController_getUserInfo: {
2121
+ LimitsSdkController_checkLimits: {
3034
2122
  parameters: {
3035
2123
  query?: never;
3036
2124
  header?: never;
@@ -3039,17 +2127,17 @@ interface operations {
3039
2127
  };
3040
2128
  requestBody: {
3041
2129
  content: {
3042
- "application/json": components["schemas"]["UserInfoRequest"];
2130
+ "application/json": components["schemas"]["CheckLimitRequest"];
3043
2131
  };
3044
2132
  };
3045
2133
  responses: {
3046
- /** @description User info with purchase status */
2134
+ /** @description Limit check result */
3047
2135
  200: {
3048
2136
  headers: {
3049
2137
  [name: string]: unknown;
3050
2138
  };
3051
2139
  content: {
3052
- "application/json": components["schemas"]["UserInfoResponse"];
2140
+ "application/json": components["schemas"]["LimitResponse"];
3053
2141
  };
3054
2142
  };
3055
2143
  /** @description Missing customerRef or productRef */
@@ -3068,15 +2156,38 @@ interface operations {
3068
2156
  };
3069
2157
  };
3070
2158
  };
3071
- PurchaseSdkController_listPurchases: {
2159
+ ActivateSdkController_activate: {
2160
+ parameters: {
2161
+ query?: never;
2162
+ header?: never;
2163
+ path?: never;
2164
+ cookie?: never;
2165
+ };
2166
+ requestBody: {
2167
+ content: {
2168
+ "application/json": components["schemas"]["ActivatePlanDto"];
2169
+ };
2170
+ };
2171
+ responses: {
2172
+ 200: {
2173
+ headers: {
2174
+ [name: string]: unknown;
2175
+ };
2176
+ content: {
2177
+ "application/json": components["schemas"]["ActivatePlanResponseDto"];
2178
+ };
2179
+ };
2180
+ };
2181
+ };
2182
+ CustomerSdkController_getCustomerByQuery: {
3072
2183
  parameters: {
3073
2184
  query?: {
3074
- /** @description Filter by purchase status */
3075
- status?: "pending" | "active" | "trialing" | "past_due" | "cancelled" | "expired" | "suspended" | "refunded";
3076
- /** @description Filter by product ID */
3077
- productId?: string;
3078
- /** @description Filter by customer ID */
3079
- customerId?: string;
2185
+ /** @description Customer reference identifier (use exactly one query parameter) */
2186
+ reference?: string;
2187
+ /** @description External reference ID from your auth system (use exactly one query parameter) */
2188
+ externalRef?: string;
2189
+ /** @description Customer email address (use exactly one query parameter) */
2190
+ email?: string;
3080
2191
  };
3081
2192
  header?: never;
3082
2193
  path?: never;
@@ -3084,40 +2195,88 @@ interface operations {
3084
2195
  };
3085
2196
  requestBody?: never;
3086
2197
  responses: {
3087
- /** @description Purchases retrieved successfully */
2198
+ /** @description Customer retrieved successfully */
3088
2199
  200: {
3089
2200
  headers: {
3090
2201
  [name: string]: unknown;
3091
2202
  };
3092
2203
  content: {
3093
- "application/json": {
3094
- purchases?: components["schemas"]["PurchaseResponse"][];
3095
- };
2204
+ "application/json": components["schemas"]["CustomerResponse"];
2205
+ };
2206
+ };
2207
+ /** @description Invalid request - must provide exactly one of reference, externalRef, or email */
2208
+ 400: {
2209
+ headers: {
2210
+ [name: string]: unknown;
2211
+ };
2212
+ content: {
2213
+ "application/json": unknown;
2214
+ };
2215
+ };
2216
+ /** @description Customer not found */
2217
+ 404: {
2218
+ headers: {
2219
+ [name: string]: unknown;
2220
+ };
2221
+ content: {
2222
+ "application/json": unknown;
3096
2223
  };
3097
2224
  };
3098
2225
  };
3099
2226
  };
3100
- PurchaseSdkController_getPurchasesForCustomer: {
2227
+ CustomerSdkController_createCustomer: {
2228
+ parameters: {
2229
+ query?: never;
2230
+ header?: never;
2231
+ path?: never;
2232
+ cookie?: never;
2233
+ };
2234
+ /** @description Customer creation data */
2235
+ requestBody: {
2236
+ content: {
2237
+ "application/json": components["schemas"]["CreateCustomerRequest"];
2238
+ };
2239
+ };
2240
+ responses: {
2241
+ /** @description Customer created successfully */
2242
+ 201: {
2243
+ headers: {
2244
+ [name: string]: unknown;
2245
+ };
2246
+ content: {
2247
+ "application/json": components["schemas"]["CustomerResponse"];
2248
+ };
2249
+ };
2250
+ /** @description Invalid email or missing required fields */
2251
+ 400: {
2252
+ headers: {
2253
+ [name: string]: unknown;
2254
+ };
2255
+ content: {
2256
+ "application/json": unknown;
2257
+ };
2258
+ };
2259
+ };
2260
+ };
2261
+ CustomerSdkController_getCustomerBalance: {
3101
2262
  parameters: {
3102
2263
  query?: never;
3103
2264
  header?: never;
3104
2265
  path: {
3105
- /** @description Customer reference or ID */
3106
- customerRef: string;
2266
+ /** @description Customer reference identifier */
2267
+ reference: string;
3107
2268
  };
3108
2269
  cookie?: never;
3109
2270
  };
3110
2271
  requestBody?: never;
3111
2272
  responses: {
3112
- /** @description Customer purchases retrieved successfully */
2273
+ /** @description Customer balance retrieved successfully */
3113
2274
  200: {
3114
2275
  headers: {
3115
2276
  [name: string]: unknown;
3116
2277
  };
3117
2278
  content: {
3118
- "application/json": {
3119
- purchases?: components["schemas"]["PurchaseResponse"][];
3120
- };
2279
+ "application/json": unknown;
3121
2280
  };
3122
2281
  };
3123
2282
  /** @description Customer not found */
@@ -3125,110 +2284,120 @@ interface operations {
3125
2284
  headers: {
3126
2285
  [name: string]: unknown;
3127
2286
  };
3128
- content?: never;
2287
+ content: {
2288
+ "application/json": unknown;
2289
+ };
3129
2290
  };
3130
2291
  };
3131
2292
  };
3132
- PurchaseSdkController_getPurchasesForProduct: {
2293
+ CustomerSdkController_getCustomer: {
3133
2294
  parameters: {
3134
2295
  query?: never;
3135
2296
  header?: never;
3136
- path: {
3137
- /** @description Product reference or ID */
3138
- productRef: string;
2297
+ path: {
2298
+ /** @description Customer reference identifier */
2299
+ reference: string;
3139
2300
  };
3140
2301
  cookie?: never;
3141
2302
  };
3142
2303
  requestBody?: never;
3143
2304
  responses: {
3144
- /** @description Product purchases retrieved successfully */
2305
+ /** @description Customer retrieved successfully */
3145
2306
  200: {
3146
2307
  headers: {
3147
2308
  [name: string]: unknown;
3148
2309
  };
3149
2310
  content: {
3150
- "application/json": {
3151
- purchases?: components["schemas"]["PurchaseResponse"][];
3152
- };
2311
+ "application/json": components["schemas"]["CustomerResponse"];
3153
2312
  };
3154
2313
  };
3155
- /** @description Product not found */
2314
+ /** @description Customer not found */
3156
2315
  404: {
3157
2316
  headers: {
3158
2317
  [name: string]: unknown;
3159
2318
  };
3160
- content?: never;
2319
+ content: {
2320
+ "application/json": unknown;
2321
+ };
3161
2322
  };
3162
2323
  };
3163
2324
  };
3164
- PurchaseSdkController_getPurchase: {
2325
+ CustomerSdkController_createCustomerSession: {
3165
2326
  parameters: {
3166
2327
  query?: never;
3167
2328
  header?: never;
3168
- path: {
3169
- /** @description Purchase ID or reference */
3170
- id: string;
3171
- };
2329
+ path?: never;
3172
2330
  cookie?: never;
3173
2331
  };
3174
- requestBody?: never;
2332
+ /** @description Customer session creation request data */
2333
+ requestBody: {
2334
+ content: {
2335
+ "application/json": components["schemas"]["CreateCustomerSessionRequest"];
2336
+ };
2337
+ };
3175
2338
  responses: {
3176
- /** @description Purchase retrieved successfully */
3177
- 200: {
2339
+ /** @description Customer session created successfully */
2340
+ 201: {
3178
2341
  headers: {
3179
2342
  [name: string]: unknown;
3180
2343
  };
3181
2344
  content: {
3182
- "application/json": components["schemas"]["PurchaseResponse"];
2345
+ "application/json": components["schemas"]["CreateCustomerSessionResponse"];
3183
2346
  };
3184
2347
  };
3185
- /** @description Purchase not found */
2348
+ /** @description Invalid request data or customer not found */
2349
+ 400: {
2350
+ headers: {
2351
+ [name: string]: unknown;
2352
+ };
2353
+ content: {
2354
+ "application/json": unknown;
2355
+ };
2356
+ };
2357
+ /** @description Customer not found */
3186
2358
  404: {
3187
2359
  headers: {
3188
2360
  [name: string]: unknown;
3189
2361
  };
3190
- content?: never;
2362
+ content: {
2363
+ "application/json": unknown;
2364
+ };
3191
2365
  };
3192
2366
  };
3193
2367
  };
3194
- PurchaseSdkController_cancelPurchase: {
2368
+ CustomerSdkController_getCustomerSession: {
3195
2369
  parameters: {
3196
2370
  query?: never;
3197
2371
  header?: never;
3198
2372
  path: {
3199
- /** @description Purchase reference or ID */
3200
- purchaseRef: string;
2373
+ /** @description Customer session ID/token */
2374
+ sessionId: string;
3201
2375
  };
3202
2376
  cookie?: never;
3203
2377
  };
3204
- requestBody: {
3205
- content: {
3206
- "application/json": components["schemas"]["CancelPurchaseRequest"];
3207
- };
3208
- };
2378
+ requestBody?: never;
3209
2379
  responses: {
3210
- /** @description Purchase cancelled successfully */
2380
+ /** @description Customer session retrieved successfully */
3211
2381
  200: {
3212
2382
  headers: {
3213
2383
  [name: string]: unknown;
3214
2384
  };
3215
2385
  content: {
3216
- "application/json": {
3217
- success?: boolean;
3218
- purchase?: components["schemas"]["PurchaseResponse"];
3219
- };
2386
+ "application/json": components["schemas"]["GetCustomerSessionResponse"];
3220
2387
  };
3221
2388
  };
3222
- /** @description Purchase not found */
2389
+ /** @description Customer session not found */
3223
2390
  404: {
3224
2391
  headers: {
3225
2392
  [name: string]: unknown;
3226
2393
  };
3227
- content?: never;
2394
+ content: {
2395
+ "application/json": unknown;
2396
+ };
3228
2397
  };
3229
2398
  };
3230
2399
  };
3231
- LimitsSdkController_checkLimits: {
2400
+ UserInfoSdkController_getUserInfo: {
3232
2401
  parameters: {
3233
2402
  query?: never;
3234
2403
  header?: never;
@@ -3237,17 +2406,17 @@ interface operations {
3237
2406
  };
3238
2407
  requestBody: {
3239
2408
  content: {
3240
- "application/json": components["schemas"]["CheckLimitRequest"];
2409
+ "application/json": components["schemas"]["UserInfoRequest"];
3241
2410
  };
3242
2411
  };
3243
2412
  responses: {
3244
- /** @description Limit check result */
2413
+ /** @description User info with purchase status */
3245
2414
  200: {
3246
2415
  headers: {
3247
2416
  [name: string]: unknown;
3248
2417
  };
3249
2418
  content: {
3250
- "application/json": components["schemas"]["LimitResponse"];
2419
+ "application/json": components["schemas"]["UserInfoResponse"];
3251
2420
  };
3252
2421
  };
3253
2422
  /** @description Missing customerRef or productRef */
@@ -3274,17 +2443,12 @@ interface operations {
3274
2443
  * Types related to the SolvaPay API client and backend communication.
3275
2444
  */
3276
2445
 
3277
- type UsageMeterType = 'requests' | 'tokens';
3278
- type CheckLimitsRequest = components['schemas']['CheckLimitRequest'] & {
3279
- meterName?: string;
3280
- usageType?: UsageMeterType;
3281
- };
2446
+ type CheckLimitsRequest = components['schemas']['CheckLimitRequest'];
3282
2447
  /**
3283
- * Extended LimitResponse with plan field
2448
+ * Extended LimitResponse with SDK-added plan field
3284
2449
  */
3285
2450
  type LimitResponseWithPlan = components['schemas']['LimitResponse'] & {
3286
2451
  plan: string;
3287
- meterName?: string;
3288
2452
  };
3289
2453
  /**
3290
2454
  * Extended CustomerResponse with proper field mapping
@@ -3323,62 +2487,38 @@ interface ProcessPaymentResult {
3323
2487
  oneTimePurchase?: OneTimePurchaseInfo;
3324
2488
  status: 'completed';
3325
2489
  }
3326
- interface McpBootstrapFreePlanConfig {
3327
- name?: string;
3328
- freeUnits?: number;
3329
- }
3330
- interface McpBootstrapPaidPlanInput {
3331
- key: string;
3332
- name: string;
3333
- /** Price in cents (e.g. 2000 = $20.00) */
3334
- price: number;
3335
- currency: string;
3336
- billingCycle?: 'weekly' | 'monthly' | 'quarterly' | 'yearly' | 'custom';
3337
- type?: 'recurring' | 'one-time';
3338
- freeUnits?: number;
3339
- meterId?: string;
3340
- limit?: number;
3341
- features?: Record<string, unknown>;
3342
- }
3343
- interface ToolPlanMappingInput {
3344
- name: string;
3345
- description?: string;
3346
- noPlan?: boolean;
3347
- planIds?: string[];
3348
- planRefs?: string[];
3349
- planKeys?: string[];
3350
- }
3351
- interface McpToolPlanMappingInput {
3352
- name: string;
3353
- planKeys: string[];
3354
- }
3355
- interface McpBootstrapRequest {
3356
- name?: string;
3357
- description?: string;
3358
- imageUrl?: string;
3359
- productType?: string;
3360
- originUrl: string;
3361
- /** Optional token combined with provider name to derive the final MCP subdomain. */
3362
- mcpDomain?: string;
3363
- authHeaderName?: string;
3364
- authApiKey?: string;
3365
- freePlan?: McpBootstrapFreePlanConfig;
3366
- paidPlans?: McpBootstrapPaidPlanInput[];
3367
- tools?: ToolPlanMappingInput[];
3368
- metadata?: Record<string, unknown>;
3369
- }
2490
+ type ActivatePlanResult = components['schemas']['ActivatePlanResponseDto'];
2491
+ /**
2492
+ * SDK-facing merchant identity (source: GET /v1/sdk/merchant).
2493
+ *
2494
+ * Hand-typed here until the OpenAPI generator picks up the new endpoint.
2495
+ * Fields match `SdkMerchantResponseDto` on the backend.
2496
+ */
2497
+ type SdkMerchantResponse = {
2498
+ displayName: string;
2499
+ legalName: string;
2500
+ supportEmail?: string;
2501
+ supportUrl?: string;
2502
+ termsUrl?: string;
2503
+ privacyUrl?: string;
2504
+ country?: string;
2505
+ defaultCurrency?: string;
2506
+ statementDescriptor?: string;
2507
+ logoUrl?: string;
2508
+ };
2509
+ /** SDK-facing product projection. Sourced from the existing OpenAPI spec. */
2510
+ type SdkProductResponse = components['schemas']['SdkProductResponse'];
2511
+ type McpBootstrapRequest = components['schemas']['McpBootstrapDto'];
3370
2512
  interface McpBootstrapResponse {
3371
2513
  product: components['schemas']['SdkProductResponse'];
3372
2514
  mcpServer: {
3373
- id?: string;
3374
2515
  reference?: string;
3375
2516
  subdomain?: string;
3376
2517
  mcpProxyUrl?: string;
3377
2518
  url: string;
3378
- defaultPlanId?: string;
2519
+ defaultPlanRef?: string;
3379
2520
  };
3380
2521
  planMap: Record<string, {
3381
- id: string;
3382
2522
  reference: string;
3383
2523
  name?: string;
3384
2524
  }>;
@@ -3388,22 +2528,17 @@ interface McpBootstrapResponse {
3388
2528
  description?: string;
3389
2529
  }>;
3390
2530
  }
3391
- interface ConfigureMcpPlansRequest {
3392
- paidPlans?: McpBootstrapPaidPlanInput[];
3393
- toolMapping?: McpToolPlanMappingInput[];
3394
- }
2531
+ type ConfigureMcpPlansRequest = components['schemas']['ConfigureMcpPlansDto'];
3395
2532
  interface ConfigureMcpPlansResponse {
3396
2533
  product: components['schemas']['SdkProductResponse'];
3397
2534
  mcpServer: {
3398
- id?: string;
3399
2535
  reference?: string;
3400
2536
  subdomain?: string;
3401
2537
  mcpProxyUrl?: string;
3402
2538
  url: string;
3403
- defaultPlanId?: string;
2539
+ defaultPlanRef?: string;
3404
2540
  };
3405
2541
  planMap: Record<string, {
3406
- id: string;
3407
2542
  reference: string;
3408
2543
  name?: string;
3409
2544
  }>;
@@ -3422,8 +2557,8 @@ interface SolvaPayClient {
3422
2557
  actionType?: 'transaction' | 'api_call' | 'hour' | 'email' | 'storage' | 'custom';
3423
2558
  units?: number;
3424
2559
  outcome?: 'success' | 'paywall' | 'fail';
3425
- productReference?: string;
3426
- purchaseReference?: string;
2560
+ productRef?: string;
2561
+ purchaseRef?: string;
3427
2562
  description?: string;
3428
2563
  metadata?: Record<string, unknown>;
3429
2564
  duration?: number;
@@ -3438,6 +2573,13 @@ interface SolvaPayClient {
3438
2573
  externalRef?: string;
3439
2574
  email?: string;
3440
2575
  }): Promise<CustomerResponseMapped>;
2576
+ /**
2577
+ * SDK-facing merchant identity (GET /v1/sdk/merchant).
2578
+ * Returns the subset of provider fields safe for browser consumption —
2579
+ * used by `<MandateText>`, `<CheckoutSummary>`, and trust signals.
2580
+ */
2581
+ getMerchant?(): Promise<SdkMerchantResponse>;
2582
+ getProduct?(productRef: string): Promise<SdkProductResponse>;
3441
2583
  listProducts?(): Promise<Array<{
3442
2584
  reference: string;
3443
2585
  name: string;
@@ -3458,29 +2600,11 @@ interface SolvaPayClient {
3458
2600
  reference: string;
3459
2601
  name: string;
3460
2602
  }>;
3461
- listPlans?(productRef: string): Promise<Array<{
3462
- reference: string;
3463
- price?: number;
3464
- currency?: string;
3465
- interval?: string;
3466
- isFreeTier?: boolean;
3467
- freeUnits?: number;
3468
- measures?: string;
3469
- limit?: number;
3470
- pricePerUnit?: number;
3471
- billingModel?: string;
3472
- metadata?: Record<string, unknown>;
3473
- [key: string]: unknown;
3474
- }>>;
2603
+ listPlans?(productRef: string): Promise<components['schemas']['Plan'][]>;
3475
2604
  createPlan?(params: components['schemas']['CreatePlanRequest'] & {
3476
2605
  productRef: string;
3477
- }): Promise<{
3478
- reference: string;
3479
- }>;
3480
- updatePlan?(productRef: string, planRef: string, params: Partial<components['schemas']['CreatePlanRequest']>): Promise<{
3481
- reference: string;
3482
- [key: string]: unknown;
3483
- }>;
2606
+ }): Promise<components['schemas']['Plan']>;
2607
+ updatePlan?(productRef: string, planRef: string, params: components['schemas']['UpdatePlanRequest']): Promise<components['schemas']['Plan']>;
3484
2608
  deletePlan?(productRef: string, planRef: string): Promise<void>;
3485
2609
  createPaymentIntent?(params: {
3486
2610
  productRef: string;
@@ -3488,7 +2612,19 @@ interface SolvaPayClient {
3488
2612
  customerRef: string;
3489
2613
  idempotencyKey?: string;
3490
2614
  }): Promise<{
3491
- id: string;
2615
+ processorPaymentId: string;
2616
+ clientSecret: string;
2617
+ publishableKey: string;
2618
+ accountId?: string;
2619
+ }>;
2620
+ createTopupPaymentIntent?(params: {
2621
+ customerRef: string;
2622
+ amount: number;
2623
+ currency: string;
2624
+ description?: string;
2625
+ idempotencyKey?: string;
2626
+ }): Promise<{
2627
+ processorPaymentId: string;
3492
2628
  clientSecret: string;
3493
2629
  publishableKey: string;
3494
2630
  accountId?: string;
@@ -3497,6 +2633,9 @@ interface SolvaPayClient {
3497
2633
  purchaseRef: string;
3498
2634
  reason?: string;
3499
2635
  }): Promise<components['schemas']['PurchaseInfo']>;
2636
+ reactivatePurchase?(params: {
2637
+ purchaseRef: string;
2638
+ }): Promise<components['schemas']['PurchaseInfo']>;
3500
2639
  processPaymentIntent?(params: {
3501
2640
  paymentIntentId: string;
3502
2641
  productRef: string;
@@ -3507,8 +2646,18 @@ interface SolvaPayClient {
3507
2646
  customerRef: string;
3508
2647
  productRef: string;
3509
2648
  }): Promise<components['schemas']['UserInfoResponse']>;
2649
+ getCustomerBalance?(params: {
2650
+ customerRef: string;
2651
+ }): Promise<{
2652
+ customerRef: string;
2653
+ credits: number;
2654
+ displayCurrency: string;
2655
+ creditsPerMinorUnit: number;
2656
+ displayExchangeRate: number;
2657
+ }>;
3510
2658
  createCheckoutSession(params: operations['CheckoutSessionSdkController_createCheckoutSession']['requestBody']['content']['application/json']): Promise<components['schemas']['CreateCheckoutSessionResponse']>;
3511
2659
  createCustomerSession(params: components['schemas']['CreateCustomerSessionRequest']): Promise<components['schemas']['CreateCustomerSessionResponse']>;
2660
+ activatePlan?(params: components['schemas']['ActivatePlanDto']): Promise<ActivatePlanResult>;
3512
2661
  }
3513
2662
 
3514
2663
  /**
@@ -3516,6 +2665,10 @@ interface SolvaPayClient {
3516
2665
  *
3517
2666
  * Types related to paywall protection, limits, and gating functionality.
3518
2667
  */
2668
+
2669
+ type LimitPlanSummary = components['schemas']['LimitPlanItemDto'];
2670
+ type LimitActivationBalance = components['schemas']['LimitBalanceDto'];
2671
+ type LimitActivationProduct = components['schemas']['LimitProductBriefDto'];
3519
2672
  /**
3520
2673
  * Arguments passed to protected handlers
3521
2674
  */
@@ -3530,18 +2683,32 @@ interface PaywallArgs {
3530
2683
  */
3531
2684
  interface PaywallMetadata {
3532
2685
  product?: string;
3533
- plan?: string;
3534
2686
  usageType?: 'requests' | 'tokens';
3535
2687
  }
3536
2688
  /**
3537
- * Structured content for paywall errors
2689
+ * Structured content for paywall errors (MCP structuredContent and manual handling).
3538
2690
  */
3539
- interface PaywallStructuredContent {
2691
+ type PaywallStructuredContent = {
3540
2692
  kind: 'payment_required';
2693
+ /** Product ref from paywall metadata (or env default) */
3541
2694
  product: string;
3542
2695
  checkoutUrl: string;
3543
2696
  message: string;
3544
- }
2697
+ } | {
2698
+ kind: 'activation_required';
2699
+ /** Product ref from paywall metadata (or env default) */
2700
+ product: string;
2701
+ message: string;
2702
+ /**
2703
+ * Best URL for completing purchase or confirmation; mirrors confirmationUrl when present.
2704
+ */
2705
+ checkoutUrl: string;
2706
+ confirmationUrl?: string;
2707
+ plans?: LimitPlanSummary[];
2708
+ balance?: LimitActivationBalance;
2709
+ /** Rich product context from checkLimits (name, ref, provider slug/id) */
2710
+ productDetails?: LimitActivationProduct;
2711
+ };
3545
2712
  /**
3546
2713
  * MCP tool result with optional paywall information
3547
2714
  */
@@ -3617,14 +2784,6 @@ interface PayableOptions {
3617
2784
  * Product reference (alias for product, preferred for consistency with backend API)
3618
2785
  */
3619
2786
  productRef?: string;
3620
- /**
3621
- * Plan identifier (defaults to product name if not provided)
3622
- */
3623
- plan?: string;
3624
- /**
3625
- * Plan reference (alias for plan, preferred for consistency with backend API)
3626
- */
3627
- planRef?: string;
3628
2787
  /**
3629
2788
  * Usage meter type to charge against (defaults to 'requests')
3630
2789
  */
@@ -3837,7 +2996,7 @@ interface CreateSolvaPayConfig {
3837
2996
  *
3838
2997
  * @example
3839
2998
  * ```typescript
3840
- * const payable = solvaPay.payable({ product: 'prd_myapi', plan: 'pln_premium' });
2999
+ * const payable = solvaPay.payable({ product: 'prd_myapi' });
3841
3000
  *
3842
3001
  * // Express.js
3843
3002
  * app.post('/tasks', payable.http(createTask));
@@ -3935,34 +3094,24 @@ interface PayableFunction {
3935
3094
  * const solvaPay = createSolvaPay();
3936
3095
  *
3937
3096
  * // Create payable handlers
3938
- * const payable = solvaPay.payable({ product: 'prd_myapi', plan: 'pln_premium' });
3097
+ * const payable = solvaPay.payable({ product: 'prd_myapi' });
3939
3098
  *
3940
3099
  * // Manage customers
3941
3100
  * const customerRef = await solvaPay.ensureCustomer('user_123', 'user_123', {
3942
3101
  * email: 'user@example.com'
3943
3102
  * });
3944
- *
3945
- * // Create payment intents
3946
- * const intent = await solvaPay.createPaymentIntent({
3947
- * productRef: 'prd_myapi',
3948
- * planRef: 'pln_premium',
3949
- * customerRef: 'user_123'
3950
- * });
3951
3103
  * ```
3952
3104
  */
3953
3105
  interface SolvaPay {
3954
3106
  /**
3955
3107
  * Create a payable handler with explicit adapters for different frameworks.
3956
3108
  *
3957
- * @param options - Payable options including product and plan references
3109
+ * @param options - Payable options including product reference and usage type
3958
3110
  * @returns PayableFunction with framework-specific adapters
3959
3111
  *
3960
3112
  * @example
3961
3113
  * ```typescript
3962
- * const payable = solvaPay.payable({
3963
- * product: 'prd_myapi',
3964
- * plan: 'pln_premium'
3965
- * });
3114
+ * const payable = solvaPay.payable({ product: 'prd_myapi' });
3966
3115
  *
3967
3116
  * app.post('/tasks', payable.http(createTask));
3968
3117
  * ```
@@ -4002,11 +3151,10 @@ interface SolvaPay {
4002
3151
  name?: string;
4003
3152
  }): Promise<string>;
4004
3153
  /**
4005
- * Create a Stripe payment intent for a customer to purchase a plan.
3154
+ * Create a payment intent for a customer to purchase a plan.
4006
3155
  *
4007
- * This creates a payment intent that can be confirmed on the client side
4008
- * using Stripe.js. After confirmation, call `processPaymentIntent()` to complete
4009
- * the purchase.
3156
+ * This creates a payment intent that can be confirmed on the client side.
3157
+ * After confirmation, call `processPaymentIntent()` to complete the purchase.
4010
3158
  *
4011
3159
  * @param params - Payment intent parameters
4012
3160
  * @param params.productRef - Product reference
@@ -4024,7 +3172,7 @@ interface SolvaPay {
4024
3172
  * idempotencyKey: 'unique-key-123'
4025
3173
  * });
4026
3174
  *
4027
- * // Use intent.clientSecret with Stripe.js on client
3175
+ * // Use intent.clientSecret on the client to confirm payment
4028
3176
  * ```
4029
3177
  */
4030
3178
  createPaymentIntent(params: {
@@ -4033,19 +3181,38 @@ interface SolvaPay {
4033
3181
  customerRef: string;
4034
3182
  idempotencyKey?: string;
4035
3183
  }): Promise<{
4036
- id: string;
3184
+ processorPaymentId: string;
3185
+ clientSecret: string;
3186
+ publishableKey: string;
3187
+ accountId?: string;
3188
+ }>;
3189
+ /**
3190
+ * Create a payment intent for a credit top-up.
3191
+ *
3192
+ * Unlike `createPaymentIntent`, this does not require a product or plan.
3193
+ * Credits are recorded via webhook after payment confirmation — no
3194
+ * `processPaymentIntent` call is needed.
3195
+ */
3196
+ createTopupPaymentIntent(params: {
3197
+ customerRef: string;
3198
+ amount: number;
3199
+ currency: string;
3200
+ description?: string;
3201
+ idempotencyKey?: string;
3202
+ }): Promise<{
3203
+ processorPaymentId: string;
4037
3204
  clientSecret: string;
4038
3205
  publishableKey: string;
4039
3206
  accountId?: string;
4040
3207
  }>;
4041
3208
  /**
4042
- * Process a payment intent after client-side Stripe confirmation.
3209
+ * Process a payment intent after client-side payment confirmation.
4043
3210
  *
4044
3211
  * Creates the purchase immediately, eliminating webhook delay.
4045
- * Call this after the client has confirmed the payment intent with Stripe.js.
3212
+ * Call this after the client has confirmed the payment intent.
4046
3213
  *
4047
3214
  * @param params - Payment processing parameters
4048
- * @param params.paymentIntentId - Stripe payment intent ID from client confirmation
3215
+ * @param params.paymentIntentId - Processor payment ID from client confirmation
4049
3216
  * @param params.productRef - Product reference
4050
3217
  * @param params.customerRef - Customer reference
4051
3218
  * @param params.planRef - Optional plan reference (if not in payment intent)
@@ -4053,7 +3220,7 @@ interface SolvaPay {
4053
3220
  *
4054
3221
  * @example
4055
3222
  * ```typescript
4056
- * // After client confirms payment with Stripe.js
3223
+ * // After client confirms payment
4057
3224
  * const result = await solvaPay.processPaymentIntent({
4058
3225
  * paymentIntentId: 'pi_1234567890',
4059
3226
  * productRef: 'prd_myapi',
@@ -4088,7 +3255,6 @@ interface SolvaPay {
4088
3255
  * const limits = await solvaPay.checkLimits({
4089
3256
  * customerRef: 'user_123',
4090
3257
  * productRef: 'prd_myapi',
4091
- * planRef: 'pln_premium'
4092
3258
  * });
4093
3259
  *
4094
3260
  * if (!limits.withinLimits) {
@@ -4101,14 +3267,17 @@ interface SolvaPay {
4101
3267
  customerRef: string;
4102
3268
  productRef: string;
4103
3269
  planRef?: string;
4104
- meterName?: 'requests' | 'tokens';
4105
- usageType?: 'requests' | 'tokens';
3270
+ meterName?: string;
3271
+ usageType?: string;
4106
3272
  }): Promise<{
4107
3273
  withinLimits: boolean;
4108
3274
  remaining: number;
4109
3275
  plan: string;
4110
3276
  checkoutUrl?: string;
4111
3277
  meterName?: string;
3278
+ creditBalance?: number;
3279
+ creditsPerUnit?: number;
3280
+ currency?: string;
4112
3281
  }>;
4113
3282
  /**
4114
3283
  * Track usage for a customer action.
@@ -4118,12 +3287,12 @@ interface SolvaPay {
4118
3287
  *
4119
3288
  * @param params - Usage tracking parameters
4120
3289
  * @param params.customerRef - Customer reference
4121
- * @param params.productRef - Product reference
4122
- * @param params.planRef - Plan reference
3290
+ * @param params.actionType - Action type category
3291
+ * @param params.units - Number of units consumed (default 1)
4123
3292
  * @param params.outcome - Action outcome ('success', 'paywall', or 'fail')
4124
- * @param params.action - Optional action name for analytics
4125
- * @param params.requestId - Unique request ID
4126
- * @param params.actionDuration - Action duration in milliseconds
3293
+ * @param params.productRef - Product reference
3294
+ * @param params.metadata - Additional metadata (e.g. tool name, endpoint)
3295
+ * @param params.duration - Action duration in milliseconds
4127
3296
  * @param params.timestamp - ISO timestamp of the action
4128
3297
  *
4129
3298
  * @example
@@ -4142,8 +3311,8 @@ interface SolvaPay {
4142
3311
  actionType?: 'transaction' | 'api_call' | 'hour' | 'email' | 'storage' | 'custom';
4143
3312
  units?: number;
4144
3313
  outcome?: 'success' | 'paywall' | 'fail';
4145
- productReference?: string;
4146
- purchaseReference?: string;
3314
+ productRef?: string;
3315
+ purchaseRef?: string;
4147
3316
  description?: string;
4148
3317
  metadata?: Record<string, unknown>;
4149
3318
  duration?: number;
@@ -4172,6 +3341,7 @@ interface SolvaPay {
4172
3341
  createCustomer(params: {
4173
3342
  email: string;
4174
3343
  name?: string;
3344
+ metadata?: Record<string, unknown>;
4175
3345
  }): Promise<{
4176
3346
  customerRef: string;
4177
3347
  }>;
@@ -4203,11 +3373,27 @@ interface SolvaPay {
4203
3373
  customerRef?: string;
4204
3374
  externalRef?: string;
4205
3375
  }): Promise<CustomerResponseMapped>;
3376
+ /**
3377
+ * Get credits for a customer.
3378
+ *
3379
+ * @param params - Credits query parameters
3380
+ * @param params.customerRef - Customer reference
3381
+ * @returns Customer reference, credits, and display currency
3382
+ */
3383
+ getCustomerBalance(params: {
3384
+ customerRef: string;
3385
+ }): Promise<{
3386
+ customerRef: string;
3387
+ credits: number;
3388
+ displayCurrency: string;
3389
+ creditsPerMinorUnit: number;
3390
+ displayExchangeRate: number;
3391
+ }>;
4206
3392
  /**
4207
3393
  * Create a hosted checkout session for a customer.
4208
3394
  *
4209
- * This creates a Stripe Checkout session that redirects the customer
4210
- * to a hosted payment page. After payment, customer is redirected back.
3395
+ * This creates a checkout session that redirects the customer
3396
+ * to a hosted payment page. After payment, the customer is redirected back.
4211
3397
  *
4212
3398
  * @param params - Checkout session parameters
4213
3399
  * @param params.productRef - Product reference
@@ -4241,7 +3427,7 @@ interface SolvaPay {
4241
3427
  /**
4242
3428
  * Create a customer portal session for managing purchases.
4243
3429
  *
4244
- * This creates a Stripe Customer Portal session that allows customers
3430
+ * This creates a customer portal session that allows customers
4245
3431
  * to manage their purchases, update payment methods, and view invoices.
4246
3432
  *
4247
3433
  * @param params - Customer session parameters
@@ -4266,6 +3452,17 @@ interface SolvaPay {
4266
3452
  sessionId: string;
4267
3453
  customerUrl: string;
4268
3454
  }>;
3455
+ /**
3456
+ * Activate a plan for a customer (usage-based / free plans that don't require payment).
3457
+ *
3458
+ * Returns the activation result indicating whether the plan was activated,
3459
+ * is already active, requires a credit top-up, or requires payment.
3460
+ */
3461
+ activatePlan(params: {
3462
+ customerRef: string;
3463
+ productRef: string;
3464
+ planRef: string;
3465
+ }): Promise<ActivatePlanResult>;
4269
3466
  /**
4270
3467
  * Bootstrap an MCP-enabled product with plans and tool mappings.
4271
3468
  *
@@ -4359,10 +3556,7 @@ interface SolvaPay {
4359
3556
  * });
4360
3557
  *
4361
3558
  * // Create payable handlers for your product
4362
- * const payable = solvaPay.payable({
4363
- * product: 'prd_myapi',
4364
- * plan: 'pln_premium'
4365
- * });
3559
+ * const payable = solvaPay.payable({ product: 'prd_myapi' });
4366
3560
  *
4367
3561
  * // Protect endpoints with framework-specific adapters
4368
3562
  * app.post('/tasks', payable.http(createTask)); // Express/Fastify
@@ -4429,6 +3623,8 @@ declare class PaywallError extends Error {
4429
3623
  */
4430
3624
  constructor(message: string, structuredContent: PaywallStructuredContent);
4431
3625
  }
3626
+ /** JSON body shape for HTTP adapters and MCP text content (stable fields for clients). */
3627
+ declare function paywallErrorToClientPayload(error: PaywallError): Record<string, unknown>;
4432
3628
 
4433
3629
  /**
4434
3630
  * Utility functions for the SolvaPay Server SDK
@@ -4564,6 +3760,13 @@ declare function getAuthenticatedUserCore(request: Request, options?: {
4564
3760
  * Works with standard Web API Request (works everywhere).
4565
3761
  */
4566
3762
 
3763
+ type CustomerBalanceResult = {
3764
+ customerRef: string;
3765
+ credits: number;
3766
+ displayCurrency: string;
3767
+ creditsPerMinorUnit: number;
3768
+ displayExchangeRate: number;
3769
+ };
4567
3770
  /**
4568
3771
  * Sync customer with SolvaPay backend (ensure customer exists).
4569
3772
  *
@@ -4606,16 +3809,28 @@ declare function syncCustomerCore(request: Request, options?: {
4606
3809
  includeEmail?: boolean;
4607
3810
  includeName?: boolean;
4608
3811
  }): Promise<string | ErrorResult>;
3812
+ /**
3813
+ * Get credits for the authenticated customer.
3814
+ *
3815
+ * Authenticates the request, syncs the customer, then fetches credits.
3816
+ *
3817
+ * @param request - Standard Web API Request object
3818
+ * @param options - Configuration options
3819
+ * @returns Customer credits result or error result
3820
+ */
3821
+ declare function getCustomerBalanceCore(request: Request, options?: {
3822
+ solvaPay?: SolvaPay;
3823
+ }): Promise<CustomerBalanceResult | ErrorResult>;
4609
3824
 
4610
3825
  /**
4611
- * Create a Stripe payment intent for a customer to purchase a plan.
3826
+ * Create a payment intent for a customer to purchase a plan.
4612
3827
  *
4613
3828
  * This is a framework-agnostic helper that:
4614
3829
  * 1. Extracts authenticated user from the request
4615
3830
  * 2. Syncs customer with SolvaPay backend
4616
3831
  * 3. Creates a payment intent for the specified plan
4617
3832
  *
4618
- * The payment intent can then be confirmed on the client side using Stripe.js.
3833
+ * The payment intent can then be confirmed on the client side.
4619
3834
  * After confirmation, use `processPaymentIntentCore()` to complete the purchase.
4620
3835
  *
4621
3836
  * @param request - Standard Web API Request object
@@ -4655,24 +3870,53 @@ declare function createPaymentIntentCore(request: Request, body: {
4655
3870
  includeEmail?: boolean;
4656
3871
  includeName?: boolean;
4657
3872
  }): Promise<{
4658
- id: string;
3873
+ processorPaymentId: string;
3874
+ clientSecret: string;
3875
+ publishableKey: string;
3876
+ accountId?: string;
3877
+ customerRef: string;
3878
+ } | ErrorResult>;
3879
+ /**
3880
+ * Create a payment intent for a credit top-up.
3881
+ *
3882
+ * Unlike `createPaymentIntentCore`, this does not require a product or plan.
3883
+ * After client-side payment confirmation, credits are recorded via webhook —
3884
+ * no `processPaymentIntentCore` call is needed.
3885
+ *
3886
+ * @param request - Standard Web API Request object
3887
+ * @param body - Top-up parameters
3888
+ * @param body.amount - Amount in smallest currency unit (e.g. cents). Must be > 0
3889
+ * @param body.currency - ISO 4217 currency code (e.g. 'usd')
3890
+ * @param body.description - Optional description for the payment intent
3891
+ * @param options - Configuration options
3892
+ * @returns Payment intent response with client secret and customer reference, or error result
3893
+ */
3894
+ declare function createTopupPaymentIntentCore(request: Request, body: {
3895
+ amount: number;
3896
+ currency: string;
3897
+ description?: string;
3898
+ }, options?: {
3899
+ solvaPay?: SolvaPay;
3900
+ includeEmail?: boolean;
3901
+ includeName?: boolean;
3902
+ }): Promise<{
3903
+ processorPaymentId: string;
4659
3904
  clientSecret: string;
4660
3905
  publishableKey: string;
4661
3906
  accountId?: string;
4662
3907
  customerRef: string;
4663
3908
  } | ErrorResult>;
4664
3909
  /**
4665
- * Process a payment intent after client-side Stripe confirmation.
3910
+ * Process a payment intent after client-side payment confirmation.
4666
3911
  *
4667
3912
  * This helper processes a payment intent that has been confirmed on the client
4668
- * side using Stripe.js. It creates the purchase immediately,
4669
- * eliminating webhook delay.
3913
+ * side. It creates the purchase immediately, eliminating webhook delay.
4670
3914
  *
4671
- * Call this after the client has confirmed the payment intent with Stripe.js.
3915
+ * Call this after the client has confirmed the payment intent.
4672
3916
  *
4673
3917
  * @param request - Standard Web API Request object
4674
3918
  * @param body - Payment processing parameters
4675
- * @param body.paymentIntentId - Stripe payment intent ID from client confirmation (required)
3919
+ * @param body.paymentIntentId - Processor payment ID from client confirmation (required)
4676
3920
  * @param body.productRef - Product reference (required)
4677
3921
  * @param body.planRef - Optional plan reference (if not in payment intent)
4678
3922
  * @param options - Configuration options
@@ -4751,9 +3995,9 @@ declare function createCustomerSessionCore(request: Request, options?: {
4751
3995
  } | ErrorResult>;
4752
3996
 
4753
3997
  /**
4754
- * Purchase Cancellation Helpers (Core)
3998
+ * Purchase Cancellation & Reactivation Helpers (Core)
4755
3999
  *
4756
- * Generic helpers for purchase cancellation operations.
4000
+ * Generic helpers for purchase cancellation and reactivation operations.
4757
4001
  * Works with standard Web API Request (works everywhere).
4758
4002
  */
4759
4003
 
@@ -4771,6 +4015,31 @@ declare function cancelPurchaseCore(request: Request, body: {
4771
4015
  }, options?: {
4772
4016
  solvaPay?: SolvaPay;
4773
4017
  }): Promise<Record<string, unknown> | ErrorResult>;
4018
+ /**
4019
+ * Reactivate purchase - core implementation
4020
+ *
4021
+ * Undoes a pending cancellation, restoring auto-renewal and clearing cancellation fields.
4022
+ * Only works while the purchase is still active and the end date hasn't passed.
4023
+ *
4024
+ * @param request - Standard Web API Request
4025
+ * @param body - Reactivation parameters
4026
+ * @param options - Configuration options
4027
+ * @returns Reactivated purchase response or error result
4028
+ */
4029
+ declare function reactivatePurchaseCore(request: Request, body: {
4030
+ purchaseRef: string;
4031
+ }, options?: {
4032
+ solvaPay?: SolvaPay;
4033
+ }): Promise<Record<string, unknown> | ErrorResult>;
4034
+
4035
+ declare function activatePlanCore(request: Request, body: {
4036
+ productRef: string;
4037
+ planRef: string;
4038
+ }, options?: {
4039
+ solvaPay?: SolvaPay;
4040
+ includeEmail?: boolean;
4041
+ includeName?: boolean;
4042
+ }): Promise<ActivatePlanResult | ErrorResult>;
4774
4043
 
4775
4044
  /**
4776
4045
  * Plans Helper (Core)
@@ -4780,14 +4049,64 @@ declare function cancelPurchaseCore(request: Request, body: {
4780
4049
  * This is a public route - no authentication required.
4781
4050
  */
4782
4051
 
4052
+ type Plan = components['schemas']['Plan'];
4783
4053
  /**
4784
- * List plans - core implementation
4054
+ * List plans - core implementation.
4055
+ *
4056
+ * Pass `options.solvaPay` to route through a pre-configured SolvaPay instance
4057
+ * (e.g. stub-backed in examples). When omitted, the helper reads
4058
+ * `SOLVAPAY_SECRET_KEY` from environment and constructs a real API client.
4785
4059
  */
4786
- declare function listPlansCore(request: Request): Promise<{
4787
- plans: Record<string, unknown>[];
4060
+ declare function listPlansCore(request: Request, options?: {
4061
+ solvaPay?: SolvaPay;
4062
+ }): Promise<{
4063
+ plans: Plan[];
4788
4064
  productRef: string;
4789
4065
  } | ErrorResult>;
4790
4066
 
4067
+ interface PurchaseCheckResult {
4068
+ customerRef: string;
4069
+ email?: string;
4070
+ name?: string;
4071
+ purchases: Array<{
4072
+ reference: string;
4073
+ productName?: string;
4074
+ productRef?: string;
4075
+ status?: string;
4076
+ startDate?: string;
4077
+ planSnapshot?: {
4078
+ meterId?: string;
4079
+ limit?: number;
4080
+ freeUnits?: number;
4081
+ };
4082
+ usage?: {
4083
+ used?: number;
4084
+ overageUnits?: number;
4085
+ overageCost?: number;
4086
+ periodStart?: string;
4087
+ periodEnd?: string;
4088
+ };
4089
+ [key: string]: unknown;
4090
+ }>;
4091
+ }
4092
+ declare function checkPurchaseCore(request: Request, options?: {
4093
+ solvaPay?: SolvaPay;
4094
+ includeEmail?: boolean;
4095
+ includeName?: boolean;
4096
+ }): Promise<PurchaseCheckResult | ErrorResult>;
4097
+
4098
+ declare function trackUsageCore(request: Request, body: {
4099
+ actionType?: 'transaction' | 'api_call' | 'hour' | 'email' | 'storage' | 'custom';
4100
+ units?: number;
4101
+ productRef?: string;
4102
+ description?: string;
4103
+ metadata?: Record<string, unknown>;
4104
+ }, options?: {
4105
+ solvaPay?: SolvaPay;
4106
+ }): Promise<{
4107
+ success: true;
4108
+ } | ErrorResult>;
4109
+
4791
4110
  /**
4792
4111
  * SolvaPay Server SDK - Edge Runtime Entry Point
4793
4112
  *
@@ -4801,4 +4120,4 @@ declare function verifyWebhook({ body, signature, secret, }: {
4801
4120
  secret: string;
4802
4121
  }): Promise<WebhookEvent>;
4803
4122
 
4804
- export { type AuthenticatedUser, type CreateSolvaPayConfig, type CustomerWebhookObject, type ErrorResult, type HttpAdapterOptions, type McpAdapterOptions, type NextAdapterOptions, type PayableFunction, type PayableOptions, type PaywallArgs, PaywallError, type PaywallMetadata, type PaywallStructuredContent, type PaywallToolResult, type RetryOptions, type ServerClientOptions, type SolvaPay, type SolvaPayClient, type WebhookEvent, type WebhookEventForType, type WebhookEventObjectMap, type WebhookEventType, type WebhookProduct, cancelPurchaseCore, createCheckoutSessionCore, createCustomerSessionCore, createPaymentIntentCore, createSolvaPay, createSolvaPayClient, getAuthenticatedUserCore, handleRouteError, isErrorResult, listPlansCore, processPaymentIntentCore, syncCustomerCore, verifyWebhook, withRetry };
4123
+ export { type AuthenticatedUser, type CreateSolvaPayConfig, type CustomerBalanceResult, type CustomerWebhookObject, type ErrorResult, type HttpAdapterOptions, type LimitActivationBalance, type LimitActivationProduct, type LimitPlanSummary, type McpAdapterOptions, type NextAdapterOptions, type PayableFunction, type PayableOptions, type PaywallArgs, PaywallError, type PaywallMetadata, type PaywallStructuredContent, type PaywallToolResult, type PurchaseCheckResult, type RetryOptions, type ServerClientOptions, type SolvaPay, type SolvaPayClient, type WebhookEvent, type WebhookEventForType, type WebhookEventObjectMap, type WebhookEventType, type WebhookProduct, activatePlanCore, cancelPurchaseCore, checkPurchaseCore, createCheckoutSessionCore, createCustomerSessionCore, createPaymentIntentCore, createSolvaPay, createSolvaPayClient, createTopupPaymentIntentCore, getAuthenticatedUserCore, getCustomerBalanceCore, handleRouteError, isErrorResult, listPlansCore, paywallErrorToClientPayload, processPaymentIntentCore, reactivatePurchaseCore, syncCustomerCore, trackUsageCore, verifyWebhook, withRetry };