@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/index.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,10 +742,10 @@ 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
@@ -1630,44 +757,12 @@ interface components {
1630
757
  */
1631
758
  freeUnits?: number;
1632
759
  /**
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;
1659
- /**
1660
- * Period end date
1661
- * @example 2025-11-01T00:00:00Z
760
+ * Credits per usage unit (integer, >= 1)
761
+ * @example 1
1662
762
  */
1663
- periodEnd?: string;
763
+ creditsPerUnit?: number;
1664
764
  };
1665
- PurchaseResponse: {
1666
- /**
1667
- * Purchase ID
1668
- * @example 507f1f77bcf86cd799439011
1669
- */
1670
- id: string;
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,279 +837,340 @@ 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: {
852
+ customerRef: string;
853
+ productRef: string;
854
+ meterName?: string;
855
+ usageType?: string;
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
+ };
884
+ LimitResponse: {
1754
885
  /**
1755
- * Customer reference identifier
1756
- * @example cus_3C4D5E6F
886
+ * Whether the customer is within their usage limits
887
+ * @example true
1757
888
  */
1758
- customerRef: string;
889
+ withinLimits: boolean;
1759
890
  /**
1760
- * Product reference identifier
1761
- * @example prd_1A2B3C4D
891
+ * Remaining usage units before hitting the limit
892
+ * @example 997
1762
893
  */
1763
- productRef: string;
894
+ remaining: number;
1764
895
  /**
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
896
+ * Checkout session ID if payment is required
897
+ * @example e3f1c2d4b6a89f001122334455667788
1767
898
  */
1768
- planRef?: string;
899
+ checkoutSessionId?: string;
900
+ /**
901
+ * Checkout URL if payment is required
902
+ * @example https://solvapay.com/customer/checkout?id=e3f1c2d4b6a89f001122334455667788
903
+ */
904
+ checkoutUrl?: string;
1769
905
  /**
1770
- * Canonical usage meter name used for limit checks (for example: requests, tokens).
906
+ * The meter name to use when tracking usage events
1771
907
  * @example requests
1772
908
  */
1773
- meterName?: string;
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;
956
+ };
957
+ PurchaseInfo: {
958
+ /**
959
+ * Purchase reference
960
+ * @example pur_1A2B3C4D
961
+ */
962
+ reference: string;
963
+ /**
964
+ * Product name
965
+ * @example API Gateway Manager
966
+ */
967
+ productName: string;
968
+ /**
969
+ * Product reference
970
+ * @example prd_abc123
971
+ */
972
+ productRef?: string;
973
+ /**
974
+ * Purchase status
975
+ * @example active
976
+ */
977
+ status: string;
978
+ /**
979
+ * Start date
980
+ * @example 2025-10-27T10:00:00Z
981
+ */
982
+ startDate: string;
1774
983
  /**
1775
- * Usage type alias for meterName. If both are provided, meterName takes precedence.
1776
- * @example requests
984
+ * Amount in USD cents (normalised for aggregation)
985
+ * @example 9900
1777
986
  */
1778
- usageType?: string;
1779
- };
1780
- LimitResponse: {
987
+ amount: number;
1781
988
  /**
1782
- * Whether the customer is within their usage limits
1783
- * @example true
989
+ * Original amount in the payment currency (minor units)
990
+ * @example 7500
1784
991
  */
1785
- withinLimits: boolean;
992
+ originalAmount?: number;
1786
993
  /**
1787
- * Remaining usage units before hitting the limit
1788
- * @example 997
994
+ * ISO 4217 currency code of the customer-facing charge
995
+ * @example GBP
1789
996
  */
1790
- remaining: number;
997
+ currency: string;
1791
998
  /**
1792
- * Checkout session ID if payment is required
1793
- * @example e3f1c2d4b6a89f001122334455667788
999
+ * Exchange rate from original currency to USD
1000
+ * @example 1.32
1794
1001
  */
1795
- checkoutSessionId?: string;
1002
+ exchangeRate?: number;
1796
1003
  /**
1797
- * Checkout URL if payment is required
1798
- * @example https://solvapay.com/customer/checkout?id=e3f1c2d4b6a89f001122334455667788
1004
+ * End date of purchase
1005
+ * @example 2025-11-27T10:00:00Z
1799
1006
  */
1800
- checkoutUrl?: string;
1007
+ endDate?: string;
1801
1008
  /**
1802
- * The meter name to use when tracking usage events
1803
- * @example requests
1009
+ * When purchase was cancelled
1010
+ * @example 2025-10-28T10:00:00Z
1804
1011
  */
1805
- meterName?: string;
1806
- };
1807
- ExecuteAnalyticsQuery: Record<string, never>;
1808
- ExecuteMultipleQueries: Record<string, never>;
1809
- CreateWebhookEndpointDto: {
1012
+ cancelledAt?: string;
1810
1013
  /**
1811
- * Webhook endpoint URL
1812
- * @example https://example.com/webhook
1014
+ * Reason for cancellation
1015
+ * @example Customer request
1813
1016
  */
1814
- url: string;
1017
+ cancellationReason?: string;
1815
1018
  /**
1816
- * Webhook endpoint description
1817
- * @example Production webhook
1019
+ * Plan reference from the plan snapshot, for reliable plan matching
1020
+ * @example pln_abc123
1818
1021
  */
1819
- description?: string;
1022
+ planRef?: string;
1023
+ /** @description Snapshot of the plan at time of purchase */
1024
+ planSnapshot?: Record<string, never>;
1820
1025
  };
1821
- UpdateWebhookEndpointDto: {
1026
+ CustomerResponse: {
1822
1027
  /**
1823
- * Webhook endpoint URL
1824
- * @example https://example.com/webhook
1028
+ * Customer reference identifier
1029
+ * @example cus_3c4d5e6f7g8h
1825
1030
  */
1826
- url?: string;
1031
+ reference: string;
1827
1032
  /**
1828
- * Webhook endpoint description
1829
- * @example Updated webhook
1033
+ * Customer full name
1034
+ * @example John Doe
1830
1035
  */
1831
- description?: string;
1832
- };
1833
- UpdateThemePreferenceDto: {
1036
+ name: string;
1834
1037
  /**
1835
- * Selected UI theme mode
1836
- * @example dark
1837
- * @enum {string}
1038
+ * Customer email address
1039
+ * @example customer@example.com
1838
1040
  */
1839
- mode: "light" | "dark";
1840
- };
1841
- ThemeModeColorsDto: {
1041
+ email: string;
1842
1042
  /**
1843
- * Page background color
1844
- * @example #f7f7f8
1043
+ * External reference ID from your auth system (if set during creation or update)
1044
+ * @example auth_user_12345
1845
1045
  */
1846
- background?: string;
1046
+ externalRef?: string;
1047
+ /** @description Active purchases */
1048
+ purchases?: components["schemas"]["PurchaseInfo"][];
1049
+ };
1050
+ CreateCustomerSessionResponse: {
1847
1051
  /**
1848
- * Card/surface background color
1849
- * @example #ffffff
1052
+ * Customer session ID/token
1053
+ * @example e3f1c2d4b6a89f001122334455667788
1850
1054
  */
1851
- surface?: string;
1055
+ sessionId: string;
1852
1056
  /**
1853
- * Primary text color
1854
- * @example #181818
1057
+ * Full customer URL based on backend configuration (ready to redirect customer)
1058
+ * @example https://solvapay.com/customer/manage?id=e3f1c2d4b6a89f001122334455667788
1855
1059
  */
1856
- text?: string;
1060
+ customerUrl: string;
1061
+ };
1062
+ GetCustomerSessionResponse: {
1857
1063
  /**
1858
- * Secondary/muted text color
1859
- * @example #5c5c5c
1064
+ * Customer session ID/token
1065
+ * @example e3f1c2d4b6a89f001122334455667788
1860
1066
  */
1861
- secondary?: string;
1862
- };
1863
- ThemeOverridesDto: {
1864
- /** @description Light mode color overrides */
1865
- light?: components["schemas"]["ThemeModeColorsDto"];
1866
- /** @description Dark mode color overrides */
1867
- dark?: components["schemas"]["ThemeModeColorsDto"];
1868
- };
1869
- UpdateBrandThemeDto: {
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,24 +1857,121 @@ interface operations {
2783
1857
  };
2784
1858
  requestBody: {
2785
1859
  content: {
2786
- "application/json": components["schemas"]["RecordMeterEventDto"];
1860
+ "application/json": components["schemas"]["RecordMeterEventZodDto"];
1861
+ };
1862
+ };
1863
+ responses: {
1864
+ /** @description Event recorded */
1865
+ 200: {
1866
+ headers: {
1867
+ [name: string]: unknown;
1868
+ };
1869
+ content: {
1870
+ "application/json": {
1871
+ /** @example true */
1872
+ success?: boolean;
1873
+ };
1874
+ };
1875
+ };
1876
+ /** @description Invalid meter name or meter is archived */
1877
+ 400: {
1878
+ headers: {
1879
+ [name: string]: unknown;
1880
+ };
1881
+ content?: never;
1882
+ };
1883
+ };
1884
+ };
1885
+ MeterEventsSdkController_recordBulkEvents: {
1886
+ parameters: {
1887
+ query?: never;
1888
+ header?: never;
1889
+ path?: never;
1890
+ cookie?: never;
1891
+ };
1892
+ requestBody: {
1893
+ content: {
1894
+ "application/json": components["schemas"]["RecordBulkMeterEventsZodDto"];
1895
+ };
1896
+ };
1897
+ responses: {
1898
+ /** @description Events recorded */
1899
+ 200: {
1900
+ headers: {
1901
+ [name: string]: unknown;
1902
+ };
1903
+ content: {
1904
+ "application/json": {
1905
+ /** @example true */
1906
+ success?: boolean;
1907
+ /** @example 50 */
1908
+ inserted?: number;
1909
+ };
1910
+ };
1911
+ };
1912
+ /** @description Invalid meter name or meter is archived */
1913
+ 400: {
1914
+ headers: {
1915
+ [name: string]: unknown;
1916
+ };
1917
+ content?: never;
1918
+ };
1919
+ };
1920
+ };
1921
+ PurchaseSdkController_listPurchases: {
1922
+ parameters: {
1923
+ query?: {
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;
1930
+ };
1931
+ header?: never;
1932
+ path?: never;
1933
+ cookie?: never;
1934
+ };
1935
+ requestBody?: never;
1936
+ responses: {
1937
+ /** @description Purchases retrieved successfully */
1938
+ 200: {
1939
+ headers: {
1940
+ [name: string]: unknown;
1941
+ };
1942
+ content: {
1943
+ "application/json": {
1944
+ purchases?: components["schemas"]["SdkPurchaseResponse"][];
1945
+ };
1946
+ };
1947
+ };
1948
+ };
1949
+ };
1950
+ PurchaseSdkController_getPurchasesForCustomer: {
1951
+ parameters: {
1952
+ query?: never;
1953
+ header?: never;
1954
+ path: {
1955
+ /** @description Customer reference or ID */
1956
+ customerRef: string;
2787
1957
  };
1958
+ cookie?: never;
2788
1959
  };
1960
+ requestBody?: never;
2789
1961
  responses: {
2790
- /** @description Event recorded */
1962
+ /** @description Customer purchases retrieved successfully */
2791
1963
  200: {
2792
1964
  headers: {
2793
1965
  [name: string]: unknown;
2794
1966
  };
2795
1967
  content: {
2796
1968
  "application/json": {
2797
- /** @example true */
2798
- success?: boolean;
1969
+ purchases?: components["schemas"]["SdkPurchaseResponse"][];
2799
1970
  };
2800
1971
  };
2801
1972
  };
2802
- /** @description Invalid meter name or meter is archived */
2803
- 400: {
1973
+ /** @description Customer not found */
1974
+ 404: {
2804
1975
  headers: {
2805
1976
  [name: string]: unknown;
2806
1977
  };
@@ -2808,35 +1979,31 @@ interface operations {
2808
1979
  };
2809
1980
  };
2810
1981
  };
2811
- MeterEventsSdkController_recordBulkEvents: {
1982
+ PurchaseSdkController_getPurchasesForProduct: {
2812
1983
  parameters: {
2813
1984
  query?: never;
2814
1985
  header?: never;
2815
- path?: never;
2816
- cookie?: never;
2817
- };
2818
- requestBody: {
2819
- content: {
2820
- "application/json": components["schemas"]["RecordBulkMeterEventsDto"];
1986
+ path: {
1987
+ /** @description Product reference or ID */
1988
+ productRef: string;
2821
1989
  };
1990
+ cookie?: never;
2822
1991
  };
1992
+ requestBody?: never;
2823
1993
  responses: {
2824
- /** @description Events recorded */
1994
+ /** @description Product purchases retrieved successfully */
2825
1995
  200: {
2826
1996
  headers: {
2827
1997
  [name: string]: unknown;
2828
1998
  };
2829
1999
  content: {
2830
2000
  "application/json": {
2831
- /** @example true */
2832
- success?: boolean;
2833
- /** @example 50 */
2834
- inserted?: number;
2001
+ purchases?: components["schemas"]["SdkPurchaseResponse"][];
2835
2002
  };
2836
2003
  };
2837
2004
  };
2838
- /** @description Invalid meter name or meter is archived */
2839
- 400: {
2005
+ /** @description Product not found */
2006
+ 404: {
2840
2007
  headers: {
2841
2008
  [name: string]: unknown;
2842
2009
  };
@@ -2844,280 +2011,272 @@ interface operations {
2844
2011
  };
2845
2012
  };
2846
2013
  };
2847
- CustomerSdkController_getCustomerByQuery: {
2014
+ PurchaseSdkController_getPurchase: {
2848
2015
  parameters: {
2849
- 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;
2856
- };
2016
+ query?: never;
2857
2017
  header?: never;
2858
- path?: never;
2018
+ path: {
2019
+ /** @description Purchase reference or ID */
2020
+ purchaseRef: string;
2021
+ };
2859
2022
  cookie?: never;
2860
2023
  };
2861
2024
  requestBody?: never;
2862
2025
  responses: {
2863
- /** @description Customer retrieved successfully */
2026
+ /** @description Purchase retrieved successfully */
2864
2027
  200: {
2865
2028
  headers: {
2866
2029
  [name: string]: unknown;
2867
2030
  };
2868
2031
  content: {
2869
- "application/json": components["schemas"]["CustomerResponse"];
2870
- };
2871
- };
2872
- /** @description Invalid request - must provide exactly one of reference, externalRef, or email */
2873
- 400: {
2874
- headers: {
2875
- [name: string]: unknown;
2876
- };
2877
- content: {
2878
- "application/json": unknown;
2032
+ "application/json": components["schemas"]["SdkPurchaseResponse"];
2879
2033
  };
2880
2034
  };
2881
- /** @description Customer not found */
2035
+ /** @description Purchase not found */
2882
2036
  404: {
2883
2037
  headers: {
2884
2038
  [name: string]: unknown;
2885
2039
  };
2886
- content: {
2887
- "application/json": unknown;
2888
- };
2040
+ content?: never;
2889
2041
  };
2890
2042
  };
2891
2043
  };
2892
- CustomerSdkController_createCustomer: {
2044
+ PurchaseSdkController_cancelPurchase: {
2893
2045
  parameters: {
2894
2046
  query?: never;
2895
2047
  header?: never;
2896
- path?: never;
2048
+ path: {
2049
+ /** @description Purchase reference or ID */
2050
+ purchaseRef: string;
2051
+ };
2897
2052
  cookie?: never;
2898
2053
  };
2899
- /** @description Customer creation data */
2900
2054
  requestBody: {
2901
2055
  content: {
2902
- "application/json": components["schemas"]["CreateCustomerRequest"];
2056
+ "application/json": components["schemas"]["CancelPurchaseRequest"];
2903
2057
  };
2904
2058
  };
2905
2059
  responses: {
2906
- /** @description Customer created successfully */
2907
- 201: {
2060
+ /** @description Purchase cancelled successfully */
2061
+ 200: {
2908
2062
  headers: {
2909
2063
  [name: string]: unknown;
2910
2064
  };
2911
2065
  content: {
2912
- "application/json": components["schemas"]["CustomerResponse"];
2066
+ "application/json": {
2067
+ success?: boolean;
2068
+ purchase?: components["schemas"]["SdkPurchaseResponse"];
2069
+ };
2913
2070
  };
2914
2071
  };
2915
- /** @description Invalid email or missing required fields */
2916
- 400: {
2072
+ /** @description Purchase not found */
2073
+ 404: {
2917
2074
  headers: {
2918
2075
  [name: string]: unknown;
2919
2076
  };
2920
- content: {
2921
- "application/json": unknown;
2922
- };
2077
+ content?: never;
2923
2078
  };
2924
2079
  };
2925
2080
  };
2926
- CustomerSdkController_getCustomer: {
2081
+ PurchaseSdkController_reactivatePurchase: {
2927
2082
  parameters: {
2928
2083
  query?: never;
2929
2084
  header?: never;
2930
2085
  path: {
2931
- /** @description Customer reference identifier */
2932
- reference: string;
2086
+ /** @description Purchase reference or ID */
2087
+ purchaseRef: string;
2933
2088
  };
2934
2089
  cookie?: never;
2935
2090
  };
2936
2091
  requestBody?: never;
2937
2092
  responses: {
2938
- /** @description Customer retrieved successfully */
2093
+ /** @description Purchase reactivated successfully */
2939
2094
  200: {
2940
2095
  headers: {
2941
2096
  [name: string]: unknown;
2942
2097
  };
2943
2098
  content: {
2944
- "application/json": components["schemas"]["CustomerResponse"];
2099
+ "application/json": {
2100
+ success?: boolean;
2101
+ purchase?: components["schemas"]["SdkPurchaseResponse"];
2102
+ };
2945
2103
  };
2946
2104
  };
2947
- /** @description Customer not found */
2948
- 404: {
2105
+ /** @description Purchase cannot be reactivated */
2106
+ 400: {
2949
2107
  headers: {
2950
2108
  [name: string]: unknown;
2951
2109
  };
2952
- content: {
2953
- "application/json": unknown;
2110
+ content?: never;
2111
+ };
2112
+ /** @description Purchase not found */
2113
+ 404: {
2114
+ headers: {
2115
+ [name: string]: unknown;
2954
2116
  };
2117
+ content?: never;
2955
2118
  };
2956
2119
  };
2957
2120
  };
2958
- CustomerSdkController_createCustomerSession: {
2121
+ LimitsSdkController_checkLimits: {
2959
2122
  parameters: {
2960
2123
  query?: never;
2961
2124
  header?: never;
2962
2125
  path?: never;
2963
2126
  cookie?: never;
2964
2127
  };
2965
- /** @description Customer session creation request data */
2966
2128
  requestBody: {
2967
2129
  content: {
2968
- "application/json": components["schemas"]["CreateCustomerSessionRequest"];
2130
+ "application/json": components["schemas"]["CheckLimitRequest"];
2969
2131
  };
2970
2132
  };
2971
2133
  responses: {
2972
- /** @description Customer session created successfully */
2973
- 201: {
2134
+ /** @description Limit check result */
2135
+ 200: {
2974
2136
  headers: {
2975
2137
  [name: string]: unknown;
2976
2138
  };
2977
2139
  content: {
2978
- "application/json": components["schemas"]["CreateCustomerSessionResponse"];
2140
+ "application/json": components["schemas"]["LimitResponse"];
2979
2141
  };
2980
2142
  };
2981
- /** @description Invalid request data or customer not found */
2143
+ /** @description Missing customerRef or productRef */
2982
2144
  400: {
2983
2145
  headers: {
2984
2146
  [name: string]: unknown;
2985
2147
  };
2986
- content: {
2987
- "application/json": unknown;
2988
- };
2148
+ content?: never;
2989
2149
  };
2990
- /** @description Customer not found */
2150
+ /** @description Customer or product not found */
2991
2151
  404: {
2992
2152
  headers: {
2993
2153
  [name: string]: unknown;
2994
2154
  };
2995
- content: {
2996
- "application/json": unknown;
2997
- };
2155
+ content?: never;
2998
2156
  };
2999
2157
  };
3000
2158
  };
3001
- CustomerSdkController_getCustomerSession: {
2159
+ ActivateSdkController_activate: {
3002
2160
  parameters: {
3003
2161
  query?: never;
3004
2162
  header?: never;
3005
- path: {
3006
- /** @description Customer session ID/token */
3007
- sessionId: string;
3008
- };
2163
+ path?: never;
3009
2164
  cookie?: never;
3010
2165
  };
3011
- requestBody?: never;
2166
+ requestBody: {
2167
+ content: {
2168
+ "application/json": components["schemas"]["ActivatePlanDto"];
2169
+ };
2170
+ };
3012
2171
  responses: {
3013
- /** @description Customer session retrieved successfully */
3014
2172
  200: {
3015
2173
  headers: {
3016
2174
  [name: string]: unknown;
3017
2175
  };
3018
2176
  content: {
3019
- "application/json": components["schemas"]["GetCustomerSessionResponse"];
3020
- };
3021
- };
3022
- /** @description Customer session not found */
3023
- 404: {
3024
- headers: {
3025
- [name: string]: unknown;
3026
- };
3027
- content: {
3028
- "application/json": unknown;
2177
+ "application/json": components["schemas"]["ActivatePlanResponseDto"];
3029
2178
  };
3030
2179
  };
3031
2180
  };
3032
2181
  };
3033
- UserInfoSdkController_getUserInfo: {
2182
+ CustomerSdkController_getCustomerByQuery: {
3034
2183
  parameters: {
3035
- query?: never;
2184
+ query?: {
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;
2191
+ };
3036
2192
  header?: never;
3037
2193
  path?: never;
3038
2194
  cookie?: never;
3039
2195
  };
3040
- requestBody: {
3041
- content: {
3042
- "application/json": components["schemas"]["UserInfoRequest"];
3043
- };
3044
- };
2196
+ requestBody?: never;
3045
2197
  responses: {
3046
- /** @description User info with purchase status */
2198
+ /** @description Customer retrieved successfully */
3047
2199
  200: {
3048
2200
  headers: {
3049
2201
  [name: string]: unknown;
3050
2202
  };
3051
2203
  content: {
3052
- "application/json": components["schemas"]["UserInfoResponse"];
2204
+ "application/json": components["schemas"]["CustomerResponse"];
3053
2205
  };
3054
2206
  };
3055
- /** @description Missing customerRef or productRef */
2207
+ /** @description Invalid request - must provide exactly one of reference, externalRef, or email */
3056
2208
  400: {
3057
2209
  headers: {
3058
2210
  [name: string]: unknown;
3059
2211
  };
3060
- content?: never;
2212
+ content: {
2213
+ "application/json": unknown;
2214
+ };
3061
2215
  };
3062
- /** @description Customer or product not found */
2216
+ /** @description Customer not found */
3063
2217
  404: {
3064
2218
  headers: {
3065
2219
  [name: string]: unknown;
3066
2220
  };
3067
- content?: never;
2221
+ content: {
2222
+ "application/json": unknown;
2223
+ };
3068
2224
  };
3069
2225
  };
3070
2226
  };
3071
- PurchaseSdkController_listPurchases: {
2227
+ CustomerSdkController_createCustomer: {
3072
2228
  parameters: {
3073
- 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;
3080
- };
2229
+ query?: never;
3081
2230
  header?: never;
3082
2231
  path?: never;
3083
2232
  cookie?: never;
3084
2233
  };
3085
- requestBody?: never;
2234
+ /** @description Customer creation data */
2235
+ requestBody: {
2236
+ content: {
2237
+ "application/json": components["schemas"]["CreateCustomerRequest"];
2238
+ };
2239
+ };
3086
2240
  responses: {
3087
- /** @description Purchases retrieved successfully */
3088
- 200: {
2241
+ /** @description Customer created successfully */
2242
+ 201: {
3089
2243
  headers: {
3090
2244
  [name: string]: unknown;
3091
2245
  };
3092
2246
  content: {
3093
- "application/json": {
3094
- purchases?: components["schemas"]["PurchaseResponse"][];
3095
- };
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;
3096
2257
  };
3097
2258
  };
3098
2259
  };
3099
2260
  };
3100
- PurchaseSdkController_getPurchasesForCustomer: {
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
2297
  path: {
3137
- /** @description Product reference or ID */
3138
- productRef: string;
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,41 @@ 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 McpBootstrapPlanInput = NonNullable<components['schemas']['McpBootstrapDto']['plans']>[number];
2512
+ type ToolPlanMappingInput = NonNullable<components['schemas']['McpBootstrapDto']['tools']>[number];
2513
+ type McpBootstrapRequest = components['schemas']['McpBootstrapDto'];
2514
+ type McpToolPlanMappingInput = NonNullable<components['schemas']['ConfigureMcpPlansDto']['toolMapping']>[number];
3370
2515
  interface McpBootstrapResponse {
3371
2516
  product: components['schemas']['SdkProductResponse'];
3372
2517
  mcpServer: {
3373
- id?: string;
3374
2518
  reference?: string;
3375
2519
  subdomain?: string;
3376
2520
  mcpProxyUrl?: string;
3377
2521
  url: string;
3378
- defaultPlanId?: string;
2522
+ defaultPlanRef?: string;
3379
2523
  };
3380
2524
  planMap: Record<string, {
3381
- id: string;
3382
2525
  reference: string;
3383
2526
  name?: string;
3384
2527
  }>;
@@ -3388,22 +2531,17 @@ interface McpBootstrapResponse {
3388
2531
  description?: string;
3389
2532
  }>;
3390
2533
  }
3391
- interface ConfigureMcpPlansRequest {
3392
- paidPlans?: McpBootstrapPaidPlanInput[];
3393
- toolMapping?: McpToolPlanMappingInput[];
3394
- }
2534
+ type ConfigureMcpPlansRequest = components['schemas']['ConfigureMcpPlansDto'];
3395
2535
  interface ConfigureMcpPlansResponse {
3396
2536
  product: components['schemas']['SdkProductResponse'];
3397
2537
  mcpServer: {
3398
- id?: string;
3399
2538
  reference?: string;
3400
2539
  subdomain?: string;
3401
2540
  mcpProxyUrl?: string;
3402
2541
  url: string;
3403
- defaultPlanId?: string;
2542
+ defaultPlanRef?: string;
3404
2543
  };
3405
2544
  planMap: Record<string, {
3406
- id: string;
3407
2545
  reference: string;
3408
2546
  name?: string;
3409
2547
  }>;
@@ -3422,8 +2560,8 @@ interface SolvaPayClient {
3422
2560
  actionType?: 'transaction' | 'api_call' | 'hour' | 'email' | 'storage' | 'custom';
3423
2561
  units?: number;
3424
2562
  outcome?: 'success' | 'paywall' | 'fail';
3425
- productReference?: string;
3426
- purchaseReference?: string;
2563
+ productRef?: string;
2564
+ purchaseRef?: string;
3427
2565
  description?: string;
3428
2566
  metadata?: Record<string, unknown>;
3429
2567
  duration?: number;
@@ -3438,6 +2576,13 @@ interface SolvaPayClient {
3438
2576
  externalRef?: string;
3439
2577
  email?: string;
3440
2578
  }): Promise<CustomerResponseMapped>;
2579
+ /**
2580
+ * SDK-facing merchant identity (GET /v1/sdk/merchant).
2581
+ * Returns the subset of provider fields safe for browser consumption —
2582
+ * used by `<MandateText>`, `<CheckoutSummary>`, and trust signals.
2583
+ */
2584
+ getMerchant?(): Promise<SdkMerchantResponse>;
2585
+ getProduct?(productRef: string): Promise<SdkProductResponse>;
3441
2586
  listProducts?(): Promise<Array<{
3442
2587
  reference: string;
3443
2588
  name: string;
@@ -3458,29 +2603,11 @@ interface SolvaPayClient {
3458
2603
  reference: string;
3459
2604
  name: string;
3460
2605
  }>;
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
- }>>;
2606
+ listPlans?(productRef: string): Promise<components['schemas']['Plan'][]>;
3475
2607
  createPlan?(params: components['schemas']['CreatePlanRequest'] & {
3476
2608
  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
- }>;
2609
+ }): Promise<components['schemas']['Plan']>;
2610
+ updatePlan?(productRef: string, planRef: string, params: components['schemas']['UpdatePlanRequest']): Promise<components['schemas']['Plan']>;
3484
2611
  deletePlan?(productRef: string, planRef: string): Promise<void>;
3485
2612
  createPaymentIntent?(params: {
3486
2613
  productRef: string;
@@ -3488,7 +2615,19 @@ interface SolvaPayClient {
3488
2615
  customerRef: string;
3489
2616
  idempotencyKey?: string;
3490
2617
  }): Promise<{
3491
- id: string;
2618
+ processorPaymentId: string;
2619
+ clientSecret: string;
2620
+ publishableKey: string;
2621
+ accountId?: string;
2622
+ }>;
2623
+ createTopupPaymentIntent?(params: {
2624
+ customerRef: string;
2625
+ amount: number;
2626
+ currency: string;
2627
+ description?: string;
2628
+ idempotencyKey?: string;
2629
+ }): Promise<{
2630
+ processorPaymentId: string;
3492
2631
  clientSecret: string;
3493
2632
  publishableKey: string;
3494
2633
  accountId?: string;
@@ -3497,6 +2636,9 @@ interface SolvaPayClient {
3497
2636
  purchaseRef: string;
3498
2637
  reason?: string;
3499
2638
  }): Promise<components['schemas']['PurchaseInfo']>;
2639
+ reactivatePurchase?(params: {
2640
+ purchaseRef: string;
2641
+ }): Promise<components['schemas']['PurchaseInfo']>;
3500
2642
  processPaymentIntent?(params: {
3501
2643
  paymentIntentId: string;
3502
2644
  productRef: string;
@@ -3507,8 +2649,18 @@ interface SolvaPayClient {
3507
2649
  customerRef: string;
3508
2650
  productRef: string;
3509
2651
  }): Promise<components['schemas']['UserInfoResponse']>;
2652
+ getCustomerBalance?(params: {
2653
+ customerRef: string;
2654
+ }): Promise<{
2655
+ customerRef: string;
2656
+ credits: number;
2657
+ displayCurrency: string;
2658
+ creditsPerMinorUnit: number;
2659
+ displayExchangeRate: number;
2660
+ }>;
3510
2661
  createCheckoutSession(params: operations['CheckoutSessionSdkController_createCheckoutSession']['requestBody']['content']['application/json']): Promise<components['schemas']['CreateCheckoutSessionResponse']>;
3511
2662
  createCustomerSession(params: components['schemas']['CreateCustomerSessionRequest']): Promise<components['schemas']['CreateCustomerSessionResponse']>;
2663
+ activatePlan?(params: components['schemas']['ActivatePlanDto']): Promise<ActivatePlanResult>;
3512
2664
  }
3513
2665
 
3514
2666
  /**
@@ -3516,6 +2668,10 @@ interface SolvaPayClient {
3516
2668
  *
3517
2669
  * Types related to paywall protection, limits, and gating functionality.
3518
2670
  */
2671
+
2672
+ type LimitPlanSummary = components['schemas']['LimitPlanItemDto'];
2673
+ type LimitActivationBalance = components['schemas']['LimitBalanceDto'];
2674
+ type LimitActivationProduct = components['schemas']['LimitProductBriefDto'];
3519
2675
  /**
3520
2676
  * Arguments passed to protected handlers
3521
2677
  */
@@ -3530,18 +2686,32 @@ interface PaywallArgs {
3530
2686
  */
3531
2687
  interface PaywallMetadata {
3532
2688
  product?: string;
3533
- plan?: string;
3534
2689
  usageType?: 'requests' | 'tokens';
3535
2690
  }
3536
2691
  /**
3537
- * Structured content for paywall errors
2692
+ * Structured content for paywall errors (MCP structuredContent and manual handling).
3538
2693
  */
3539
- interface PaywallStructuredContent {
2694
+ type PaywallStructuredContent = {
3540
2695
  kind: 'payment_required';
2696
+ /** Product ref from paywall metadata (or env default) */
3541
2697
  product: string;
3542
2698
  checkoutUrl: string;
3543
2699
  message: string;
3544
- }
2700
+ } | {
2701
+ kind: 'activation_required';
2702
+ /** Product ref from paywall metadata (or env default) */
2703
+ product: string;
2704
+ message: string;
2705
+ /**
2706
+ * Best URL for completing purchase or confirmation; mirrors confirmationUrl when present.
2707
+ */
2708
+ checkoutUrl: string;
2709
+ confirmationUrl?: string;
2710
+ plans?: LimitPlanSummary[];
2711
+ balance?: LimitActivationBalance;
2712
+ /** Rich product context from checkLimits (name, ref, provider slug/id) */
2713
+ productDetails?: LimitActivationProduct;
2714
+ };
3545
2715
  /**
3546
2716
  * MCP tool result with optional paywall information
3547
2717
  */
@@ -3617,14 +2787,6 @@ interface PayableOptions {
3617
2787
  * Product reference (alias for product, preferred for consistency with backend API)
3618
2788
  */
3619
2789
  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
2790
  /**
3629
2791
  * Usage meter type to charge against (defaults to 'requests')
3630
2792
  */
@@ -3798,7 +2960,7 @@ interface CreateSolvaPayConfig {
3798
2960
  *
3799
2961
  * @example
3800
2962
  * ```typescript
3801
- * const payable = solvaPay.payable({ product: 'prd_myapi', plan: 'pln_premium' });
2963
+ * const payable = solvaPay.payable({ product: 'prd_myapi' });
3802
2964
  *
3803
2965
  * // Express.js
3804
2966
  * app.post('/tasks', payable.http(createTask));
@@ -3896,34 +3058,24 @@ interface PayableFunction {
3896
3058
  * const solvaPay = createSolvaPay();
3897
3059
  *
3898
3060
  * // Create payable handlers
3899
- * const payable = solvaPay.payable({ product: 'prd_myapi', plan: 'pln_premium' });
3061
+ * const payable = solvaPay.payable({ product: 'prd_myapi' });
3900
3062
  *
3901
3063
  * // Manage customers
3902
3064
  * const customerRef = await solvaPay.ensureCustomer('user_123', 'user_123', {
3903
3065
  * email: 'user@example.com'
3904
3066
  * });
3905
- *
3906
- * // Create payment intents
3907
- * const intent = await solvaPay.createPaymentIntent({
3908
- * productRef: 'prd_myapi',
3909
- * planRef: 'pln_premium',
3910
- * customerRef: 'user_123'
3911
- * });
3912
3067
  * ```
3913
3068
  */
3914
3069
  interface SolvaPay {
3915
3070
  /**
3916
3071
  * Create a payable handler with explicit adapters for different frameworks.
3917
3072
  *
3918
- * @param options - Payable options including product and plan references
3073
+ * @param options - Payable options including product reference and usage type
3919
3074
  * @returns PayableFunction with framework-specific adapters
3920
3075
  *
3921
3076
  * @example
3922
3077
  * ```typescript
3923
- * const payable = solvaPay.payable({
3924
- * product: 'prd_myapi',
3925
- * plan: 'pln_premium'
3926
- * });
3078
+ * const payable = solvaPay.payable({ product: 'prd_myapi' });
3927
3079
  *
3928
3080
  * app.post('/tasks', payable.http(createTask));
3929
3081
  * ```
@@ -3963,11 +3115,10 @@ interface SolvaPay {
3963
3115
  name?: string;
3964
3116
  }): Promise<string>;
3965
3117
  /**
3966
- * Create a Stripe payment intent for a customer to purchase a plan.
3118
+ * Create a payment intent for a customer to purchase a plan.
3967
3119
  *
3968
- * This creates a payment intent that can be confirmed on the client side
3969
- * using Stripe.js. After confirmation, call `processPaymentIntent()` to complete
3970
- * the purchase.
3120
+ * This creates a payment intent that can be confirmed on the client side.
3121
+ * After confirmation, call `processPaymentIntent()` to complete the purchase.
3971
3122
  *
3972
3123
  * @param params - Payment intent parameters
3973
3124
  * @param params.productRef - Product reference
@@ -3985,7 +3136,7 @@ interface SolvaPay {
3985
3136
  * idempotencyKey: 'unique-key-123'
3986
3137
  * });
3987
3138
  *
3988
- * // Use intent.clientSecret with Stripe.js on client
3139
+ * // Use intent.clientSecret on the client to confirm payment
3989
3140
  * ```
3990
3141
  */
3991
3142
  createPaymentIntent(params: {
@@ -3994,19 +3145,38 @@ interface SolvaPay {
3994
3145
  customerRef: string;
3995
3146
  idempotencyKey?: string;
3996
3147
  }): Promise<{
3997
- id: string;
3148
+ processorPaymentId: string;
3149
+ clientSecret: string;
3150
+ publishableKey: string;
3151
+ accountId?: string;
3152
+ }>;
3153
+ /**
3154
+ * Create a payment intent for a credit top-up.
3155
+ *
3156
+ * Unlike `createPaymentIntent`, this does not require a product or plan.
3157
+ * Credits are recorded via webhook after payment confirmation — no
3158
+ * `processPaymentIntent` call is needed.
3159
+ */
3160
+ createTopupPaymentIntent(params: {
3161
+ customerRef: string;
3162
+ amount: number;
3163
+ currency: string;
3164
+ description?: string;
3165
+ idempotencyKey?: string;
3166
+ }): Promise<{
3167
+ processorPaymentId: string;
3998
3168
  clientSecret: string;
3999
3169
  publishableKey: string;
4000
3170
  accountId?: string;
4001
3171
  }>;
4002
3172
  /**
4003
- * Process a payment intent after client-side Stripe confirmation.
3173
+ * Process a payment intent after client-side payment confirmation.
4004
3174
  *
4005
3175
  * Creates the purchase immediately, eliminating webhook delay.
4006
- * Call this after the client has confirmed the payment intent with Stripe.js.
3176
+ * Call this after the client has confirmed the payment intent.
4007
3177
  *
4008
3178
  * @param params - Payment processing parameters
4009
- * @param params.paymentIntentId - Stripe payment intent ID from client confirmation
3179
+ * @param params.paymentIntentId - Processor payment ID from client confirmation
4010
3180
  * @param params.productRef - Product reference
4011
3181
  * @param params.customerRef - Customer reference
4012
3182
  * @param params.planRef - Optional plan reference (if not in payment intent)
@@ -4014,7 +3184,7 @@ interface SolvaPay {
4014
3184
  *
4015
3185
  * @example
4016
3186
  * ```typescript
4017
- * // After client confirms payment with Stripe.js
3187
+ * // After client confirms payment
4018
3188
  * const result = await solvaPay.processPaymentIntent({
4019
3189
  * paymentIntentId: 'pi_1234567890',
4020
3190
  * productRef: 'prd_myapi',
@@ -4049,7 +3219,6 @@ interface SolvaPay {
4049
3219
  * const limits = await solvaPay.checkLimits({
4050
3220
  * customerRef: 'user_123',
4051
3221
  * productRef: 'prd_myapi',
4052
- * planRef: 'pln_premium'
4053
3222
  * });
4054
3223
  *
4055
3224
  * if (!limits.withinLimits) {
@@ -4062,14 +3231,17 @@ interface SolvaPay {
4062
3231
  customerRef: string;
4063
3232
  productRef: string;
4064
3233
  planRef?: string;
4065
- meterName?: 'requests' | 'tokens';
4066
- usageType?: 'requests' | 'tokens';
3234
+ meterName?: string;
3235
+ usageType?: string;
4067
3236
  }): Promise<{
4068
3237
  withinLimits: boolean;
4069
3238
  remaining: number;
4070
3239
  plan: string;
4071
3240
  checkoutUrl?: string;
4072
3241
  meterName?: string;
3242
+ creditBalance?: number;
3243
+ creditsPerUnit?: number;
3244
+ currency?: string;
4073
3245
  }>;
4074
3246
  /**
4075
3247
  * Track usage for a customer action.
@@ -4079,12 +3251,12 @@ interface SolvaPay {
4079
3251
  *
4080
3252
  * @param params - Usage tracking parameters
4081
3253
  * @param params.customerRef - Customer reference
4082
- * @param params.productRef - Product reference
4083
- * @param params.planRef - Plan reference
3254
+ * @param params.actionType - Action type category
3255
+ * @param params.units - Number of units consumed (default 1)
4084
3256
  * @param params.outcome - Action outcome ('success', 'paywall', or 'fail')
4085
- * @param params.action - Optional action name for analytics
4086
- * @param params.requestId - Unique request ID
4087
- * @param params.actionDuration - Action duration in milliseconds
3257
+ * @param params.productRef - Product reference
3258
+ * @param params.metadata - Additional metadata (e.g. tool name, endpoint)
3259
+ * @param params.duration - Action duration in milliseconds
4088
3260
  * @param params.timestamp - ISO timestamp of the action
4089
3261
  *
4090
3262
  * @example
@@ -4103,8 +3275,8 @@ interface SolvaPay {
4103
3275
  actionType?: 'transaction' | 'api_call' | 'hour' | 'email' | 'storage' | 'custom';
4104
3276
  units?: number;
4105
3277
  outcome?: 'success' | 'paywall' | 'fail';
4106
- productReference?: string;
4107
- purchaseReference?: string;
3278
+ productRef?: string;
3279
+ purchaseRef?: string;
4108
3280
  description?: string;
4109
3281
  metadata?: Record<string, unknown>;
4110
3282
  duration?: number;
@@ -4133,6 +3305,7 @@ interface SolvaPay {
4133
3305
  createCustomer(params: {
4134
3306
  email: string;
4135
3307
  name?: string;
3308
+ metadata?: Record<string, unknown>;
4136
3309
  }): Promise<{
4137
3310
  customerRef: string;
4138
3311
  }>;
@@ -4164,11 +3337,27 @@ interface SolvaPay {
4164
3337
  customerRef?: string;
4165
3338
  externalRef?: string;
4166
3339
  }): Promise<CustomerResponseMapped>;
3340
+ /**
3341
+ * Get credits for a customer.
3342
+ *
3343
+ * @param params - Credits query parameters
3344
+ * @param params.customerRef - Customer reference
3345
+ * @returns Customer reference, credits, and display currency
3346
+ */
3347
+ getCustomerBalance(params: {
3348
+ customerRef: string;
3349
+ }): Promise<{
3350
+ customerRef: string;
3351
+ credits: number;
3352
+ displayCurrency: string;
3353
+ creditsPerMinorUnit: number;
3354
+ displayExchangeRate: number;
3355
+ }>;
4167
3356
  /**
4168
3357
  * Create a hosted checkout session for a customer.
4169
3358
  *
4170
- * This creates a Stripe Checkout session that redirects the customer
4171
- * to a hosted payment page. After payment, customer is redirected back.
3359
+ * This creates a checkout session that redirects the customer
3360
+ * to a hosted payment page. After payment, the customer is redirected back.
4172
3361
  *
4173
3362
  * @param params - Checkout session parameters
4174
3363
  * @param params.productRef - Product reference
@@ -4202,7 +3391,7 @@ interface SolvaPay {
4202
3391
  /**
4203
3392
  * Create a customer portal session for managing purchases.
4204
3393
  *
4205
- * This creates a Stripe Customer Portal session that allows customers
3394
+ * This creates a customer portal session that allows customers
4206
3395
  * to manage their purchases, update payment methods, and view invoices.
4207
3396
  *
4208
3397
  * @param params - Customer session parameters
@@ -4227,6 +3416,17 @@ interface SolvaPay {
4227
3416
  sessionId: string;
4228
3417
  customerUrl: string;
4229
3418
  }>;
3419
+ /**
3420
+ * Activate a plan for a customer (usage-based / free plans that don't require payment).
3421
+ *
3422
+ * Returns the activation result indicating whether the plan was activated,
3423
+ * is already active, requires a credit top-up, or requires payment.
3424
+ */
3425
+ activatePlan(params: {
3426
+ customerRef: string;
3427
+ productRef: string;
3428
+ planRef: string;
3429
+ }): Promise<ActivatePlanResult>;
4230
3430
  /**
4231
3431
  * Bootstrap an MCP-enabled product with plans and tool mappings.
4232
3432
  *
@@ -4320,10 +3520,7 @@ interface SolvaPay {
4320
3520
  * });
4321
3521
  *
4322
3522
  * // Create payable handlers for your product
4323
- * const payable = solvaPay.payable({
4324
- * product: 'prd_myapi',
4325
- * plan: 'pln_premium'
4326
- * });
3523
+ * const payable = solvaPay.payable({ product: 'prd_myapi' });
4327
3524
  *
4328
3525
  * // Protect endpoints with framework-specific adapters
4329
3526
  * app.post('/tasks', payable.http(createTask)); // Express/Fastify
@@ -4448,6 +3645,8 @@ declare class PaywallError extends Error {
4448
3645
  */
4449
3646
  constructor(message: string, structuredContent: PaywallStructuredContent);
4450
3647
  }
3648
+ /** JSON body shape for HTTP adapters and MCP text content (stable fields for clients). */
3649
+ declare function paywallErrorToClientPayload(error: PaywallError): Record<string, unknown>;
4451
3650
 
4452
3651
  /**
4453
3652
  * MCP OAuth helper utilities.
@@ -4653,6 +3852,13 @@ declare function getAuthenticatedUserCore(request: Request, options?: {
4653
3852
  * Works with standard Web API Request (works everywhere).
4654
3853
  */
4655
3854
 
3855
+ type CustomerBalanceResult = {
3856
+ customerRef: string;
3857
+ credits: number;
3858
+ displayCurrency: string;
3859
+ creditsPerMinorUnit: number;
3860
+ displayExchangeRate: number;
3861
+ };
4656
3862
  /**
4657
3863
  * Sync customer with SolvaPay backend (ensure customer exists).
4658
3864
  *
@@ -4695,16 +3901,28 @@ declare function syncCustomerCore(request: Request, options?: {
4695
3901
  includeEmail?: boolean;
4696
3902
  includeName?: boolean;
4697
3903
  }): Promise<string | ErrorResult>;
3904
+ /**
3905
+ * Get credits for the authenticated customer.
3906
+ *
3907
+ * Authenticates the request, syncs the customer, then fetches credits.
3908
+ *
3909
+ * @param request - Standard Web API Request object
3910
+ * @param options - Configuration options
3911
+ * @returns Customer credits result or error result
3912
+ */
3913
+ declare function getCustomerBalanceCore(request: Request, options?: {
3914
+ solvaPay?: SolvaPay;
3915
+ }): Promise<CustomerBalanceResult | ErrorResult>;
4698
3916
 
4699
3917
  /**
4700
- * Create a Stripe payment intent for a customer to purchase a plan.
3918
+ * Create a payment intent for a customer to purchase a plan.
4701
3919
  *
4702
3920
  * This is a framework-agnostic helper that:
4703
3921
  * 1. Extracts authenticated user from the request
4704
3922
  * 2. Syncs customer with SolvaPay backend
4705
3923
  * 3. Creates a payment intent for the specified plan
4706
3924
  *
4707
- * The payment intent can then be confirmed on the client side using Stripe.js.
3925
+ * The payment intent can then be confirmed on the client side.
4708
3926
  * After confirmation, use `processPaymentIntentCore()` to complete the purchase.
4709
3927
  *
4710
3928
  * @param request - Standard Web API Request object
@@ -4744,24 +3962,53 @@ declare function createPaymentIntentCore(request: Request, body: {
4744
3962
  includeEmail?: boolean;
4745
3963
  includeName?: boolean;
4746
3964
  }): Promise<{
4747
- id: string;
3965
+ processorPaymentId: string;
3966
+ clientSecret: string;
3967
+ publishableKey: string;
3968
+ accountId?: string;
3969
+ customerRef: string;
3970
+ } | ErrorResult>;
3971
+ /**
3972
+ * Create a payment intent for a credit top-up.
3973
+ *
3974
+ * Unlike `createPaymentIntentCore`, this does not require a product or plan.
3975
+ * After client-side payment confirmation, credits are recorded via webhook —
3976
+ * no `processPaymentIntentCore` call is needed.
3977
+ *
3978
+ * @param request - Standard Web API Request object
3979
+ * @param body - Top-up parameters
3980
+ * @param body.amount - Amount in smallest currency unit (e.g. cents). Must be > 0
3981
+ * @param body.currency - ISO 4217 currency code (e.g. 'usd')
3982
+ * @param body.description - Optional description for the payment intent
3983
+ * @param options - Configuration options
3984
+ * @returns Payment intent response with client secret and customer reference, or error result
3985
+ */
3986
+ declare function createTopupPaymentIntentCore(request: Request, body: {
3987
+ amount: number;
3988
+ currency: string;
3989
+ description?: string;
3990
+ }, options?: {
3991
+ solvaPay?: SolvaPay;
3992
+ includeEmail?: boolean;
3993
+ includeName?: boolean;
3994
+ }): Promise<{
3995
+ processorPaymentId: string;
4748
3996
  clientSecret: string;
4749
3997
  publishableKey: string;
4750
3998
  accountId?: string;
4751
3999
  customerRef: string;
4752
4000
  } | ErrorResult>;
4753
4001
  /**
4754
- * Process a payment intent after client-side Stripe confirmation.
4002
+ * Process a payment intent after client-side payment confirmation.
4755
4003
  *
4756
4004
  * This helper processes a payment intent that has been confirmed on the client
4757
- * side using Stripe.js. It creates the purchase immediately,
4758
- * eliminating webhook delay.
4005
+ * side. It creates the purchase immediately, eliminating webhook delay.
4759
4006
  *
4760
- * Call this after the client has confirmed the payment intent with Stripe.js.
4007
+ * Call this after the client has confirmed the payment intent.
4761
4008
  *
4762
4009
  * @param request - Standard Web API Request object
4763
4010
  * @param body - Payment processing parameters
4764
- * @param body.paymentIntentId - Stripe payment intent ID from client confirmation (required)
4011
+ * @param body.paymentIntentId - Processor payment ID from client confirmation (required)
4765
4012
  * @param body.productRef - Product reference (required)
4766
4013
  * @param body.planRef - Optional plan reference (if not in payment intent)
4767
4014
  * @param options - Configuration options
@@ -4840,9 +4087,9 @@ declare function createCustomerSessionCore(request: Request, options?: {
4840
4087
  } | ErrorResult>;
4841
4088
 
4842
4089
  /**
4843
- * Purchase Cancellation Helpers (Core)
4090
+ * Purchase Cancellation & Reactivation Helpers (Core)
4844
4091
  *
4845
- * Generic helpers for purchase cancellation operations.
4092
+ * Generic helpers for purchase cancellation and reactivation operations.
4846
4093
  * Works with standard Web API Request (works everywhere).
4847
4094
  */
4848
4095
 
@@ -4860,6 +4107,31 @@ declare function cancelPurchaseCore(request: Request, body: {
4860
4107
  }, options?: {
4861
4108
  solvaPay?: SolvaPay;
4862
4109
  }): Promise<Record<string, unknown> | ErrorResult>;
4110
+ /**
4111
+ * Reactivate purchase - core implementation
4112
+ *
4113
+ * Undoes a pending cancellation, restoring auto-renewal and clearing cancellation fields.
4114
+ * Only works while the purchase is still active and the end date hasn't passed.
4115
+ *
4116
+ * @param request - Standard Web API Request
4117
+ * @param body - Reactivation parameters
4118
+ * @param options - Configuration options
4119
+ * @returns Reactivated purchase response or error result
4120
+ */
4121
+ declare function reactivatePurchaseCore(request: Request, body: {
4122
+ purchaseRef: string;
4123
+ }, options?: {
4124
+ solvaPay?: SolvaPay;
4125
+ }): Promise<Record<string, unknown> | ErrorResult>;
4126
+
4127
+ declare function activatePlanCore(request: Request, body: {
4128
+ productRef: string;
4129
+ planRef: string;
4130
+ }, options?: {
4131
+ solvaPay?: SolvaPay;
4132
+ includeEmail?: boolean;
4133
+ includeName?: boolean;
4134
+ }): Promise<ActivatePlanResult | ErrorResult>;
4863
4135
 
4864
4136
  /**
4865
4137
  * Plans Helper (Core)
@@ -4869,14 +4141,87 @@ declare function cancelPurchaseCore(request: Request, body: {
4869
4141
  * This is a public route - no authentication required.
4870
4142
  */
4871
4143
 
4144
+ type Plan = components['schemas']['Plan'];
4872
4145
  /**
4873
- * List plans - core implementation
4146
+ * List plans - core implementation.
4147
+ *
4148
+ * Pass `options.solvaPay` to route through a pre-configured SolvaPay instance
4149
+ * (e.g. stub-backed in examples). When omitted, the helper reads
4150
+ * `SOLVAPAY_SECRET_KEY` from environment and constructs a real API client.
4874
4151
  */
4875
- declare function listPlansCore(request: Request): Promise<{
4876
- plans: Record<string, unknown>[];
4152
+ declare function listPlansCore(request: Request, options?: {
4153
+ solvaPay?: SolvaPay;
4154
+ }): Promise<{
4155
+ plans: Plan[];
4877
4156
  productRef: string;
4878
4157
  } | ErrorResult>;
4879
4158
 
4159
+ /**
4160
+ * Merchant Helper (Core)
4161
+ *
4162
+ * Generic helper for GET /api/merchant — returns the SDK-facing merchant
4163
+ * identity used by `<MandateText>`, `<CheckoutSummary>`, and trust signals.
4164
+ * Works with standard Web API Request (Express, Fastify, Next.js, Edge).
4165
+ */
4166
+
4167
+ declare function getMerchantCore(_request: Request, options?: {
4168
+ solvaPay?: SolvaPay;
4169
+ }): Promise<SdkMerchantResponse | ErrorResult>;
4170
+
4171
+ /**
4172
+ * Product Helper (Core)
4173
+ *
4174
+ * Generic helper for GET /api/get-product?productRef=...
4175
+ * Returns a single product by reference, used by the `useProduct` React hook.
4176
+ */
4177
+
4178
+ declare function getProductCore(request: Request, options?: {
4179
+ solvaPay?: SolvaPay;
4180
+ }): Promise<SdkProductResponse | ErrorResult>;
4181
+
4182
+ interface PurchaseCheckResult {
4183
+ customerRef: string;
4184
+ email?: string;
4185
+ name?: string;
4186
+ purchases: Array<{
4187
+ reference: string;
4188
+ productName?: string;
4189
+ productRef?: string;
4190
+ status?: string;
4191
+ startDate?: string;
4192
+ planSnapshot?: {
4193
+ meterId?: string;
4194
+ limit?: number;
4195
+ freeUnits?: number;
4196
+ };
4197
+ usage?: {
4198
+ used?: number;
4199
+ overageUnits?: number;
4200
+ overageCost?: number;
4201
+ periodStart?: string;
4202
+ periodEnd?: string;
4203
+ };
4204
+ [key: string]: unknown;
4205
+ }>;
4206
+ }
4207
+ declare function checkPurchaseCore(request: Request, options?: {
4208
+ solvaPay?: SolvaPay;
4209
+ includeEmail?: boolean;
4210
+ includeName?: boolean;
4211
+ }): Promise<PurchaseCheckResult | ErrorResult>;
4212
+
4213
+ declare function trackUsageCore(request: Request, body: {
4214
+ actionType?: 'transaction' | 'api_call' | 'hour' | 'email' | 'storage' | 'custom';
4215
+ units?: number;
4216
+ productRef?: string;
4217
+ description?: string;
4218
+ metadata?: Record<string, unknown>;
4219
+ }, options?: {
4220
+ solvaPay?: SolvaPay;
4221
+ }): Promise<{
4222
+ success: true;
4223
+ } | ErrorResult>;
4224
+
4880
4225
  /**
4881
4226
  * SolvaPay Server SDK
4882
4227
  *
@@ -4932,4 +4277,4 @@ declare function verifyWebhook({ body, signature, secret, }: {
4932
4277
  secret: string;
4933
4278
  }): WebhookEvent;
4934
4279
 
4935
- export { type AuthenticatedUser, type ConfigureMcpPlansRequest, type ConfigureMcpPlansResponse, type CreateSolvaPayConfig, type CustomerResponseMapped, type CustomerWebhookObject, type ErrorResult, type HttpAdapterOptions, type McpAdapterOptions, McpBearerAuthError, type McpBootstrapFreePlanConfig, type McpBootstrapPaidPlanInput, type McpBootstrapRequest, type McpBootstrapResponse, type McpServerLike, type McpToolExtra, type McpToolPlanMappingInput, type NextAdapterOptions, type OneTimePurchaseInfo, type PayableFunction, type PayableOptions, type PaywallArgs, PaywallError, type PaywallMetadata, type PaywallStructuredContent, type PaywallToolResult, type ProcessPaymentResult, type RegisterVirtualToolsMcpOptions, type RetryOptions, type ServerClientOptions, type SolvaPay, type SolvaPayClient, type ToolPlanMappingInput, VIRTUAL_TOOL_DEFINITIONS, type VirtualToolDefinition, type VirtualToolsOptions, type WebhookEvent, type WebhookEventForType, type WebhookEventObjectMap, type WebhookEventType, type WebhookProduct, buildAuthInfoFromBearer, cancelPurchaseCore, createCheckoutSessionCore, createCustomerSessionCore, createMcpOAuthBridge, createPaymentIntentCore, createSolvaPay, createSolvaPayClient, createVirtualTools, decodeJwtPayload, extractBearerToken, getAuthenticatedUserCore, getCustomerRefFromBearerAuthHeader, getCustomerRefFromJwtPayload, getOAuthAuthorizationServerResponse, getOAuthProtectedResourceResponse, handleRouteError, isErrorResult, jsonSchemaToZodRawShape, listPlansCore, processPaymentIntentCore, registerVirtualToolsMcpImpl, syncCustomerCore, verifyWebhook, withRetry };
4280
+ export { type ActivatePlanResult, type AuthenticatedUser, type ConfigureMcpPlansRequest, type ConfigureMcpPlansResponse, type CreateSolvaPayConfig, type CustomerBalanceResult, type CustomerResponseMapped, type CustomerWebhookObject, type ErrorResult, type HttpAdapterOptions, type LimitActivationBalance, type LimitActivationProduct, type LimitPlanSummary, type McpAdapterOptions, McpBearerAuthError, type McpBootstrapPlanInput, type McpBootstrapRequest, type McpBootstrapResponse, type McpServerLike, type McpToolExtra, type McpToolPlanMappingInput, type NextAdapterOptions, type OneTimePurchaseInfo, type PayableFunction, type PayableOptions, type PaywallArgs, PaywallError, type PaywallMetadata, type PaywallStructuredContent, type PaywallToolResult, type ProcessPaymentResult, type PurchaseCheckResult, type RegisterVirtualToolsMcpOptions, type RetryOptions, type SdkMerchantResponse, type SdkProductResponse, type ServerClientOptions, type SolvaPay, type SolvaPayClient, type ToolPlanMappingInput, VIRTUAL_TOOL_DEFINITIONS, type VirtualToolDefinition, type VirtualToolsOptions, type WebhookEvent, type WebhookEventForType, type WebhookEventObjectMap, type WebhookEventType, type WebhookProduct, activatePlanCore, buildAuthInfoFromBearer, cancelPurchaseCore, checkPurchaseCore, type components, createCheckoutSessionCore, createCustomerSessionCore, createMcpOAuthBridge, createPaymentIntentCore, createSolvaPay, createSolvaPayClient, createTopupPaymentIntentCore, createVirtualTools, decodeJwtPayload, extractBearerToken, getAuthenticatedUserCore, getCustomerBalanceCore, getCustomerRefFromBearerAuthHeader, getCustomerRefFromJwtPayload, getMerchantCore, getOAuthAuthorizationServerResponse, getOAuthProtectedResourceResponse, getProductCore, handleRouteError, isErrorResult, jsonSchemaToZodRawShape, listPlansCore, paywallErrorToClientPayload, processPaymentIntentCore, reactivatePurchaseCore, registerVirtualToolsMcpImpl, syncCustomerCore, trackUsageCore, verifyWebhook, withRetry };