@commet/node 5.5.1 → 7.0.0

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
@@ -118,12 +118,6 @@ declare class CommetValidationError extends CommetError {
118
118
  type CustomerID = string;
119
119
  type EventID = `evt_${string}`;
120
120
  type Currency = "USD" | "EUR" | "GBP" | "CAD" | "AUD" | "JPY" | "ARS" | "BRL" | "MXN" | "CLP";
121
- interface ListParams extends Record<string, unknown> {
122
- limit?: number;
123
- cursor?: string;
124
- startDate?: string;
125
- endDate?: string;
126
- }
127
121
  interface RequestOptions {
128
122
  apiVersion?: string;
129
123
  idempotencyKey?: string;
@@ -143,366 +137,836 @@ type ResolvedPlanCode<TConfig> = [InferPlanCodes<TConfig>] extends [
143
137
  never
144
138
  ] ? string : InferPlanCodes<TConfig>;
145
139
 
146
- declare class CommetHTTPClient {
147
- private config;
148
- private retryConfig;
149
- private telemetryEnabled;
150
- private lastRequestMetrics;
151
- constructor(config: CommetClientOptions);
152
- get<T = unknown>(endpoint: string, params?: Record<string, unknown> | object, options?: RequestOptions): Promise<ApiResponse<T>>;
153
- post<T = unknown>(endpoint: string, data?: unknown, options?: RequestOptions): Promise<ApiResponse<T>>;
154
- put<T = unknown>(endpoint: string, data?: unknown, options?: RequestOptions): Promise<ApiResponse<T>>;
155
- delete<T = unknown>(endpoint: string, data?: unknown, options?: RequestOptions): Promise<ApiResponse<T>>;
156
- private resolveApiVersion;
157
- private static readonly BODY_METHODS;
158
- private request;
159
- /**
160
- * Execute real API request with retry logic
161
- */
162
- private executeRequest;
163
- /**
164
- * Build full URL from endpoint and params
165
- */
166
- private buildURL;
167
- private generateIdempotencyKey;
168
- /**
169
- * Sleep for specified milliseconds
170
- */
171
- private sleep;
172
- }
173
-
174
- type PlanID = `plan_${string}`;
140
+ type SubscriptionStatus = "draft" | "pending_payment" | "trialing" | "active" | "past_due" | "canceled";
175
141
  type BillingInterval = "weekly" | "monthly" | "quarterly" | "yearly" | "one_time";
176
- type FeatureType = "boolean" | "usage" | "seats" | "quota";
177
142
  type ConsumptionModel = "metered" | "credits" | "balance";
143
+ type InvoiceType = "recurring" | "overage" | "plan_change" | "adjustment" | "credit_purchase" | "balance_topup" | "addon_activation";
144
+ type TransactionStatus = "pending" | "succeeded" | "failed" | "refunded" | "disputed";
145
+ type FeatureType = "boolean" | "usage" | "seats" | "quota";
178
146
  type DiscountType = "percentage" | "amount";
179
- interface PlanPrice {
180
- billingInterval: BillingInterval;
147
+ type Timezone = "UTC" | "America/New_York" | "America/Chicago" | "America/Denver" | "America/Los_Angeles" | "America/Sao_Paulo" | "America/Mexico_City" | "America/Buenos_Aires" | "America/Santiago" | "America/Bogota" | "America/Lima" | "America/Asuncion" | "Europe/London" | "Europe/Paris" | "Europe/Berlin" | "Europe/Madrid" | "Asia/Tokyo" | "Asia/Shanghai" | "Asia/Singapore" | "Asia/Dubai" | "Australia/Sydney";
148
+
149
+ interface ActiveAddon {
150
+ slug: string;
151
+ name: string;
152
+ basePrice: number;
153
+ featureCode: string;
154
+ featureName: string;
155
+ featureType: FeatureType;
156
+ consumptionModel: "boolean" | "metered" | "credits" | "balance";
157
+ /** @format date-time */
158
+ activatedAt: string;
159
+ object: "addon";
160
+ livemode: boolean;
161
+ }
162
+ interface AddedPlanToGroup {
163
+ success: boolean;
164
+ object: "plan_group";
165
+ livemode: boolean;
166
+ }
167
+ interface Addon {
168
+ id: string;
169
+ name: string;
170
+ slug: string;
171
+ description: string | null;
172
+ basePrice: number;
173
+ consumptionModel: "boolean" | "metered" | "credits" | "balance";
174
+ featureCode: string;
175
+ featureName: string;
176
+ includedUnits: number | null;
177
+ overageRate: number | null;
178
+ creditCost: number | null;
179
+ /** @format date-time */
180
+ createdAt: string;
181
+ /** @format date-time */
182
+ updatedAt: string;
183
+ object: "addon";
184
+ livemode: boolean;
185
+ }
186
+ interface ApiKey {
187
+ id: string;
188
+ name: string;
189
+ prefix: string;
190
+ expiresAt: string | null;
191
+ lastUsedAt: string | null;
192
+ /** @format date-time */
193
+ createdAt: string;
194
+ object: "api_key";
195
+ livemode: boolean;
196
+ }
197
+ interface BalanceAdjustment {
198
+ amount: number;
199
+ newBalance: number;
200
+ reason: string | null;
201
+ object: "subscription";
202
+ livemode: boolean;
203
+ }
204
+ interface BalanceTopup {
205
+ amount: number;
206
+ object: "subscription";
207
+ livemode: boolean;
208
+ }
209
+ interface BulkSeatUpdate {
210
+ id: string;
211
+ featureCode: string;
212
+ previousBalance: number;
213
+ newBalance: number;
214
+ /** @format date-time */
215
+ ts: string;
216
+ /** @format date-time */
217
+ createdAt: string;
218
+ object: "seat";
219
+ livemode: boolean;
220
+ }
221
+ interface CanceledSubscription {
222
+ id: string;
223
+ customerId: string;
224
+ status: SubscriptionStatus;
225
+ /** @format date-time */
226
+ canceledAt: string;
227
+ cancelReason: string | null;
228
+ /** @format date-time */
229
+ scheduledCancellationDate: string;
230
+ /** @format date-time */
231
+ updatedAt: string;
232
+ object: "subscription";
233
+ livemode: boolean;
234
+ }
235
+ interface CreatedApiKey {
236
+ id: string;
237
+ name: string;
238
+ apiKey: string;
239
+ prefix: string;
240
+ /** @format date-time */
241
+ expiresAt: string;
242
+ /** @format date-time */
243
+ createdAt: string;
244
+ object: "api_key";
245
+ livemode: boolean;
246
+ }
247
+ interface CreatedInvoice {
248
+ id: string;
249
+ customerId: string;
250
+ invoiceNumber: string;
251
+ status: "draft" | "outstanding" | "paid" | "void" | "uncollectible";
252
+ invoiceType: InvoiceType;
253
+ currency: string;
254
+ subtotal: number;
255
+ taxAmount: number;
256
+ total: number;
257
+ /** @format date-time */
258
+ issueDate: string;
259
+ /** @format date-time */
260
+ dueDate: string;
261
+ memo: string | null;
262
+ metadata: Record<string, unknown>;
263
+ /** @format date-time */
264
+ createdAt: string;
265
+ /** @format date-time */
266
+ updatedAt: string;
267
+ object: "invoice";
268
+ livemode: boolean;
269
+ }
270
+ interface CreditGrant {
271
+ credits: number;
272
+ object: "subscription";
273
+ livemode: boolean;
274
+ }
275
+ interface CreditPack {
276
+ id: string;
277
+ name: string;
278
+ description: string | null;
279
+ credits: number;
181
280
  price: number;
182
- isDefault: boolean;
183
- trialDays: number;
281
+ currency?: string;
282
+ isActive?: boolean;
283
+ /** @format date-time */
284
+ createdAt?: string;
285
+ /** @format date-time */
286
+ updatedAt?: string;
287
+ object: "credit_pack";
288
+ livemode: boolean;
184
289
  }
185
- interface PlanFeature {
186
- code: string;
290
+ interface Customer {
291
+ id: string;
292
+ externalId: string | null;
293
+ fullName: string | null;
294
+ email: string;
295
+ timezone: string | null;
296
+ metadata: Record<string, unknown> | null;
297
+ /** @format date-time */
298
+ createdAt: string;
299
+ /** @format date-time */
300
+ updatedAt: string;
301
+ object: "customer";
302
+ livemode: boolean;
303
+ }
304
+ interface CustomerBatch {
305
+ successful: Array<{
306
+ id: string;
307
+ externalId: string | null;
308
+ email: string;
309
+ }>;
310
+ failed: Array<{
311
+ index: number;
312
+ error: string;
313
+ data: {
314
+ id?: string;
315
+ externalId?: string;
316
+ email: string;
317
+ fullName?: string | null;
318
+ timezone?: string;
319
+ metadata?: Record<string, unknown> | null;
320
+ address?: {
321
+ line1: string;
322
+ line2?: string;
323
+ city: string;
324
+ state?: string;
325
+ postalCode: string;
326
+ country: string;
327
+ region?: string;
328
+ };
329
+ };
330
+ }>;
331
+ object: "customer";
332
+ livemode: boolean;
333
+ }
334
+ interface DefaultPlanPrice {
335
+ id: string;
336
+ isDefault: true;
337
+ object: "plan";
338
+ livemode: boolean;
339
+ }
340
+ interface DeletedObject {
341
+ id: string;
342
+ deleted: true;
343
+ object: string;
344
+ livemode: boolean;
345
+ }
346
+ interface DeletedPlanRegionalPricing {
347
+ deleted: true;
348
+ object: "plan";
349
+ livemode: boolean;
350
+ }
351
+ interface DeletedSubscriptionAddon {
352
+ id: string;
353
+ status: "inactive";
354
+ deactivatedAt: string | null;
355
+ object: "subscription";
356
+ livemode: boolean;
357
+ }
358
+ interface Feature {
359
+ id: string;
187
360
  name: string;
361
+ code: string;
188
362
  type: FeatureType;
363
+ description: string | null;
189
364
  unitName: string | null;
365
+ /** @format date-time */
366
+ createdAt: string;
367
+ /** @format date-time */
368
+ updatedAt: string;
369
+ object: "feature";
370
+ livemode: boolean;
371
+ }
372
+ interface FeatureAccess {
373
+ code: string;
374
+ name: string;
375
+ type: FeatureType;
376
+ allowed: boolean;
190
377
  enabled?: boolean;
191
- includedAmount?: number;
378
+ current?: number;
379
+ included?: number;
380
+ remaining?: number;
381
+ overageQuantity?: number;
382
+ overageUnitPrice?: number;
192
383
  unlimited?: boolean;
193
384
  overageEnabled?: boolean;
385
+ billedQuantity?: number;
386
+ object: "feature";
387
+ livemode: boolean;
388
+ }
389
+ interface FeatureLookup {
390
+ allowed: boolean;
391
+ code?: string;
392
+ name?: string;
393
+ type?: FeatureType;
394
+ enabled?: boolean;
395
+ current?: number;
396
+ included?: number;
397
+ remaining?: number;
398
+ overageQuantity?: number;
194
399
  overageUnitPrice?: number;
400
+ unlimited?: boolean;
401
+ overageEnabled?: boolean;
402
+ billedQuantity?: number;
403
+ willBeCharged?: boolean;
404
+ reason?: string;
405
+ object: "feature";
406
+ livemode: boolean;
195
407
  }
196
- interface Plan {
197
- id: PlanID;
198
- object: "plan";
408
+ interface Invoice {
409
+ id: string;
410
+ customerId: string;
411
+ subscriptionId: string | null;
412
+ invoiceNumber: string;
413
+ status: "draft" | "outstanding" | "paid" | "void" | "uncollectible";
414
+ invoiceType: InvoiceType;
415
+ currency: string;
416
+ subtotal: number;
417
+ discountAmount: number;
418
+ creditApplied?: number;
419
+ taxAmount: number;
420
+ total: number;
421
+ /** @format date-time */
422
+ periodStart: string;
423
+ /** @format date-time */
424
+ periodEnd: string;
425
+ /** @format date-time */
426
+ issueDate: string;
427
+ /** @format date-time */
428
+ dueDate: string;
429
+ planName?: string | null;
430
+ memo: string | null;
431
+ poNumber?: string | null;
432
+ reference?: string | null;
433
+ metadata: Record<string, unknown>;
434
+ /** @format date-time */
435
+ createdAt: string;
436
+ /** @format date-time */
437
+ updatedAt: string;
438
+ lineItems?: Array<{
439
+ lineType: "plan_base" | "feature_overage" | "feature_seats" | "feature_quota" | "discount" | "promo_code_discount" | "credit" | "balance_overage" | "addon_base";
440
+ featureName: string | null;
441
+ description: string;
442
+ quantity: number;
443
+ unitAmount: number;
444
+ amount: number;
445
+ includedAmount: number | null;
446
+ usedAmount: number | null;
447
+ overageAmount: number | null;
448
+ discountType: string | null;
449
+ discountValue: number | null;
450
+ discountName: string | null;
451
+ chargeType: "standard" | "advance" | "true_up";
452
+ }>;
453
+ object: "invoice";
199
454
  livemode: boolean;
200
- code: string;
455
+ }
456
+ interface InvoiceDownload {
457
+ url: string;
458
+ /** @format date-time */
459
+ expiresAt: string;
460
+ object: "invoice";
461
+ livemode: boolean;
462
+ }
463
+ interface InvoiceStatus {
464
+ id: string;
465
+ status: "draft" | "outstanding" | "paid" | "void" | "uncollectible";
466
+ /** @format date-time */
467
+ updatedAt: string;
468
+ object: "invoice";
469
+ livemode: boolean;
470
+ }
471
+ interface Payout {
472
+ id: string;
473
+ status: "pending" | "in_transit" | "paid" | "failed" | "canceled";
474
+ amount: number;
475
+ fee: number;
476
+ netAmount: number;
477
+ currency: string;
478
+ description: string | null;
479
+ providerTransferId: string;
480
+ /** @format date-time */
481
+ createdAt: string;
482
+ object: "payout";
483
+ livemode: boolean;
484
+ }
485
+ interface PayoutBankAccount {
486
+ id: string;
487
+ providerExternalAccountId: string | null;
488
+ holderName: string;
489
+ last4: string;
490
+ bankName: string | null;
491
+ country: string;
492
+ currency: string;
493
+ accountType: "checking" | "savings" | null;
494
+ isDefault: boolean;
495
+ status: "active" | "errored";
496
+ /** @format date-time */
497
+ createdAt: string;
498
+ object: "payout_bank_account";
499
+ livemode: boolean;
500
+ }
501
+ interface PayoutVerification {
502
+ providerAccountId: string;
503
+ status: "pending_verification" | "verified" | "restricted" | "disabled";
504
+ transfersEnabled: boolean;
505
+ alreadyExists?: boolean;
506
+ businessType?: "individual" | "company";
507
+ country?: string;
508
+ object: "payout_account";
509
+ livemode: boolean;
510
+ }
511
+ interface Plan {
512
+ id: string;
201
513
  name: string;
514
+ code: string;
202
515
  description: string | null;
516
+ consumptionModel: ConsumptionModel | null;
203
517
  isPublic: boolean;
204
- isFree: boolean;
205
518
  isDefault: boolean;
519
+ isFree: boolean;
520
+ blockOnExhaustion: boolean | null;
206
521
  sortOrder: number;
207
- prices: PlanPrice[];
208
- features: PlanFeature[];
522
+ planGroupId: string | null;
523
+ metadata: Record<string, unknown> | null;
524
+ /** @format date-time */
209
525
  createdAt: string;
526
+ /** @format date-time */
527
+ updatedAt: string;
528
+ features?: Array<{
529
+ code: string;
530
+ name: string;
531
+ type: FeatureType;
532
+ unitName: string | null;
533
+ enabled: boolean;
534
+ includedAmount: number | null;
535
+ unlimited: boolean;
536
+ overage: {
537
+ enabled: boolean;
538
+ model: "per_unit" | null;
539
+ unitPrice: number | null;
540
+ } | null;
541
+ regionalPrices?: Array<{
542
+ currency: string;
543
+ overageUnitPrice: number | null;
544
+ autoSynced: boolean;
545
+ }>;
546
+ }>;
547
+ prices?: Array<{
548
+ billingInterval: BillingInterval;
549
+ price: number;
550
+ isDefault: boolean;
551
+ trialDays: number;
552
+ includedBalance: number | null;
553
+ includedCredits: number | null;
554
+ introOffer: {
555
+ enabled: boolean;
556
+ discountType: DiscountType | null;
557
+ discountValue: number | null;
558
+ durationCycles: number | null;
559
+ } | null;
560
+ regionalPrices?: Array<{
561
+ currency: string;
562
+ price: number;
563
+ includedBalance: number | null;
564
+ autoSynced: boolean;
565
+ }>;
566
+ }>;
567
+ exchangeRates?: Array<{
568
+ currency: string;
569
+ exchangeRate: number;
570
+ }>;
571
+ object: "plan";
572
+ livemode: boolean;
210
573
  }
211
- interface PlanDetailPrice {
574
+ interface PlanChange {
575
+ requiresCheckout?: boolean;
576
+ checkoutUrl?: string;
577
+ id?: string;
578
+ scheduled?: boolean;
579
+ /** @format date-time */
580
+ scheduledFor?: string;
581
+ changeType?: "subscription.plan_downgrade" | "subscription.interval_change" | "subscription.cancel";
582
+ customerId?: string;
583
+ newPlanId?: string;
584
+ newPlanName?: string;
585
+ newBillingInterval?: string;
586
+ previousPlan?: {
587
+ id: string;
588
+ name: string;
589
+ };
590
+ currentPlan?: {
591
+ id: string;
592
+ name: string;
593
+ price: number;
594
+ };
595
+ billingInterval?: string;
596
+ billing?: {
597
+ credit: number;
598
+ creditsApplied: number;
599
+ charge: number;
600
+ taxAmount: number;
601
+ netAmount: number;
602
+ totalCharged: number;
603
+ remainingCreditBalance: number;
604
+ };
605
+ invoiceId?: string;
606
+ object: "subscription";
607
+ livemode: boolean;
608
+ }
609
+ interface PlanFeature {
610
+ planId: string;
611
+ featureId: string;
612
+ enabled: boolean;
613
+ includedAmount: number;
614
+ unlimited: boolean;
615
+ overage: {
616
+ enabled: boolean;
617
+ unitPrice: number;
618
+ };
619
+ creditsPerUnit: number | null;
620
+ pricingMode: "fixed" | "ai_model";
621
+ margin: number | null;
622
+ object: "plan";
623
+ livemode: boolean;
624
+ }
625
+ interface PlanGroup {
626
+ id: string;
627
+ name: string;
628
+ description: string | null;
629
+ isPublic: boolean;
630
+ /** @format date-time */
631
+ createdAt: string;
632
+ /** @format date-time */
633
+ updatedAt: string;
634
+ plans?: Array<{
635
+ id: string;
636
+ name: string;
637
+ sortOrder: number;
638
+ }>;
639
+ object: "plan_group";
640
+ livemode: boolean;
641
+ }
642
+ interface PlanPrice {
643
+ id: string;
644
+ planId: string;
212
645
  billingInterval: BillingInterval;
213
646
  price: number;
214
647
  isDefault: boolean;
215
648
  trialDays: number;
649
+ includedBalance: number | null;
650
+ includedCredits: number | null;
216
651
  introOffer: {
217
652
  enabled: boolean;
218
653
  discountType: DiscountType | null;
219
654
  discountValue: number | null;
220
655
  durationCycles: number | null;
221
656
  } | null;
657
+ /** @format date-time */
658
+ createdAt: string;
659
+ /** @format date-time */
660
+ updatedAt: string;
661
+ object: "plan";
662
+ livemode: boolean;
222
663
  }
223
- interface PlanDetailFeature extends PlanFeature {
224
- overage: {
225
- enabled: boolean;
226
- model: "per_unit" | null;
227
- unitPrice: number | null;
228
- } | null;
664
+ interface PlanRegionalPricing {
665
+ priceId: string;
666
+ overrides: Array<{
667
+ currency: string;
668
+ price: number;
669
+ includedBalance?: number;
670
+ }>;
671
+ object: "plan";
672
+ livemode: boolean;
229
673
  }
230
- interface PlanDetail {
231
- id: PlanID;
674
+ interface PlanRegionalPricingResult {
675
+ planId: string;
676
+ currency: string;
677
+ exchangeRate: number;
678
+ pricesConfigured: number;
679
+ featuresConfigured: number;
232
680
  object: "plan";
233
681
  livemode: boolean;
234
- code: string;
235
- name: string;
236
- description: string | null;
682
+ }
683
+ interface PlanVisibility {
684
+ id: string;
237
685
  isPublic: boolean;
238
- isDefault: boolean;
239
- sortOrder: number;
240
- prices: PlanDetailPrice[];
241
- features: PlanDetailFeature[];
686
+ object: "plan";
687
+ livemode: boolean;
688
+ }
689
+ interface PortalAccess {
690
+ portalUrl: string;
691
+ object: "portal_session";
692
+ livemode: boolean;
693
+ }
694
+ interface PreviewChange {
695
+ currency: string;
696
+ currentPlanCredit: number;
697
+ newPlanCharge: number;
698
+ estimatedTotal: number;
699
+ /** @format date-time */
700
+ effectiveDate: string;
701
+ daysRemaining: number;
702
+ totalDays: number;
703
+ isUpgrade: boolean;
704
+ object: "subscription";
705
+ livemode: boolean;
706
+ }
707
+ interface PromoCode {
708
+ id: string;
709
+ code: string;
710
+ discountType: DiscountType;
711
+ discountValue: number;
712
+ durationCycles: number | null;
713
+ maxRedemptions: number | null;
714
+ expiresAt: string | null;
715
+ isActive: boolean;
716
+ redemptionCount: number;
717
+ /** @format date-time */
242
718
  createdAt: string;
719
+ /** @format date-time */
243
720
  updatedAt: string;
721
+ object: "promo_code";
722
+ livemode: boolean;
244
723
  }
245
- interface ListPlansParams extends ListParams {
246
- includePrivate?: boolean;
247
- }
248
- interface PlanManage {
724
+ interface RemovedPlanFeature {
249
725
  id: string;
726
+ removed: true;
250
727
  object: "plan";
251
728
  livemode: boolean;
729
+ }
730
+ interface RemovedPlanFromGroup {
731
+ id: string;
732
+ removed: boolean;
733
+ object: "plan_group";
734
+ livemode: boolean;
735
+ }
736
+ interface ReorderedPlans {
737
+ reordered: boolean;
738
+ object: "plan_group";
739
+ livemode: boolean;
740
+ }
741
+ interface SeatBalance {
742
+ current: number;
743
+ /** @format date-time */
744
+ asOf: string;
745
+ object: "seat";
746
+ livemode: boolean;
747
+ }
748
+ interface SeatBalanceListItem {
749
+ object: "seat";
750
+ livemode: boolean;
751
+ }
752
+ interface SeatEvent {
753
+ id: string;
754
+ customerId: string;
755
+ featureCode: string;
756
+ previousBalance: number;
757
+ newBalance: number;
758
+ /** @format date-time */
759
+ ts: string;
760
+ /** @format date-time */
761
+ createdAt: string;
762
+ object: "seat";
763
+ livemode: boolean;
764
+ }
765
+ interface SentInvoice {
766
+ sent: boolean;
767
+ /** @format date-time */
768
+ sentAt: string;
769
+ object: "invoice";
770
+ livemode: boolean;
771
+ }
772
+ interface Subscription {
773
+ id: string;
774
+ customerId: string;
775
+ plan: {
776
+ id: string;
777
+ name: string;
778
+ basePrice?: number;
779
+ };
252
780
  name: string;
253
- code: string;
254
781
  description: string | null;
255
- consumptionModel: ConsumptionModel | null;
256
- isPublic: boolean;
257
- isDefault: boolean;
258
- isFree: boolean;
259
- blockOnExhaustion: boolean;
260
- sortOrder: number;
261
- planGroupId: string | null;
262
- metadata: Record<string, unknown> | null;
782
+ status: SubscriptionStatus;
783
+ billingInterval: BillingInterval | null;
784
+ consumptionModel?: ConsumptionModel | null;
785
+ trialEndsAt: string | null;
786
+ currentPeriod: {
787
+ /** @format date-time */
788
+ start: string;
789
+ /** @format date-time */
790
+ end: string;
791
+ daysRemaining: number;
792
+ } | null;
793
+ features?: Array<{
794
+ code: string;
795
+ name: string;
796
+ type: FeatureType;
797
+ enabled?: boolean;
798
+ usage?: {
799
+ current: number;
800
+ included: number;
801
+ overageQuantity: number;
802
+ overageUnitPrice?: number;
803
+ };
804
+ }>;
805
+ credits?: {
806
+ remaining: number;
807
+ included: number;
808
+ purchased: number;
809
+ } | null;
810
+ balance?: {
811
+ remaining: number;
812
+ included: number;
813
+ currency: string;
814
+ } | null;
815
+ cancellation: {
816
+ /** @format date-time */
817
+ scheduledAt: string;
818
+ reason: string | null;
819
+ /** @format date-time */
820
+ effectiveAt: string;
821
+ } | null;
822
+ cancelAtPeriodEnd: boolean;
823
+ scheduledPlanChange: {
824
+ changeType: "plan_downgrade" | "interval_change";
825
+ newPlanId: string | null;
826
+ newPlanName: string | null;
827
+ newBillingInterval: string | null;
828
+ /** @format date-time */
829
+ scheduledFor: string;
830
+ } | null;
831
+ discount: {
832
+ type: DiscountType;
833
+ value: number;
834
+ name: string | null;
835
+ endsAt: string | null;
836
+ } | null;
837
+ /** @format date-time */
838
+ startDate: string;
839
+ endDate: string | null;
840
+ billingDayOfMonth: number | null;
841
+ nextBillingDate: string | null;
842
+ checkoutUrl: string | null;
843
+ /** @format date-time */
263
844
  createdAt: string;
845
+ /** @format date-time */
264
846
  updatedAt: string;
847
+ object: "subscription";
848
+ livemode: boolean;
265
849
  }
266
- interface PlanFeatureManageBase {
267
- planId: string;
268
- featureId: string;
269
- enabled: boolean;
270
- includedAmount: number | null;
271
- unlimited: boolean;
272
- overageEnabled: boolean;
273
- creditsPerUnit: number | null;
850
+ interface SubscriptionAddon {
851
+ addonId: string;
852
+ status: "active";
853
+ proratedCharge: number;
854
+ object: "subscription";
855
+ livemode: boolean;
274
856
  }
275
- interface FixedPricingFeatureManage extends PlanFeatureManageBase {
276
- pricingMode: "fixed";
277
- overageUnitPrice: number | null;
278
- margin: null;
857
+ interface TestClock {
858
+ simulatedTime: string | null;
859
+ isActive: boolean;
860
+ /** @format date-time */
861
+ now: string;
862
+ object: "test_clock";
863
+ livemode: boolean;
279
864
  }
280
- interface AiModelPricingFeatureManage extends PlanFeatureManageBase {
281
- pricingMode: "ai_model";
282
- margin: number;
283
- overageUnitPrice: null;
865
+ interface TestClockBilling {
866
+ customersFound: number;
867
+ enqueued: number;
868
+ failed: number;
869
+ object: "test_clock";
870
+ livemode: boolean;
284
871
  }
285
- type PlanFeatureManage = FixedPricingFeatureManage | AiModelPricingFeatureManage;
286
- interface PlanPriceManage {
872
+ interface Transaction {
287
873
  id: string;
288
- object: "plan_price";
289
- livemode: boolean;
290
- planId: string;
291
- billingInterval: BillingInterval;
292
- price: number;
293
- isDefault: boolean;
294
- trialDays: number;
295
- includedBalance: number | null;
296
- includedCredits: number | null;
297
- introOfferEnabled: boolean;
298
- introOfferDiscountType: DiscountType | null;
299
- introOfferDiscountValue: number | null;
300
- introOfferDurationCycles: number | null;
874
+ invoiceId: string | null;
875
+ grossAmount: number;
876
+ subtotal: number;
877
+ taxAmount: number;
878
+ currency: string;
879
+ status: TransactionStatus;
880
+ customerEmail: string | null;
881
+ customerName: string | null;
882
+ paidAt: string | null;
883
+ /** @format date-time */
301
884
  createdAt: string;
885
+ /** @format date-time */
302
886
  updatedAt: string;
887
+ availableAt?: string | null;
888
+ object: "transaction";
889
+ livemode: boolean;
303
890
  }
304
- interface RegionalPriceResult {
305
- priceId: string;
306
- overrides: Array<{
307
- currency: string;
308
- price: number;
309
- }>;
310
- }
311
- interface DeleteResult {
891
+ interface TransactionRefund {
312
892
  id: string;
313
- deleted: true;
893
+ status: "refunded";
894
+ object: "transaction";
895
+ livemode: boolean;
314
896
  }
315
- interface RemoveResult {
897
+ interface TransactionRetry {
316
898
  id: string;
317
- removed: true;
318
- }
319
- interface CreatePlanParams {
320
- name: string;
321
- code: string;
322
- description?: string;
323
- consumptionModel?: ConsumptionModel;
324
- isPublic?: boolean;
325
- isFree?: boolean;
326
- blockOnExhaustion?: boolean;
327
- planGroupId?: string;
328
- metadata?: Record<string, unknown>;
899
+ status: "processing";
900
+ retryInvoiceNumber: string;
901
+ object: "transaction";
902
+ livemode: boolean;
329
903
  }
330
- interface UpdatePlanParams {
904
+ interface UncanceledSubscription {
331
905
  id: string;
332
- name?: string;
333
- description?: string;
334
- metadata?: Record<string, unknown>;
335
- isPublic?: boolean;
906
+ customerId: string;
907
+ status: SubscriptionStatus;
908
+ /** @format date-time */
909
+ updatedAt: string;
910
+ object: "subscription";
911
+ livemode: boolean;
336
912
  }
337
- interface DeletePlanParams {
338
- id: string;
913
+ interface UsageQuota {
914
+ featureCode: string;
915
+ current: number;
916
+ included: number;
917
+ remaining: number | null;
918
+ billedQuantity: number;
919
+ unlimited: boolean;
920
+ overageEnabled: boolean;
921
+ asOf: string | null;
922
+ object: "usage_quota";
923
+ livemode: boolean;
339
924
  }
340
- interface SetVisibilityParams {
925
+ interface UsageQuotaEvent {
341
926
  id: string;
342
- isPublic: boolean;
343
- }
344
- interface AddPlanFeatureBase {
345
- planId: string;
346
- featureId: string;
347
- enabled?: boolean;
348
- includedAmount?: number;
349
- unlimited?: boolean;
350
- overageEnabled?: boolean;
351
- creditsPerUnit?: number | null;
352
- }
353
- interface AddFixedPricingFeatureParams extends AddPlanFeatureBase {
354
- pricingMode?: "fixed";
355
- overageUnitPrice?: number;
356
- }
357
- interface AddAiModelPricingFeatureParams extends AddPlanFeatureBase {
358
- pricingMode: "ai_model";
359
- margin: number;
360
- }
361
- type AddPlanFeatureParams = AddFixedPricingFeatureParams | AddAiModelPricingFeatureParams;
362
- interface UpdatePlanFeatureBase {
363
- planId: string;
364
- featureId: string;
365
- enabled?: boolean;
366
- includedAmount?: number;
367
- unlimited?: boolean;
368
- overageEnabled?: boolean;
369
- creditsPerUnit?: number | null;
370
- }
371
- interface UpdateFixedPricingFeatureParams extends UpdatePlanFeatureBase {
372
- pricingMode?: "fixed";
373
- overageUnitPrice?: number;
374
- }
375
- interface UpdateAiModelPricingFeatureParams extends UpdatePlanFeatureBase {
376
- pricingMode: "ai_model";
377
- margin?: number;
378
- }
379
- type UpdatePlanFeatureParams = UpdateFixedPricingFeatureParams | UpdateAiModelPricingFeatureParams;
380
- interface RemovePlanFeatureParams {
381
- planId: string;
382
- featureId: string;
383
- }
384
- interface AddPlanPriceParams {
385
- planId: string;
386
- billingInterval: BillingInterval;
387
- price: number;
388
- trialDays?: number;
389
- isDefault?: boolean;
390
- includedBalance?: number;
391
- includedCredits?: number;
392
- introOfferEnabled?: boolean;
393
- introOfferDiscountType?: "percentage" | "amount";
394
- introOfferDiscountValue?: number;
395
- introOfferDurationCycles?: number;
396
- }
397
- interface UpdatePlanPriceParams {
398
- planId: string;
399
- priceId: string;
400
- price?: number;
401
- isDefault?: boolean;
402
- trialDays?: number;
403
- includedBalance?: number;
404
- includedCredits?: number;
405
- introOfferEnabled?: boolean;
406
- introOfferDiscountType?: "percentage" | "amount" | null;
407
- introOfferDiscountValue?: number | null;
408
- introOfferDurationCycles?: number | null;
409
- }
410
- interface DeletePlanPriceParams {
411
- planId: string;
412
- priceId: string;
413
- }
414
- interface SetDefaultPriceParams {
415
- planId: string;
416
- priceId: string;
417
- }
418
- interface SetRegionalPricesParams {
419
- planId: string;
420
- priceId: string;
421
- overrides: Array<{
422
- currency: string;
423
- price: number;
424
- }>;
425
- }
426
- interface DeleteRegionalPricesParams {
427
- planId: string;
428
- priceId: string;
429
- }
430
- declare class PlansResource {
431
- private httpClient;
432
- constructor(httpClient: CommetHTTPClient);
433
- list(params?: ListPlansParams): Promise<ApiResponse<Plan[]>>;
434
- get(params: {
435
- id: string;
436
- }): Promise<ApiResponse<PlanDetail>>;
437
- create(params: CreatePlanParams, options?: RequestOptions): Promise<ApiResponse<PlanManage>>;
438
- update(params: UpdatePlanParams, options?: RequestOptions): Promise<ApiResponse<PlanManage>>;
439
- delete(params: DeletePlanParams, options?: RequestOptions): Promise<ApiResponse<DeleteResult>>;
440
- setVisibility(params: SetVisibilityParams, options?: RequestOptions): Promise<ApiResponse<PlanManage>>;
441
- addFeature(params: AddPlanFeatureParams, options?: RequestOptions): Promise<ApiResponse<PlanFeatureManage>>;
442
- updateFeature(params: UpdatePlanFeatureParams, options?: RequestOptions): Promise<ApiResponse<PlanFeatureManage>>;
443
- removeFeature(params: RemovePlanFeatureParams, options?: RequestOptions): Promise<ApiResponse<RemoveResult>>;
444
- addPrice(params: AddPlanPriceParams, options?: RequestOptions): Promise<ApiResponse<PlanPriceManage>>;
445
- updatePrice(params: UpdatePlanPriceParams, options?: RequestOptions): Promise<ApiResponse<PlanPriceManage>>;
446
- deletePrice(params: DeletePlanPriceParams, options?: RequestOptions): Promise<ApiResponse<DeleteResult>>;
447
- setDefaultPrice(params: SetDefaultPriceParams, options?: RequestOptions): Promise<ApiResponse<PlanPriceManage>>;
448
- setRegionalPrices(params: SetRegionalPricesParams, options?: RequestOptions): Promise<ApiResponse<RegionalPriceResult>>;
449
- deleteRegionalPrices(params: DeleteRegionalPricesParams, options?: RequestOptions): Promise<ApiResponse<DeleteResult>>;
927
+ customerId: string;
928
+ featureCode: string;
929
+ previousBalance: number;
930
+ newBalance: number;
931
+ /** @format date-time */
932
+ ts: string;
933
+ /** @format date-time */
934
+ createdAt: string;
935
+ object: "usage_quota";
936
+ livemode: boolean;
450
937
  }
451
938
 
452
- type AddonConsumptionModel = "boolean" | "metered" | "credits" | "balance";
453
- interface ActiveAddon {
454
- object: "addon";
455
- livemode: boolean;
456
- slug: string;
457
- name: string;
458
- basePrice: number;
459
- featureCode: string;
460
- featureName: string;
461
- featureType: FeatureType;
462
- consumptionModel: AddonConsumptionModel | null;
463
- activatedAt: string;
939
+ declare class CommetHTTPClient {
940
+ private config;
941
+ private retryConfig;
942
+ private telemetryEnabled;
943
+ private lastRequestMetrics;
944
+ constructor(config: CommetClientOptions);
945
+ get<T = unknown>(endpoint: string, params?: Record<string, unknown> | object, options?: RequestOptions): Promise<ApiResponse<T>>;
946
+ post<T = unknown>(endpoint: string, data?: unknown, options?: RequestOptions): Promise<ApiResponse<T>>;
947
+ put<T = unknown>(endpoint: string, data?: unknown, options?: RequestOptions): Promise<ApiResponse<T>>;
948
+ delete<T = unknown>(endpoint: string, data?: unknown, options?: RequestOptions): Promise<ApiResponse<T>>;
949
+ private resolveApiVersion;
950
+ private static readonly BODY_METHODS;
951
+ private request;
952
+ /**
953
+ * Execute real API request with retry logic
954
+ */
955
+ private executeRequest;
956
+ /**
957
+ * Build full URL from endpoint and params
958
+ */
959
+ private buildURL;
960
+ private generateIdempotencyKey;
961
+ /**
962
+ * Sleep for specified milliseconds
963
+ */
964
+ private sleep;
464
965
  }
966
+
465
967
  interface ListActiveAddonsParams {
466
- customerId: CustomerID;
467
- }
468
- interface AddonBase {
469
- id: string;
470
- object: "addon";
471
- livemode: boolean;
472
- name: string;
473
- slug: string;
474
- description: string | null;
475
- basePrice: number;
476
- featureCode: string;
477
- featureName: string;
478
- createdAt: string;
479
- updatedAt: string;
968
+ customerId: string;
480
969
  }
481
- interface BooleanAddon extends AddonBase {
482
- consumptionModel: "boolean";
483
- includedUnits: null;
484
- overageRate: null;
485
- creditCost: null;
486
- }
487
- interface MeteredAddon extends AddonBase {
488
- consumptionModel: "metered";
489
- includedUnits: number;
490
- overageRate: number;
491
- creditCost: null;
492
- }
493
- interface CreditsAddon extends AddonBase {
494
- consumptionModel: "credits";
495
- includedUnits: null;
496
- overageRate: null;
497
- creditCost: number;
498
- }
499
- interface BalanceAddon extends AddonBase {
500
- consumptionModel: "balance";
501
- includedUnits: null;
502
- overageRate: number;
503
- creditCost: null;
504
- }
505
- type Addon = BooleanAddon | MeteredAddon | CreditsAddon | BalanceAddon;
506
970
  interface ListAddonsParams {
507
971
  limit?: number;
508
972
  cursor?: string;
@@ -510,29 +974,16 @@ interface ListAddonsParams {
510
974
  interface GetAddonParams {
511
975
  id: string;
512
976
  }
513
- interface CreateAddonBase {
977
+ interface CreateAddonParams {
514
978
  name: string;
515
979
  description?: string;
516
980
  basePrice: number;
517
981
  featureId: string;
982
+ consumptionModel: "boolean" | "metered" | "credits" | "balance";
983
+ includedUnits?: number;
984
+ overageRate?: number;
985
+ creditCost?: number;
518
986
  }
519
- interface CreateBooleanAddonParams extends CreateAddonBase {
520
- consumptionModel: "boolean";
521
- }
522
- interface CreateMeteredAddonParams extends CreateAddonBase {
523
- consumptionModel: "metered";
524
- includedUnits: number;
525
- overageRate: number;
526
- }
527
- interface CreateCreditsAddonParams extends CreateAddonBase {
528
- consumptionModel: "credits";
529
- creditCost: number;
530
- }
531
- interface CreateBalanceAddonParams extends CreateAddonBase {
532
- consumptionModel: "balance";
533
- overageRate: number;
534
- }
535
- type CreateAddonParams = CreateBooleanAddonParams | CreateMeteredAddonParams | CreateCreditsAddonParams | CreateBalanceAddonParams;
536
987
  interface UpdateAddonParams {
537
988
  id: string;
538
989
  name?: string;
@@ -547,34 +998,24 @@ interface DeleteAddonParams {
547
998
  declare class AddonsResource {
548
999
  private httpClient;
549
1000
  constructor(httpClient: CommetHTTPClient);
550
- listActive(params: ListActiveAddonsParams, options?: RequestOptions): Promise<ApiResponse<ActiveAddon[]>>;
551
- list(params?: ListAddonsParams, options?: RequestOptions): Promise<ApiResponse<Addon[]>>;
1001
+ /** List all active add-ons for a customer's subscription. */
1002
+ listActive(params: ListActiveAddonsParams, options?: RequestOptions): Promise<ApiResponse<Array<ActiveAddon>>>;
1003
+ /** List all add-ons with cursor-based pagination. */
1004
+ list(params?: ListAddonsParams, options?: RequestOptions): Promise<ApiResponse<Array<Addon>>>;
1005
+ /** Retrieve an add-on by its public ID or slug. */
552
1006
  get(params: GetAddonParams, options?: RequestOptions): Promise<ApiResponse<Addon>>;
1007
+ /** Create a new add-on linked to a feature. Each feature can only be assigned to one add-on. */
553
1008
  create(params: CreateAddonParams, options?: RequestOptions): Promise<ApiResponse<Addon>>;
1009
+ /** Update an add-on's name, description, or pricing. */
554
1010
  update(params: UpdateAddonParams, options?: RequestOptions): Promise<ApiResponse<Addon>>;
555
- /** Fails if addon has active subscriptions. */
556
- delete(params: DeleteAddonParams, options?: RequestOptions): Promise<ApiResponse<{
557
- id: string;
558
- deleted: true;
559
- }>>;
1011
+ /** Soft-delete an add-on. Fails if the add-on has active subscriptions. */
1012
+ delete(params: DeleteAddonParams, options?: RequestOptions): Promise<ApiResponse<DeletedObject>>;
560
1013
  }
561
1014
 
562
- interface ApiKey {
563
- id: string;
564
- object: "api_key";
565
- livemode: boolean;
566
- name: string;
567
- prefix: string;
568
- expiresAt: string | null;
569
- lastUsedAt: string | null;
570
- createdAt: string;
571
- }
572
- interface ApiKeyCreated extends ApiKey {
573
- apiKey: string;
574
- }
575
1015
  interface ListApiKeysParams {
576
- limit?: number;
1016
+ /** @format date-time */
577
1017
  cursor?: string;
1018
+ limit?: number;
578
1019
  }
579
1020
  interface CreateApiKeyParams {
580
1021
  name: string;
@@ -585,35 +1026,15 @@ interface DeleteApiKeyParams {
585
1026
  }
586
1027
  declare class ApiKeysResource {
587
1028
  private httpClient;
588
- constructor(httpClient: CommetHTTPClient);
589
- list(params?: ListApiKeysParams): Promise<ApiResponse<ApiKey[]>>;
590
- /** Response includes full `apiKey` which is only returned once. */
591
- create(params: CreateApiKeyParams, options?: RequestOptions): Promise<ApiResponse<ApiKeyCreated>>;
592
- delete(params: DeleteApiKeyParams, options?: RequestOptions): Promise<ApiResponse<void>>;
593
- }
594
-
595
- interface CreditPack {
596
- id: string;
597
- object: "credit_pack";
598
- livemode: boolean;
599
- name: string;
600
- description: string | null;
601
- credits: number;
602
- price: number;
603
- currency: string;
604
- }
605
- interface CreditPackDetail {
606
- id: string;
607
- object: "credit_pack";
608
- livemode: boolean;
609
- name: string;
610
- description: string | null;
611
- credits: number;
612
- price: number;
613
- isActive: boolean;
614
- createdAt: string;
615
- updatedAt: string;
1029
+ constructor(httpClient: CommetHTTPClient);
1030
+ /** List API keys with cursor-based pagination. Keys are returned without the full secret. */
1031
+ list(params?: ListApiKeysParams, options?: RequestOptions): Promise<ApiResponse<Array<ApiKey>>>;
1032
+ /** Create a new API key. The full key is only returned once in the response. */
1033
+ create(params: CreateApiKeyParams, options?: RequestOptions): Promise<ApiResponse<CreatedApiKey>>;
1034
+ /** Permanently revoke and delete an API key. */
1035
+ delete(params: DeleteApiKeyParams, options?: RequestOptions): Promise<ApiResponse<DeletedObject>>;
616
1036
  }
1037
+
617
1038
  interface CreateCreditPackParams {
618
1039
  name: string;
619
1040
  description?: string;
@@ -635,139 +1056,122 @@ interface DeleteCreditPackParams {
635
1056
  declare class CreditPacksResource {
636
1057
  private httpClient;
637
1058
  constructor(httpClient: CommetHTTPClient);
638
- list(): Promise<ApiResponse<CreditPack[]>>;
639
- create(params: CreateCreditPackParams, options?: RequestOptions): Promise<ApiResponse<CreditPackDetail>>;
640
- update(params: UpdateCreditPackParams, options?: RequestOptions): Promise<ApiResponse<CreditPackDetail>>;
641
- delete(params: DeleteCreditPackParams, options?: RequestOptions): Promise<ApiResponse<{
642
- id: string;
643
- deleted: true;
644
- }>>;
1059
+ /** List all active credit packs. */
1060
+ list(): Promise<ApiResponse<Array<CreditPack>>>;
1061
+ /** Create a new credit pack. */
1062
+ create(params: CreateCreditPackParams, options?: RequestOptions): Promise<ApiResponse<CreditPack>>;
1063
+ /** Update a credit pack's name, description, credits, price, or active status. */
1064
+ update(params: UpdateCreditPackParams, options?: RequestOptions): Promise<ApiResponse<CreditPack>>;
1065
+ /** Soft-delete a credit pack. */
1066
+ delete(params: DeleteCreditPackParams, options?: RequestOptions): Promise<ApiResponse<DeletedObject>>;
645
1067
  }
646
1068
 
647
- interface Customer {
648
- id: CustomerID;
649
- object: "customer";
650
- livemode: boolean;
651
- organizationId: string;
652
- fullName?: string;
653
- domain?: string;
654
- website?: string;
655
- billingEmail: string;
656
- timezone?: string;
657
- language?: string;
658
- industry?: string;
659
- employeeCount?: string;
660
- metadata?: Record<string, unknown>;
661
- createdAt: string;
662
- updatedAt: string;
663
- }
664
- interface CustomerAddress {
665
- line1: string;
666
- line2?: string;
667
- city: string;
668
- state?: string;
669
- postalCode: string;
670
- country: string;
1069
+ interface ListCustomersParams {
1070
+ externalId?: string;
1071
+ limit?: number;
1072
+ cursor?: string;
671
1073
  }
672
- interface CreateParams {
673
- email: string;
1074
+ interface CreateCustomerParams {
674
1075
  id?: string;
1076
+ externalId?: string;
675
1077
  fullName?: string;
676
- domain?: string;
677
- website?: string;
678
- timezone?: string;
679
- language?: string;
680
- industry?: string;
1078
+ address?: {
1079
+ line1: string;
1080
+ line2?: string;
1081
+ city: string;
1082
+ state?: string;
1083
+ postalCode: string;
1084
+ country: string;
1085
+ region?: string;
1086
+ };
1087
+ addressId?: string;
1088
+ email: string;
1089
+ timezone?: Timezone;
681
1090
  metadata?: Record<string, unknown>;
682
- address?: CustomerAddress;
683
1091
  }
684
1092
  interface GetCustomerParams {
685
- id: CustomerID;
1093
+ id: string;
686
1094
  }
687
- interface UpdateParams {
688
- id: CustomerID;
1095
+ interface UpdateCustomerParams {
1096
+ id: string;
689
1097
  email?: string;
690
1098
  fullName?: string;
691
- domain?: string;
692
- website?: string;
693
- timezone?: string;
694
- language?: string;
695
- industry?: string;
1099
+ externalId?: string;
1100
+ timezone?: Timezone;
696
1101
  metadata?: Record<string, unknown>;
697
- address?: CustomerAddress;
698
- }
699
- interface ListCustomersParams extends ListParams {
700
- search?: string;
1102
+ address?: {
1103
+ line1: string;
1104
+ line2?: string;
1105
+ city: string;
1106
+ state?: string;
1107
+ postalCode: string;
1108
+ country: string;
1109
+ region?: string;
1110
+ };
701
1111
  }
702
- interface BatchResult {
703
- successful: Customer[];
704
- failed: Array<{
705
- index: number;
706
- error: string;
707
- data: CreateParams;
1112
+ interface BatchCreateCustomersParams {
1113
+ customers: Array<{
1114
+ email: string;
1115
+ id?: string;
1116
+ externalId?: string;
1117
+ fullName?: string;
1118
+ timezone?: Timezone;
1119
+ metadata?: Record<string, unknown>;
1120
+ address?: {
1121
+ line1: string;
1122
+ line2?: string;
1123
+ city: string;
1124
+ state?: string;
1125
+ postalCode: string;
1126
+ country: string;
1127
+ region?: string;
1128
+ };
708
1129
  }>;
709
1130
  }
710
1131
  declare class CustomersResource {
711
1132
  private httpClient;
712
1133
  constructor(httpClient: CommetHTTPClient);
713
- /** Idempotent when `id` is provided — returns existing customer instead of duplicating. */
714
- create(params: CreateParams, options?: RequestOptions): Promise<ApiResponse<Customer>>;
715
- createBatch(params: {
716
- customers: CreateParams[];
717
- }, options?: RequestOptions): Promise<ApiResponse<BatchResult>>;
718
- get(params: GetCustomerParams): Promise<ApiResponse<Customer>>;
719
- update(params: UpdateParams, options?: RequestOptions): Promise<ApiResponse<Customer>>;
720
- list(params?: ListCustomersParams): Promise<ApiResponse<Customer[]>>;
1134
+ /** List customers with cursor-based pagination. */
1135
+ list(params?: ListCustomersParams, options?: RequestOptions): Promise<ApiResponse<Array<Customer>>>;
1136
+ /** Create a new customer. Idempotent when customerId is provided. */
1137
+ create(params: CreateCustomerParams, options?: RequestOptions): Promise<ApiResponse<Customer>>;
1138
+ /** Retrieve a customer by their public ID, including subscription status and metadata. */
1139
+ get(params: GetCustomerParams, options?: RequestOptions): Promise<ApiResponse<Customer>>;
1140
+ /** Update a customer's name, external ID, or metadata. */
1141
+ update(params: UpdateCustomerParams, options?: RequestOptions): Promise<ApiResponse<Customer>>;
1142
+ /** Create up to 100 customers in a single request. */
1143
+ createBatch(params: BatchCreateCustomersParams, options?: RequestOptions): Promise<ApiResponse<CustomerBatch>>;
721
1144
  }
722
1145
 
723
- interface GetFeatureParams {
724
- customerId: CustomerID;
725
- code: string;
1146
+ interface ListFeatureAccessParams {
1147
+ customerId: string;
726
1148
  }
727
- interface CanUseFeatureParams {
728
- customerId: CustomerID;
1149
+ interface GetFeatureAccessParams {
729
1150
  code: string;
1151
+ customerId: string;
1152
+ action?: string;
730
1153
  }
731
- interface ListFeaturesParams {
732
- customerId: CustomerID;
733
- }
734
- interface FeatureAccess {
735
- object: "feature";
736
- livemode: boolean;
1154
+ interface CanUseFeatureParams {
737
1155
  code: string;
738
- name: string;
739
- type: FeatureType;
740
- allowed: boolean;
741
- enabled?: boolean;
742
- current?: number;
743
- included?: number;
744
- remaining?: number;
745
- overage?: number;
746
- overageUnitPrice?: number;
747
- billedQuantity?: number;
748
- unlimited?: boolean;
749
- overageEnabled?: boolean;
1156
+ customerId: string;
750
1157
  }
751
- interface CanUseResult {
752
- allowed: boolean;
753
- willBeCharged: boolean;
754
- reason?: string;
1158
+ declare class FeatureAccessResource {
1159
+ private httpClient;
1160
+ constructor(httpClient: CommetHTTPClient);
1161
+ /** List all features for a customer's active subscription, scoped by the customerId query parameter. */
1162
+ list(params: ListFeatureAccessParams, options?: RequestOptions): Promise<ApiResponse<Array<FeatureAccess>>>;
1163
+ /** Get feature access details for a customer. Use action=canUse to check if the customer can consume one more unit. */
1164
+ get(params: GetFeatureAccessParams, options?: RequestOptions): Promise<ApiResponse<FeatureLookup>>;
1165
+ /** Get feature access details for a customer. Use action=canUse to check if the customer can consume one more unit. */
1166
+ canUse(params: CanUseFeatureParams, options?: RequestOptions): Promise<ApiResponse<FeatureLookup>>;
755
1167
  }
756
- interface Feature {
757
- id: string;
758
- object: "feature";
759
- livemode: boolean;
760
- name: string;
1168
+
1169
+ interface GetFeatureParams {
761
1170
  code: string;
762
- type: FeatureType;
763
- description: string | null;
764
- unitName: string | null;
765
- createdAt: string;
766
- updatedAt: string;
767
1171
  }
768
1172
  interface CreateFeatureParams {
769
- code: string;
770
1173
  name: string;
1174
+ code: string;
771
1175
  type: FeatureType;
772
1176
  description?: string;
773
1177
  unitName?: string;
@@ -775,8 +1179,8 @@ interface CreateFeatureParams {
775
1179
  interface UpdateFeatureParams {
776
1180
  code: string;
777
1181
  name?: string;
778
- description?: string;
779
- unitName?: string;
1182
+ description?: string | null;
1183
+ unitName?: string | null;
780
1184
  }
781
1185
  interface DeleteFeatureParams {
782
1186
  code: string;
@@ -784,117 +1188,36 @@ interface DeleteFeatureParams {
784
1188
  declare class FeaturesResource {
785
1189
  private httpClient;
786
1190
  constructor(httpClient: CommetHTTPClient);
787
- get(params: GetFeatureParams, options?: RequestOptions): Promise<ApiResponse<FeatureAccess>>;
788
- /** Checks if the customer can consume one more unit — returns billing impact and reason if blocked. */
789
- canUse(params: CanUseFeatureParams, options?: RequestOptions): Promise<ApiResponse<CanUseResult>>;
790
- list(params: ListFeaturesParams, options?: RequestOptions): Promise<ApiResponse<FeatureAccess[]>>;
1191
+ /** List every feature defined in the organization. This is the organization's feature catalog (definitions), not a customer's feature access. */
1192
+ list(): Promise<ApiResponse<Array<Feature>>>;
1193
+ /** Get a single feature definition by code from the organization's feature catalog. */
1194
+ get(params: GetFeatureParams, options?: RequestOptions): Promise<ApiResponse<Feature>>;
1195
+ /** Create a new feature. Code must be lowercase alphanumeric with underscores. */
791
1196
  create(params: CreateFeatureParams, options?: RequestOptions): Promise<ApiResponse<Feature>>;
1197
+ /** Update a feature's name, description, or unit name. At least one field must be provided. */
792
1198
  update(params: UpdateFeatureParams, options?: RequestOptions): Promise<ApiResponse<Feature>>;
793
- /** Fails if feature is attached to active plans or has an active addon. */
794
- delete(params: DeleteFeatureParams, options?: RequestOptions): Promise<ApiResponse<{
795
- id: string;
796
- deleted: true;
797
- }>>;
1199
+ /** Delete a feature. Fails if the feature is attached to active plans or has an active add-on. */
1200
+ delete(params: DeleteFeatureParams, options?: RequestOptions): Promise<ApiResponse<DeletedObject>>;
798
1201
  }
799
1202
 
800
- type InvoiceStatus = "draft" | "upcoming" | "outstanding" | "paid" | "void" | "uncollectible";
801
- type InvoiceType = "recurring" | "overage" | "plan_change" | "adjustment" | "credit_purchase" | "balance_topup" | "addon_activation";
802
- type InvoiceLineType = "plan_base" | "feature_overage" | "feature_seats" | "feature_quota" | "discount" | "credit" | "addon_base";
803
- type ChargeType = "standard" | "advance" | "true_up";
804
- interface InvoiceLineItem {
805
- lineType: InvoiceLineType;
806
- featureName: string | null;
807
- description: string | null;
808
- quantity: number;
809
- unitAmount: number;
810
- amount: number;
811
- includedAmount: number | null;
812
- usedAmount: number | null;
813
- overageAmount: number | null;
814
- discountType: DiscountType | null;
815
- discountValue: number | null;
816
- discountName: string | null;
817
- chargeType: ChargeType | null;
818
- }
819
- interface InvoiceListItem {
820
- id: string;
821
- object: "invoice";
822
- livemode: boolean;
823
- customerId: string;
824
- subscriptionId: string | null;
825
- invoiceNumber: string;
826
- status: InvoiceStatus;
827
- invoiceType: InvoiceType;
828
- currency: string;
829
- subtotal: number;
830
- discountAmount: number;
831
- taxAmount: number;
832
- total: number;
833
- periodStart: string | null;
834
- periodEnd: string | null;
835
- issueDate: string;
836
- dueDate: string | null;
837
- memo: string | null;
838
- metadata: Record<string, unknown> | null;
839
- createdAt: string;
840
- updatedAt: string;
841
- }
842
- interface InvoiceDetail extends InvoiceListItem {
843
- creditApplied: number;
844
- planName: string | null;
845
- poNumber: string | null;
846
- reference: string | null;
847
- lineItems: InvoiceLineItem[];
848
- }
849
- interface InvoiceDownloadResult {
850
- url: string;
851
- expiresAt: string;
852
- }
853
- interface InvoiceSendResult {
854
- sent: boolean;
855
- sentAt: string;
856
- }
857
- interface InvoiceStatusResult {
858
- id: string;
859
- status: "paid" | "void";
860
- updatedAt: string;
861
- }
862
- interface CreateAdjustmentResult {
863
- id: string;
864
- object: "invoice";
865
- livemode: boolean;
866
- customerId: string;
867
- invoiceNumber: string;
868
- status: "outstanding" | "paid";
869
- invoiceType: InvoiceType;
870
- currency: string;
871
- subtotal: number;
872
- taxAmount: number;
873
- total: number;
874
- issueDate: string;
875
- dueDate: string | null;
876
- memo: string | null;
877
- metadata: Record<string, unknown> | null;
878
- createdAt: string;
879
- updatedAt: string;
880
- }
881
1203
  interface ListInvoicesParams {
882
1204
  customerId?: string;
883
- status?: InvoiceStatus;
1205
+ status?: "draft" | "outstanding" | "paid" | "void" | "uncollectible";
884
1206
  subscriptionId?: string;
885
- limit?: number;
1207
+ /** @format date-time */
886
1208
  cursor?: string;
1209
+ limit?: number;
887
1210
  }
888
1211
  interface GetInvoiceParams {
889
1212
  id: string;
890
1213
  }
891
- interface CreateAdjustmentParams {
1214
+ interface CreateAdjustmentInvoiceParams {
892
1215
  customerId: string;
893
1216
  amount: number;
894
- description?: string;
1217
+ description: string;
895
1218
  metadata?: Record<string, unknown>;
896
1219
  }
897
- interface GetDownloadUrlParams {
1220
+ interface DownloadInvoiceParams {
898
1221
  id: string;
899
1222
  }
900
1223
  interface SendInvoiceParams {
@@ -907,35 +1230,88 @@ interface UpdateInvoiceStatusParams {
907
1230
  declare class InvoicesResource {
908
1231
  private httpClient;
909
1232
  constructor(httpClient: CommetHTTPClient);
910
- list(params?: ListInvoicesParams): Promise<ApiResponse<InvoiceListItem[]>>;
911
- get(params: GetInvoiceParams): Promise<ApiResponse<InvoiceDetail>>;
912
- /** Negative amount creates a credit. */
913
- createAdjustment(params: CreateAdjustmentParams, options?: RequestOptions): Promise<ApiResponse<CreateAdjustmentResult>>;
914
- /** Signed URL, expires after 7 days. */
915
- getDownloadUrl(params: GetDownloadUrlParams): Promise<ApiResponse<InvoiceDownloadResult>>;
916
- send(params: SendInvoiceParams, options?: RequestOptions): Promise<ApiResponse<InvoiceSendResult>>;
917
- /** Only outstanding invoices can be changed to paid or void. */
918
- updateStatus(params: UpdateInvoiceStatusParams, options?: RequestOptions): Promise<ApiResponse<InvoiceStatusResult>>;
1233
+ /** List invoices with cursor-based pagination. Filter by customer, status, or subscription. */
1234
+ list(params?: ListInvoicesParams, options?: RequestOptions): Promise<ApiResponse<Array<Invoice>>>;
1235
+ /** Retrieve a single invoice by its public ID, including line items. */
1236
+ get(params: GetInvoiceParams, options?: RequestOptions): Promise<ApiResponse<Invoice>>;
1237
+ /** Create a one-off adjustment invoice. Use a negative amount for a credit. */
1238
+ createAdjustment(params: CreateAdjustmentInvoiceParams, options?: RequestOptions): Promise<ApiResponse<CreatedInvoice>>;
1239
+ /** Generate a signed URL to download the invoice as a PDF. The URL expires after 7 days. */
1240
+ getDownloadUrl(params: DownloadInvoiceParams, options?: RequestOptions): Promise<ApiResponse<InvoiceDownload>>;
1241
+ /** Send the invoice to the customer via email. */
1242
+ send(params: SendInvoiceParams, options?: RequestOptions): Promise<ApiResponse<SentInvoice>>;
1243
+ /** Mark an outstanding invoice as "paid" or "void". Cannot change the status of already paid or voided invoices. */
1244
+ updateStatus(params: UpdateInvoiceStatusParams, options?: RequestOptions): Promise<ApiResponse<InvoiceStatus>>;
919
1245
  }
920
1246
 
921
- interface PlanGroup {
922
- id: string;
923
- object: "plan_group";
924
- livemode: boolean;
925
- name: string;
926
- description: string | null;
927
- isPublic: boolean;
928
- createdAt: string;
929
- updatedAt: string;
1247
+ interface AddPayoutBankAccountParams {
1248
+ accountNumber: string;
1249
+ accountHolderName: string;
1250
+ routingNumber?: string;
1251
+ accountType?: "checking" | "savings";
1252
+ setDefault?: boolean;
1253
+ }
1254
+ interface RequestPayoutParams {
1255
+ amount: number;
1256
+ description?: string;
930
1257
  }
931
- interface PlanGroupDetail extends PlanGroup {
932
- plans: Array<{
933
- id: string;
934
- code: string;
1258
+ interface CompletePayoutVerificationParams {
1259
+ email: string;
1260
+ businessType: "individual" | "company";
1261
+ businessUrl: string;
1262
+ documentUrl: string;
1263
+ bank: {
1264
+ accountNumber: string;
1265
+ accountHolderName: string;
1266
+ routingNumber?: string;
1267
+ accountType?: "checking" | "savings";
1268
+ };
1269
+ individual?: {
1270
+ firstName: string;
1271
+ lastName: string;
1272
+ phone: string;
1273
+ dateOfBirth: string;
1274
+ ssnLast4?: string;
1275
+ idNumber?: string;
1276
+ address: {
1277
+ line1: string;
1278
+ line2?: string;
1279
+ city: string;
1280
+ state?: string;
1281
+ postalCode: string;
1282
+ country: string;
1283
+ };
1284
+ };
1285
+ company?: {
935
1286
  name: string;
936
- sortOrder: number;
937
- }>;
1287
+ taxId: string;
1288
+ address: {
1289
+ line1: string;
1290
+ line2?: string;
1291
+ city: string;
1292
+ state?: string;
1293
+ postalCode: string;
1294
+ country: string;
1295
+ };
1296
+ representative: {
1297
+ firstName: string;
1298
+ lastName: string;
1299
+ phone?: string;
1300
+ email?: string;
1301
+ };
1302
+ };
938
1303
  }
1304
+ declare class PayoutsResource {
1305
+ private httpClient;
1306
+ constructor(httpClient: CommetHTTPClient);
1307
+ /** Add an additional destination bank account to the organization's existing payout account. Country and currency are resolved from the organization. The full account number is never returned — only `last4`. */
1308
+ addBankAccount(params: AddPayoutBankAccountParams, options?: RequestOptions): Promise<ApiResponse<PayoutBankAccount>>;
1309
+ /** Withdraw available balance to the organization's verified payout account. `amount` is in cents (USD, minimum 1000 = $10). The payout is created in `pending` and settles to `paid` asynchronously as provider webhooks arrive. */
1310
+ request(params: RequestPayoutParams, options?: RequestOptions): Promise<ApiResponse<Payout>>;
1311
+ /** Provision the organization's payout account in a single call with the full KYC + bank payload. Uploads the identity document, persists the destination bank, and creates the connected account through the org's payout provider. The account starts `pending_verification` and flips to `verified` via the provider's webhook. Idempotent: returns the existing account if the org already has one. */
1312
+ completeVerification(params: CompletePayoutVerificationParams, options?: RequestOptions): Promise<ApiResponse<PayoutVerification>>;
1313
+ }
1314
+
939
1315
  interface ListPlanGroupsParams {
940
1316
  limit?: number;
941
1317
  cursor?: string;
@@ -951,7 +1327,7 @@ interface CreatePlanGroupParams {
951
1327
  interface UpdatePlanGroupParams {
952
1328
  id: string;
953
1329
  name?: string;
954
- description?: string;
1330
+ description?: string | null;
955
1331
  isPublic?: boolean;
956
1332
  }
957
1333
  interface DeletePlanGroupParams {
@@ -966,61 +1342,211 @@ interface RemovePlanFromGroupParams {
966
1342
  id: string;
967
1343
  planId: string;
968
1344
  }
969
- interface ReorderPlansParams {
1345
+ interface ReorderPlansInGroupParams {
970
1346
  id: string;
971
- planIds: string[];
1347
+ planIds: Array<string>;
972
1348
  }
973
1349
  declare class PlanGroupsResource {
974
1350
  private httpClient;
975
1351
  constructor(httpClient: CommetHTTPClient);
976
- list(params?: ListPlanGroupsParams): Promise<ApiResponse<PlanGroup[]>>;
977
- get(params: GetPlanGroupParams): Promise<ApiResponse<PlanGroupDetail>>;
1352
+ /** List plan groups with cursor-based pagination. */
1353
+ list(params?: ListPlanGroupsParams, options?: RequestOptions): Promise<ApiResponse<Array<PlanGroup>>>;
1354
+ /** Retrieve a plan group by ID, including its plans ordered by sortOrder. */
1355
+ get(params: GetPlanGroupParams, options?: RequestOptions): Promise<ApiResponse<PlanGroup>>;
1356
+ /** Create a new plan group for organizing plans. */
978
1357
  create(params: CreatePlanGroupParams, options?: RequestOptions): Promise<ApiResponse<PlanGroup>>;
1358
+ /** Update a plan group's name, description, or visibility. */
979
1359
  update(params: UpdatePlanGroupParams, options?: RequestOptions): Promise<ApiResponse<PlanGroup>>;
980
- /** Plans in the group are unlinked, not deleted. */
981
- delete(params: DeletePlanGroupParams, options?: RequestOptions): Promise<ApiResponse<void>>;
982
- addPlan(params: AddPlanToGroupParams, options?: RequestOptions): Promise<ApiResponse<PlanGroupDetail>>;
983
- removePlan(params: RemovePlanFromGroupParams, options?: RequestOptions): Promise<ApiResponse<void>>;
984
- reorderPlans(params: ReorderPlansParams, options?: RequestOptions): Promise<ApiResponse<PlanGroupDetail>>;
1360
+ /** Delete a plan group. Plans in the group are unlinked, not deleted. */
1361
+ delete(params: DeletePlanGroupParams, options?: RequestOptions): Promise<ApiResponse<DeletedObject>>;
1362
+ /** Add an existing plan to a plan group with optional sort order. */
1363
+ addPlan(params: AddPlanToGroupParams, options?: RequestOptions): Promise<ApiResponse<AddedPlanToGroup>>;
1364
+ /** Remove a plan from a plan group. */
1365
+ removePlan(params: RemovePlanFromGroupParams, options?: RequestOptions): Promise<ApiResponse<RemovedPlanFromGroup>>;
1366
+ /** Set the display order of plans within a group. All plan IDs in the group must be provided. */
1367
+ reorderPlans(params: ReorderPlansInGroupParams, options?: RequestOptions): Promise<ApiResponse<ReorderedPlans>>;
985
1368
  }
986
1369
 
987
- interface PortalAccess {
988
- success: boolean;
989
- message: string;
990
- portalUrl: string;
1370
+ interface ListPlansParams {
1371
+ includePrivate?: "true" | "false";
991
1372
  }
992
- interface GetUrlByCustomerId {
993
- customerId: CustomerID;
994
- email?: never;
1373
+ interface GetPlanParams {
1374
+ id: string;
995
1375
  }
996
- interface GetUrlByEmail {
997
- email: string;
998
- customerId?: never;
1376
+ interface CreatePlanParams {
1377
+ name: string;
1378
+ code: string;
1379
+ description?: string;
1380
+ consumptionModel?: ConsumptionModel;
1381
+ isPublic?: boolean;
1382
+ isFree?: boolean;
1383
+ blockOnExhaustion?: boolean;
1384
+ planGroupId?: string;
1385
+ metadata?: Record<string, unknown>;
1386
+ }
1387
+ interface UpdatePlanParams {
1388
+ id: string;
1389
+ name?: string;
1390
+ description?: string | null;
1391
+ metadata?: Record<string, unknown>;
1392
+ isPublic?: boolean;
1393
+ }
1394
+ interface DeletePlanParams {
1395
+ id: string;
1396
+ }
1397
+ interface SetPlanVisibilityParams {
1398
+ id: string;
1399
+ isPublic: boolean;
1400
+ }
1401
+ interface AddPlanFeatureParams {
1402
+ id: string;
1403
+ featureId: string;
1404
+ enabled?: boolean;
1405
+ includedAmount?: number;
1406
+ unlimited?: boolean;
1407
+ overage?: {
1408
+ enabled: boolean;
1409
+ unitPrice: number;
1410
+ };
1411
+ creditsPerUnit?: number | null;
1412
+ pricingMode?: "fixed" | "ai_model";
1413
+ margin?: number | null;
1414
+ }
1415
+ interface UpdatePlanFeatureParams {
1416
+ id: string;
1417
+ featureId: string;
1418
+ enabled?: boolean;
1419
+ includedAmount?: number;
1420
+ unlimited?: boolean;
1421
+ overage?: {
1422
+ enabled?: boolean;
1423
+ unitPrice?: number;
1424
+ };
1425
+ creditsPerUnit?: number | null;
1426
+ }
1427
+ interface RemovePlanFeatureParams {
1428
+ id: string;
1429
+ featureId: string;
1430
+ }
1431
+ interface AddPlanPriceParams {
1432
+ id: string;
1433
+ billingInterval: BillingInterval;
1434
+ price: number;
1435
+ trialDays?: number;
1436
+ isDefault?: boolean;
1437
+ includedBalance?: number | null;
1438
+ includedCredits?: number | null;
1439
+ introOffer?: {
1440
+ enabled: boolean;
1441
+ discountType?: DiscountType | null;
1442
+ discountValue?: number | null;
1443
+ durationCycles?: number | null;
1444
+ };
1445
+ }
1446
+ interface UpdatePlanPriceParams {
1447
+ id: string;
1448
+ priceId: string;
1449
+ price?: number;
1450
+ isDefault?: boolean;
1451
+ trialDays?: number;
1452
+ includedBalance?: number | null;
1453
+ includedCredits?: number | null;
1454
+ introOffer?: {
1455
+ enabled?: boolean;
1456
+ discountType?: DiscountType | null;
1457
+ discountValue?: number | null;
1458
+ durationCycles?: number | null;
1459
+ };
1460
+ }
1461
+ interface DeletePlanPriceParams {
1462
+ id: string;
1463
+ priceId: string;
1464
+ }
1465
+ interface SetDefaultPlanPriceParams {
1466
+ id: string;
1467
+ priceId: string;
1468
+ }
1469
+ interface UpsertRegionalPricesParams {
1470
+ id: string;
1471
+ priceId: string;
1472
+ overrides: Array<{
1473
+ currency: string;
1474
+ price: number;
1475
+ includedBalance?: number;
1476
+ }>;
1477
+ }
1478
+ interface SetPlanRegionalPricingParams {
1479
+ id: string;
1480
+ currency: "ars" | "brl" | "clp" | "cop" | "pen" | "uyu" | "pyg" | "bob" | "mxn" | "cad" | "eur" | "jpy" | "cny" | "krw" | "hkd" | "sgd" | "twd" | "inr" | "thb";
1481
+ exchangeRate: number;
1482
+ prices?: Array<{
1483
+ priceId: string;
1484
+ price: number;
1485
+ includedBalance?: number;
1486
+ }>;
1487
+ features?: Array<{
1488
+ featureId: string;
1489
+ overageUnitPrice: number;
1490
+ }>;
1491
+ introOffers?: Array<{
1492
+ priceId: string;
1493
+ discountType: DiscountType;
1494
+ discountValue: number;
1495
+ durationCycles: number;
1496
+ }>;
1497
+ }
1498
+ interface DeleteRegionalPricesParams {
1499
+ id: string;
1500
+ priceId: string;
1501
+ }
1502
+ declare class PlansResource {
1503
+ private httpClient;
1504
+ constructor(httpClient: CommetHTTPClient);
1505
+ /** List all plans with their prices and features. Optionally include private plans. */
1506
+ list(params?: ListPlansParams, options?: RequestOptions): Promise<ApiResponse<Array<Plan>>>;
1507
+ /** Get detailed plan information by code or ID. */
1508
+ get(params: GetPlanParams, options?: RequestOptions): Promise<ApiResponse<Plan>>;
1509
+ /** Create a new plan with optional consumption model, visibility, and plan group assignment. */
1510
+ create(params: CreatePlanParams, options?: RequestOptions): Promise<ApiResponse<Plan>>;
1511
+ /** Update a plan's name, description, visibility, or metadata. */
1512
+ update(params: UpdatePlanParams, options?: RequestOptions): Promise<ApiResponse<Plan>>;
1513
+ /** Soft-delete a plan. */
1514
+ delete(params: DeletePlanParams, options?: RequestOptions): Promise<ApiResponse<DeletedObject>>;
1515
+ /** Toggle a plan between public and private. */
1516
+ setVisibility(params: SetPlanVisibilityParams, options?: RequestOptions): Promise<ApiResponse<PlanVisibility>>;
1517
+ /** Attach a feature to a plan with limits, overage, and credits configuration. */
1518
+ addFeature(params: AddPlanFeatureParams, options?: RequestOptions): Promise<ApiResponse<PlanFeature>>;
1519
+ /** Update limits, overage, or enabled status of a feature on a plan. */
1520
+ updateFeature(params: UpdatePlanFeatureParams, options?: RequestOptions): Promise<ApiResponse<PlanFeature>>;
1521
+ /** Detach a feature from a plan. */
1522
+ removeFeature(params: RemovePlanFeatureParams, options?: RequestOptions): Promise<ApiResponse<RemovedPlanFeature>>;
1523
+ /** Add a billing interval price to a plan with optional trial days and included balance/credits. */
1524
+ addPrice(params: AddPlanPriceParams, options?: RequestOptions): Promise<ApiResponse<PlanPrice>>;
1525
+ /** Update an existing price on a plan. */
1526
+ updatePrice(params: UpdatePlanPriceParams, options?: RequestOptions): Promise<ApiResponse<PlanPrice>>;
1527
+ /** Remove a price from a plan. */
1528
+ deletePrice(params: DeletePlanPriceParams, options?: RequestOptions): Promise<ApiResponse<DeletedObject>>;
1529
+ /** Set a specific price as the default for its plan. Unsets previous default. */
1530
+ setDefaultPrice(params: SetDefaultPlanPriceParams, options?: RequestOptions): Promise<ApiResponse<DefaultPlanPrice>>;
1531
+ /** Create or update regional currency price overrides for a plan price. */
1532
+ setRegionalPrices(params: UpsertRegionalPricesParams, options?: RequestOptions): Promise<ApiResponse<PlanRegionalPricing>>;
1533
+ /** Configure a plan's regional pricing for one currency. Sending only currency and exchangeRate derives every regional value (base price, included balance, feature overage, intro offer) from the USD value at that rate. Optional per-price and per-feature overrides are stored as manual values. */
1534
+ setRegionalPricing(params: SetPlanRegionalPricingParams, options?: RequestOptions): Promise<ApiResponse<PlanRegionalPricingResult>>;
1535
+ /** Remove all regional currency overrides for a plan price. */
1536
+ deleteRegionalPrices(params: DeleteRegionalPricesParams, options?: RequestOptions): Promise<ApiResponse<DeletedPlanRegionalPricing>>;
1537
+ }
1538
+
1539
+ interface RequestPortalAccessParams {
1540
+ email?: string;
1541
+ customerId?: string;
999
1542
  }
1000
- type GetUrlParams = GetUrlByCustomerId | GetUrlByEmail;
1001
1543
  declare class PortalResource {
1002
1544
  private httpClient;
1003
1545
  constructor(httpClient: CommetHTTPClient);
1004
- getUrl(params: GetUrlParams, options?: RequestOptions): Promise<ApiResponse<PortalAccess>>;
1546
+ /** Generate a customer portal URL. Exactly one identifier (email or customerId) is required. */
1547
+ getUrl(params?: RequestPortalAccessParams, options?: RequestOptions): Promise<ApiResponse<PortalAccess>>;
1005
1548
  }
1006
1549
 
1007
- interface PromoCode {
1008
- id: string;
1009
- object: "promo_code";
1010
- livemode: boolean;
1011
- code: string;
1012
- discountType: "percentage" | "amount";
1013
- discountValue: number;
1014
- durationCycles: number | null;
1015
- maxRedemptions: number | null;
1016
- expiresAt: string | null;
1017
- active: boolean;
1018
- redemptionCount: number;
1019
- createdAt: string;
1020
- }
1021
- interface PromoCodeDetail extends PromoCode {
1022
- updatedAt: string;
1023
- }
1024
1550
  interface ListPromoCodesParams {
1025
1551
  limit?: number;
1026
1552
  cursor?: string;
@@ -1030,453 +1556,235 @@ interface GetPromoCodeParams {
1030
1556
  }
1031
1557
  interface CreatePromoCodeParams {
1032
1558
  code: string;
1033
- discountType: "percentage" | "amount";
1559
+ discountType: DiscountType;
1034
1560
  discountValue: number;
1035
1561
  durationCycles?: number;
1036
1562
  maxRedemptions?: number;
1563
+ /** @format date-time */
1037
1564
  expiresAt?: string;
1038
- planIds?: string[];
1565
+ planIds?: Array<string>;
1039
1566
  }
1040
1567
  interface UpdatePromoCodeParams {
1041
1568
  id: string;
1042
- maxRedemptions?: number;
1043
- expiresAt?: string;
1569
+ maxRedemptions?: number | null;
1570
+ expiresAt?: string | null;
1044
1571
  active?: boolean;
1045
- planIds?: string[];
1572
+ planIds?: Array<string>;
1046
1573
  }
1047
1574
  declare class PromoCodesResource {
1048
1575
  private httpClient;
1049
1576
  constructor(httpClient: CommetHTTPClient);
1050
- list(params?: ListPromoCodesParams): Promise<ApiResponse<PromoCode[]>>;
1051
- get(params: GetPromoCodeParams): Promise<ApiResponse<PromoCodeDetail>>;
1577
+ /** List promo codes with cursor-based pagination. */
1578
+ list(params?: ListPromoCodesParams, options?: RequestOptions): Promise<ApiResponse<Array<PromoCode>>>;
1579
+ /** Retrieve a promo code by its public ID. */
1580
+ get(params: GetPromoCodeParams, options?: RequestOptions): Promise<ApiResponse<PromoCode>>;
1581
+ /** Create a new promo code. Optionally restrict to specific plans. */
1052
1582
  create(params: CreatePromoCodeParams, options?: RequestOptions): Promise<ApiResponse<PromoCode>>;
1053
- update(params: UpdatePromoCodeParams, options?: RequestOptions): Promise<ApiResponse<PromoCodeDetail>>;
1583
+ /** Update a promo code's redemption limits, expiration, active status, or plan restrictions. */
1584
+ update(params: UpdatePromoCodeParams, options?: RequestOptions): Promise<ApiResponse<PromoCode>>;
1054
1585
  }
1055
1586
 
1056
- interface QuotaEvent {
1057
- id: string;
1058
- customerId: CustomerID;
1059
- featureCode: string;
1060
- previousBalance: number;
1061
- newBalance: number;
1062
- ts: string;
1063
- createdAt: string;
1064
- }
1065
- interface QuotaAllowance {
1066
- featureCode: string;
1067
- current: number;
1068
- included: number;
1069
- remaining: number | null;
1070
- billedQuantity?: number;
1071
- unlimited: boolean;
1072
- overageEnabled: boolean;
1073
- asOf: string | null;
1074
- }
1075
1587
  interface AddQuotaParams {
1076
- customerId: CustomerID;
1588
+ customerId?: string;
1589
+ externalId?: string;
1077
1590
  featureCode: string;
1078
1591
  count?: number;
1592
+ idempotencyKey?: string;
1079
1593
  }
1080
1594
  interface SetQuotaParams {
1081
- customerId: CustomerID;
1595
+ customerId?: string;
1596
+ externalId?: string;
1082
1597
  featureCode: string;
1083
1598
  count: number;
1599
+ idempotencyKey?: string;
1084
1600
  }
1085
1601
  interface RemoveQuotaParams {
1086
- customerId: CustomerID;
1602
+ customerId?: string;
1603
+ externalId?: string;
1087
1604
  featureCode: string;
1088
1605
  count?: number;
1606
+ idempotencyKey?: string;
1089
1607
  }
1090
- interface GetQuotaParams {
1091
- customerId: CustomerID;
1608
+ interface GetQuotaAllowanceParams {
1609
+ customerId: string;
1092
1610
  featureCode: string;
1093
1611
  }
1094
- interface GetAllQuotaParams {
1095
- customerId: CustomerID;
1612
+ interface GetAllQuotaAllowancesParams {
1613
+ customerId: string;
1096
1614
  }
1097
1615
  declare class QuotaResource {
1098
1616
  private httpClient;
1099
1617
  constructor(httpClient: CommetHTTPClient);
1100
- add(params: AddQuotaParams, options?: RequestOptions): Promise<ApiResponse<QuotaEvent>>;
1101
- set(params: SetQuotaParams, options?: RequestOptions): Promise<ApiResponse<QuotaEvent>>;
1102
- remove(params: RemoveQuotaParams, options?: RequestOptions): Promise<ApiResponse<QuotaEvent>>;
1103
- get(params: GetQuotaParams): Promise<ApiResponse<QuotaAllowance>>;
1104
- getAll(params: GetAllQuotaParams): Promise<ApiResponse<QuotaAllowance[]>>;
1618
+ /** Add to a customer's quota allowance for a feature. Defaults to 1 if count is omitted. */
1619
+ add(params: AddQuotaParams, options?: RequestOptions): Promise<ApiResponse<UsageQuotaEvent>>;
1620
+ /** Set a customer's quota allowance for a feature to an exact value. */
1621
+ set(params: SetQuotaParams, options?: RequestOptions): Promise<ApiResponse<UsageQuotaEvent>>;
1622
+ /** Remove from a customer's quota allowance for a feature. Defaults to 1 if count is omitted. Returns 400 insufficient_balance if the balance would go negative. */
1623
+ remove(params: RemoveQuotaParams, options?: RequestOptions): Promise<ApiResponse<UsageQuotaEvent>>;
1624
+ /** Get the current quota allowance (used vs included) for a specific feature. */
1625
+ get(params: GetQuotaAllowanceParams, options?: RequestOptions): Promise<ApiResponse<UsageQuota>>;
1626
+ /** Get all quota allowances for a customer across every quota feature in their plan. */
1627
+ getAll(params: GetAllQuotaAllowancesParams, options?: RequestOptions): Promise<ApiResponse<Array<UsageQuota>>>;
1105
1628
  }
1106
1629
 
1107
- interface SeatEvent {
1108
- id: string;
1109
- object: "seat";
1110
- livemode: boolean;
1111
- organizationId: string;
1112
- customerId: CustomerID;
1113
- featureCode: string;
1114
- eventType: "add" | "remove" | "set";
1115
- quantity: number;
1116
- previousBalance?: number;
1117
- newBalance: number;
1118
- ts: string;
1119
- createdAt: string;
1120
- }
1121
- interface SeatBalance {
1122
- current: number;
1123
- asOf: string;
1124
- }
1125
1630
  interface AddSeatsParams {
1126
- customerId: CustomerID;
1631
+ customerId: string;
1127
1632
  featureCode: string;
1128
- count?: number;
1633
+ count: number;
1129
1634
  }
1130
- interface RemoveSeatsParams {
1131
- customerId: CustomerID;
1635
+ interface SetSeatsParams {
1636
+ customerId: string;
1132
1637
  featureCode: string;
1133
- count?: number;
1638
+ count: number;
1134
1639
  }
1135
- interface SetSeatsParams {
1136
- customerId: CustomerID;
1640
+ interface RemoveSeatsParams {
1641
+ customerId: string;
1137
1642
  featureCode: string;
1138
1643
  count: number;
1139
1644
  }
1140
- interface SetAllSeatsParams {
1141
- customerId: CustomerID;
1645
+ interface BulkSetSeatsParams {
1646
+ customerId: string;
1142
1647
  seats: Record<string, number>;
1143
1648
  }
1144
- interface GetBalanceParams {
1145
- customerId: CustomerID;
1649
+ interface GetSeatBalanceParams {
1650
+ customerId: string;
1146
1651
  featureCode: string;
1147
1652
  }
1148
- interface GetAllBalancesParams {
1149
- customerId: CustomerID;
1653
+ interface GetAllSeatBalancesParams {
1654
+ customerId: string;
1150
1655
  }
1151
1656
  declare class SeatsResource {
1152
1657
  private httpClient;
1153
1658
  constructor(httpClient: CommetHTTPClient);
1154
- /** Prorates charges for the current billing period. */
1659
+ /** Add seats to a customer's subscription. Prorates charges for the current billing period. */
1155
1660
  add(params: AddSeatsParams, options?: RequestOptions): Promise<ApiResponse<SeatEvent>>;
1156
- /** Removal takes effect at the end of the billing period. */
1157
- remove(params: RemoveSeatsParams, options?: RequestOptions): Promise<ApiResponse<SeatEvent>>;
1661
+ /** Set seats to an exact count. */
1158
1662
  set(params: SetSeatsParams, options?: RequestOptions): Promise<ApiResponse<SeatEvent>>;
1159
- setAll(params: SetAllSeatsParams, options?: RequestOptions): Promise<ApiResponse<SeatEvent[]>>;
1160
- getBalance(params: GetBalanceParams): Promise<ApiResponse<SeatBalance>>;
1161
- getAllBalances(params: GetAllBalancesParams): Promise<ApiResponse<Record<string, SeatBalance>>>;
1663
+ /** Remove seats from a customer's subscription. Takes effect at the end of the billing period. */
1664
+ remove(params: RemoveSeatsParams, options?: RequestOptions): Promise<ApiResponse<SeatEvent>>;
1665
+ /** Set all seat types at once. */
1666
+ setAll(params: BulkSetSeatsParams, options?: RequestOptions): Promise<ApiResponse<Array<BulkSeatUpdate>>>;
1667
+ /** Get current balance for a specific seat type. */
1668
+ getBalance(params: GetSeatBalanceParams, options?: RequestOptions): Promise<ApiResponse<SeatBalance>>;
1669
+ /** Get the current balance for all seat types in a customer's subscription. */
1670
+ getAllBalances(params: GetAllSeatBalancesParams, options?: RequestOptions): Promise<ApiResponse<SeatBalanceListItem>>;
1162
1671
  }
1163
1672
 
1164
- type SubscriptionStatus = "draft" | "pending_payment" | "trialing" | "active" | "paused" | "past_due" | "canceled" | "expired";
1165
- interface FeatureSummary {
1166
- code: string;
1167
- name: string;
1168
- type: FeatureType;
1169
- enabled?: boolean;
1170
- usage?: {
1171
- current: number;
1172
- included: number;
1173
- overage: number;
1174
- overageUnitPrice?: number;
1175
- };
1176
- }
1177
- interface CreditsSummary {
1178
- remaining: number;
1179
- included: number;
1180
- purchased: number;
1181
- }
1182
- interface BalanceSummary {
1183
- remaining: number;
1184
- included: number;
1185
- currency: string;
1186
- }
1187
- interface CancellationSummary {
1188
- scheduledAt: string;
1189
- reason: string | null;
1190
- effectiveAt: string;
1191
- }
1192
- interface DiscountSummary {
1193
- type: "percentage" | "amount";
1194
- value: number;
1195
- name: string | null;
1196
- endsAt: string | null;
1197
- }
1198
- interface ActiveSubscription {
1199
- id: string;
1200
- object: "subscription";
1201
- livemode: boolean;
1202
- customerId: string;
1203
- plan: {
1204
- id: string;
1205
- name: string;
1206
- basePrice: number;
1207
- billingInterval: BillingInterval | null;
1208
- };
1209
- name: string;
1210
- description: string | null;
1211
- status: SubscriptionStatus;
1212
- consumptionModel: ConsumptionModel | null;
1213
- trialEndsAt: string | null;
1214
- currentPeriod: {
1215
- start: string;
1216
- end: string;
1217
- daysRemaining: number;
1218
- };
1219
- features: FeatureSummary[];
1220
- credits: CreditsSummary | null;
1221
- balance: BalanceSummary | null;
1222
- cancellation: CancellationSummary | null;
1223
- discount: DiscountSummary | null;
1224
- startDate: string;
1225
- endDate: string | null;
1226
- billingDayOfMonth: number;
1227
- nextBillingDate: string;
1228
- checkoutUrl: string | null;
1229
- createdAt: string;
1230
- updatedAt: string;
1231
- }
1232
- interface CreatedSubscription {
1233
- id: string;
1234
- object: "subscription";
1235
- livemode: boolean;
1236
- customerId: string;
1237
- planId: string;
1238
- planName: string;
1239
- name: string;
1240
- status: SubscriptionStatus;
1241
- billingInterval: BillingInterval | null;
1242
- trialEndsAt: string | null;
1243
- startDate: string;
1244
- endDate: string | null;
1245
- currentPeriodStart: string | null;
1246
- currentPeriodEnd: string | null;
1247
- billingDayOfMonth: number;
1248
- checkoutUrl: string | null;
1249
- createdAt: string;
1250
- updatedAt: string;
1251
- introOfferEndsAt: string | null;
1252
- introOfferDiscountType: "percentage" | "amount" | null;
1253
- introOfferDiscountValue: number | null;
1254
- }
1255
- interface Subscription {
1256
- id: string;
1257
- object: "subscription";
1258
- livemode: boolean;
1259
- customerId: string;
1260
- planId: string;
1261
- planName: string;
1262
- name: string;
1263
- description?: string;
1264
- status: SubscriptionStatus;
1265
- billingInterval: BillingInterval;
1266
- trialEndsAt?: string;
1267
- startDate: string;
1268
- endDate?: string;
1269
- currentPeriodStart?: string;
1270
- currentPeriodEnd?: string;
1271
- billingDayOfMonth: number;
1272
- checkoutUrl?: string;
1273
- createdAt: string;
1274
- updatedAt: string;
1275
- }
1276
- type PlanIdentifier = {
1277
- planCode: string;
1278
- planId?: never;
1279
- } | {
1280
- planCode?: never;
1281
- planId: string;
1282
- };
1283
- interface CustomIntroOffer {
1284
- discountType: "percentage" | "amount";
1285
- discountValue: number;
1286
- durationCycles: number;
1673
+ interface ListSubscriptionsParams {
1674
+ customerId?: string;
1675
+ status?: SubscriptionStatus;
1287
1676
  }
1288
- type CreateSubscriptionParams = PlanIdentifier & {
1677
+ interface CreateSubscriptionParams {
1678
+ planId?: string;
1679
+ planCode?: string;
1289
1680
  customerId: string;
1290
- } & {
1291
- billingInterval?: BillingInterval;
1681
+ billingInterval?: BillingInterval | null;
1292
1682
  initialSeats?: Record<string, number>;
1293
1683
  skipTrial?: boolean;
1684
+ introOffer?: {
1685
+ discountType: DiscountType;
1686
+ discountValue: number;
1687
+ durationCycles: number;
1688
+ };
1294
1689
  name?: string;
1690
+ /** @format date-time */
1295
1691
  startDate?: string;
1296
1692
  successUrl?: string;
1297
- customIntroOffer?: CustomIntroOffer;
1298
- };
1299
- interface GetActiveParams {
1693
+ }
1694
+ interface GetSubscriptionParams {
1695
+ id: string;
1696
+ }
1697
+ interface GetActiveSubscriptionParams {
1300
1698
  customerId: string;
1301
1699
  }
1302
- interface CancelParams {
1700
+ interface CancelSubscriptionParams {
1303
1701
  id: string;
1304
1702
  reason?: string;
1305
1703
  immediate?: boolean;
1306
1704
  }
1307
- interface UncancelParams {
1705
+ interface UncancelSubscriptionParams {
1308
1706
  id: string;
1309
1707
  }
1310
1708
  interface ChangePlanParams {
1311
1709
  id: string;
1312
1710
  newPlanId?: string;
1313
- newBillingInterval?: BillingInterval;
1314
- /** Where to redirect after checkout when a free→paid change requires payment. */
1711
+ newBillingInterval?: "weekly" | "monthly" | "quarterly" | "yearly";
1315
1712
  successUrl?: string;
1316
1713
  }
1317
- interface ChangePlanResult {
1318
- id: string;
1319
- scheduled: boolean;
1320
- customerId?: string;
1321
- previousPlan?: {
1322
- id: string;
1323
- name: string;
1324
- };
1325
- currentPlan?: {
1326
- id: string;
1327
- name: string;
1328
- price: number;
1329
- };
1330
- billingInterval?: string;
1331
- billing?: {
1332
- credit: number;
1333
- creditsApplied: number;
1334
- charge: number;
1335
- taxAmount: number;
1336
- netAmount: number;
1337
- totalCharged: number;
1338
- remainingCreditBalance: number;
1339
- };
1340
- invoiceId?: string;
1341
- scheduledFor?: string;
1342
- changeType?: string;
1343
- requiresCheckout?: boolean;
1344
- checkoutUrl?: string;
1345
- }
1346
- interface ListSubscriptionsParams extends Record<string, unknown> {
1347
- customerId?: string;
1348
- status?: SubscriptionStatus;
1349
- limit?: number;
1350
- cursor?: string;
1351
- }
1352
- interface SubscriptionListItem {
1714
+ interface PreviewChangePlanParams {
1353
1715
  id: string;
1354
- object: "subscription";
1355
- livemode: boolean;
1356
- customerId: string;
1357
1716
  planId: string;
1358
- planName: string;
1359
- name: string;
1360
- status: SubscriptionStatus;
1361
- startDate: string;
1362
- endDate: string;
1363
- billingDayOfMonth: number;
1364
- createdAt: string;
1365
- updatedAt: string;
1366
- }
1367
- interface PreviewChangeParams {
1368
- id: string;
1369
- planId?: string;
1370
1717
  billingInterval?: BillingInterval;
1371
1718
  }
1372
- interface PreviewChangeResult {
1373
- currency: string;
1374
- currentPlanCredit: number;
1375
- newPlanCharge: number;
1376
- estimatedTotal: number;
1377
- effectiveDate: string;
1378
- daysRemaining: number;
1379
- totalDays: number;
1380
- isUpgrade: boolean;
1381
- }
1382
1719
  interface ActivateAddonParams {
1383
1720
  id: string;
1384
1721
  addonId: string;
1385
1722
  }
1386
- interface ActivateAddonResult {
1387
- addonId: string;
1388
- status: string;
1389
- proratedCharge: number;
1390
- }
1391
1723
  interface DeactivateAddonParams {
1392
1724
  id: string;
1393
1725
  addonId: string;
1394
1726
  }
1395
- interface DeactivateAddonResult {
1396
- id: string;
1397
- status: string;
1398
- deactivatedAt: string;
1399
- }
1400
1727
  interface AdjustBalanceParams {
1401
1728
  id: string;
1402
1729
  amount: number;
1403
1730
  reason?: string;
1404
- type?: "balance" | "credits";
1405
- }
1406
- interface AdjustBalanceResult {
1407
- amount: number;
1408
- newBalance: number;
1409
- reason: string | null;
1731
+ type?: "credits" | "balance";
1410
1732
  }
1411
1733
  interface TopupBalanceParams {
1412
1734
  id: string;
1413
1735
  amount: number;
1414
1736
  }
1415
- interface TopupBalanceResult {
1416
- amount: number;
1417
- }
1418
1737
  interface PurchaseCreditsParams {
1419
1738
  id: string;
1420
1739
  creditPackId: string;
1421
1740
  }
1422
- interface PurchaseCreditsResult {
1423
- credits: number;
1424
- }
1425
- /** Each customer can only have one active subscription at a time. */
1426
1741
  declare class SubscriptionsResource {
1427
1742
  private httpClient;
1428
1743
  constructor(httpClient: CommetHTTPClient);
1429
- /** Returns a `checkoutUrl` when payment is required before activation. */
1430
- create(params: CreateSubscriptionParams, options?: RequestOptions): Promise<ApiResponse<CreatedSubscription>>;
1431
- getActive(params: GetActiveParams): Promise<ApiResponse<ActiveSubscription | null>>;
1432
- /** Schedules cancellation at period end by default. Set `immediate: true` to cancel now. */
1433
- cancel(params: CancelParams, options?: RequestOptions): Promise<ApiResponse<Subscription>>;
1434
- /** Only works on subscriptions with a pending cancellation — cannot revert already-canceled. */
1435
- uncancel(params: UncancelParams, options?: RequestOptions): Promise<ApiResponse<Subscription>>;
1436
- /** Upgrades execute immediately with proration. Downgrades are scheduled for end of period. */
1437
- changePlan(params: ChangePlanParams, options?: RequestOptions): Promise<ApiResponse<ChangePlanResult>>;
1438
- list(params?: ListSubscriptionsParams): Promise<ApiResponse<SubscriptionListItem[]>>;
1439
- /** Dry-run: returns proration details without applying the change. */
1440
- previewChange(params: PreviewChangeParams, options?: RequestOptions): Promise<ApiResponse<PreviewChangeResult>>;
1441
- /** Prorated charge for the current billing period. */
1442
- activateAddon(params: ActivateAddonParams, options?: RequestOptions): Promise<ApiResponse<ActivateAddonResult>>;
1443
- deactivateAddon(params: DeactivateAddonParams, options?: RequestOptions): Promise<ApiResponse<DeactivateAddonResult>>;
1444
- /** Positive amount adds, negative subtracts. */
1445
- adjustBalance(params: AdjustBalanceParams, options?: RequestOptions): Promise<ApiResponse<AdjustBalanceResult>>;
1446
- /** Charges the customer's payment method. */
1447
- topupBalance(params: TopupBalanceParams, options?: RequestOptions): Promise<ApiResponse<TopupBalanceResult>>;
1448
- purchaseCredits(params: PurchaseCreditsParams, options?: RequestOptions): Promise<ApiResponse<PurchaseCreditsResult>>;
1744
+ /** List all subscriptions. Filter by customer ID or status. */
1745
+ list(params?: ListSubscriptionsParams, options?: RequestOptions): Promise<ApiResponse<Array<Subscription>>>;
1746
+ /** Create a subscription for a customer. Requires planId or planCode plus customerId. */
1747
+ create(params: CreateSubscriptionParams, options?: RequestOptions): Promise<ApiResponse<Subscription>>;
1748
+ /** Get a subscription by its public ID, regardless of status (including pending_payment and past_due). */
1749
+ get(params: GetSubscriptionParams, options?: RequestOptions): Promise<ApiResponse<Subscription>>;
1750
+ /** Get the active subscription for a customer. Returns null if none. */
1751
+ getActive(params: GetActiveSubscriptionParams, options?: RequestOptions): Promise<ApiResponse<Subscription | null>>;
1752
+ /** Cancel immediately or at period end. */
1753
+ cancel(params: CancelSubscriptionParams, options?: RequestOptions): Promise<ApiResponse<CanceledSubscription>>;
1754
+ /** Revert a scheduled cancellation. Only works when canceledAt is set but status is not yet 'canceled'. */
1755
+ uncancel(params: UncancelSubscriptionParams, options?: RequestOptions): Promise<ApiResponse<UncanceledSubscription>>;
1756
+ /** Upgrade, downgrade, or change billing interval. */
1757
+ changePlan(params: ChangePlanParams, options?: RequestOptions): Promise<ApiResponse<PlanChange>>;
1758
+ /** Preview proration details for an immediate plan change (an upgrade or a longer interval) without applying it. Returns credit, charge, and net amount. Downgrades — a cheaper plan in the same group, or a shorter interval — are scheduled for the end of the current period instead of being prorated, so they return a 400 with code `plan_change_scheduled`; apply those via the change-plan endpoint. */
1759
+ previewChange(params: PreviewChangePlanParams, options?: RequestOptions): Promise<ApiResponse<PreviewChange>>;
1760
+ /** Activate an add-on on a subscription. Charges a prorated amount for the current billing period. */
1761
+ activateAddon(params: ActivateAddonParams, options?: RequestOptions): Promise<ApiResponse<SubscriptionAddon>>;
1762
+ /** Deactivate an add-on from a subscription. */
1763
+ deactivateAddon(params: DeactivateAddonParams, options?: RequestOptions): Promise<ApiResponse<DeletedSubscriptionAddon>>;
1764
+ /** Adjust a subscription's balance or credits by a signed amount. Positive adds, negative subtracts. */
1765
+ adjustBalance(params: AdjustBalanceParams, options?: RequestOptions): Promise<ApiResponse<BalanceAdjustment>>;
1766
+ /** Top up a subscription's balance. Charges the customer's payment method for the specified amount. */
1767
+ topupBalance(params: TopupBalanceParams, options?: RequestOptions): Promise<ApiResponse<BalanceTopup>>;
1768
+ /** Purchase a credit pack for a subscription. Charges the customer and adds credits to their balance. */
1769
+ purchaseCredits(params: PurchaseCreditsParams, options?: RequestOptions): Promise<ApiResponse<CreditGrant>>;
1449
1770
  }
1450
1771
 
1451
- type TransactionStatus = "pending" | "succeeded" | "failed" | "refunded" | "disputed";
1452
- interface TransactionListItem {
1453
- id: string;
1454
- object: "transaction";
1455
- livemode: boolean;
1456
- invoiceId: string;
1457
- grossAmount: number;
1458
- subtotal: number;
1459
- taxAmount: number;
1460
- currency: string;
1461
- status: TransactionStatus;
1462
- customerEmail: string;
1463
- customerName: string | null;
1464
- paidAt: string | null;
1465
- createdAt: string;
1466
- updatedAt: string;
1467
- }
1468
- interface TransactionDetail extends TransactionListItem {
1469
- availableAt: string | null;
1470
- }
1471
- interface TransactionRefundResult {
1472
- id: string;
1473
- status: "refunded";
1772
+ interface AdvanceTestClockParams {
1773
+ advanceDays?: number;
1774
+ /** @format date-time */
1775
+ frozenTime?: string;
1474
1776
  }
1475
- interface TransactionRetryResult {
1476
- id: string;
1477
- status: "processing";
1478
- retryInvoiceNumber: string;
1777
+ declare class TestClockResource {
1778
+ private httpClient;
1779
+ constructor(httpClient: CommetHTTPClient);
1780
+ /** Returns the organization's current test clock state. Sandbox only. */
1781
+ get(): Promise<ApiResponse<TestClock>>;
1782
+ /** Moves the test clock forward, by a number of days (advanceDays) or to an absolute instant (frozenTime). The clock can only move forward. Sandbox only. */
1783
+ advance(params?: AdvanceTestClockParams, options?: RequestOptions): Promise<ApiResponse<TestClock>>;
1784
+ /** Discovers customers due for billing at the org's current (simulated) time and enqueues a billing cycle for each — renewals, expired trials, pending cancellations. Enqueueing is asynchronous. Sandbox only. */
1785
+ processBilling(): Promise<ApiResponse<TestClockBilling>>;
1479
1786
  }
1787
+
1480
1788
  interface ListTransactionsParams {
1481
1789
  status?: TransactionStatus;
1482
1790
  customerEmail?: string;
@@ -1495,12 +1803,35 @@ interface RetryTransactionParams {
1495
1803
  declare class TransactionsResource {
1496
1804
  private httpClient;
1497
1805
  constructor(httpClient: CommetHTTPClient);
1498
- list(params?: ListTransactionsParams): Promise<ApiResponse<TransactionListItem[]>>;
1499
- get(params: GetTransactionParams): Promise<ApiResponse<TransactionDetail>>;
1500
- /** Full refund only. */
1501
- refund(params: RefundTransactionParams, options?: RequestOptions): Promise<ApiResponse<TransactionRefundResult>>;
1502
- /** Creates a new invoice and initiates a new payment attempt. */
1503
- retry(params: RetryTransactionParams, options?: RequestOptions): Promise<ApiResponse<TransactionRetryResult>>;
1806
+ /** List payment transactions with cursor-based pagination. Filter by status or customer email. */
1807
+ list(params?: ListTransactionsParams, options?: RequestOptions): Promise<ApiResponse<Array<Transaction>>>;
1808
+ /** Retrieve a single payment transaction by its public ID, including provider details. */
1809
+ get(params: GetTransactionParams, options?: RequestOptions): Promise<ApiResponse<Transaction>>;
1810
+ /** Issue a full refund for a payment transaction. */
1811
+ refund(params: RefundTransactionParams, options?: RequestOptions): Promise<ApiResponse<TransactionRefund>>;
1812
+ /** Retry a failed payment transaction. Creates a new invoice and initiates a new payment attempt. */
1813
+ retry(params: RetryTransactionParams, options?: RequestOptions): Promise<ApiResponse<TransactionRetry>>;
1814
+ }
1815
+
1816
+ declare class GeneratedResources {
1817
+ addons: AddonsResource;
1818
+ apiKeys: ApiKeysResource;
1819
+ creditPacks: CreditPacksResource;
1820
+ customers: CustomersResource;
1821
+ featureAccess: FeatureAccessResource;
1822
+ features: FeaturesResource;
1823
+ invoices: InvoicesResource;
1824
+ payouts: PayoutsResource;
1825
+ planGroups: PlanGroupsResource;
1826
+ plans: PlansResource;
1827
+ portal: PortalResource;
1828
+ promoCodes: PromoCodesResource;
1829
+ quota: QuotaResource;
1830
+ seats: SeatsResource;
1831
+ subscriptions: SubscriptionsResource;
1832
+ testClock: TestClockResource;
1833
+ transactions: TransactionsResource;
1834
+ protected initResources(http: CommetHTTPClient): void;
1504
1835
  }
1505
1836
 
1506
1837
  type UsageCheckDenialReason = "included_limit_reached" | "insufficient_credits" | "insufficient_balance";
@@ -1692,22 +2023,8 @@ declare class Webhooks {
1692
2023
  test(params: TestWebhookParams, options?: RequestOptions): Promise<ApiResponse<WebhookTestResult>>;
1693
2024
  }
1694
2025
 
1695
- declare class Commet<_TConfig = unknown> {
2026
+ declare class Commet<_TConfig = unknown> extends GeneratedResources {
1696
2027
  private httpClient;
1697
- readonly addons: AddonsResource;
1698
- readonly apiKeys: ApiKeysResource;
1699
- readonly creditPacks: CreditPacksResource;
1700
- readonly customers: CustomersResource;
1701
- readonly features: FeaturesResource;
1702
- readonly invoices: InvoicesResource;
1703
- readonly planGroups: PlanGroupsResource;
1704
- readonly plans: PlansResource;
1705
- readonly portal: PortalResource;
1706
- readonly promoCodes: PromoCodesResource;
1707
- readonly quota: QuotaResource;
1708
- readonly seats: SeatsResource;
1709
- readonly subscriptions: SubscriptionsResource;
1710
- readonly transactions: TransactionsResource;
1711
2028
  readonly usage: UsageResource;
1712
2029
  readonly webhooks: Webhooks;
1713
2030
  constructor(config: CommetClientOptions);
@@ -1716,7 +2033,7 @@ declare function createCommet<const TConfig extends BillingConfig>(_billingConfi
1716
2033
 
1717
2034
  declare function registerIntegration(name: string, version: string): void;
1718
2035
 
1719
- declare const API_VERSION = "2026-05-25";
2036
+ declare const API_VERSION = "2026-06-10";
1720
2037
  declare const SDK_VERSION: string;
1721
2038
 
1722
- export { API_VERSION, type ActivateAddonParams, type ActivateAddonResult, type ActiveAddon, type ActiveSubscription, type AddAiModelPricingFeatureParams, type AddFixedPricingFeatureParams, type AddPlanFeatureParams, type AddPlanPriceParams, type AddPlanToGroupParams, type AddQuotaParams, type AddSeatsParams, type Addon, type AddonConsumptionModel, type AdjustBalanceParams, type AdjustBalanceResult, type AiModelPricingFeatureManage, type ApiErrorDetail, type ApiKey, type ApiKeyCreated, type ApiResponse, type BalanceAddon, type BillingConfig, type BillingInterval, type BooleanAddon, type CanUseFeatureParams, type CanUseResult, type CancelParams, type CancellationSummary, type ChangePlanParams, type ChangePlanResult, type ChargeType, type CheckUsageParams, Commet, CommetAPIError, type CommetClientOptions, CommetError, CommetValidationError, type ConsumptionModel, type CreateAddonParams, type CreateAdjustmentParams, type CreateAdjustmentResult, type CreateApiKeyParams, type CreateBalanceAddonParams, type CreateBooleanAddonParams, type CreateCreditPackParams, type CreateCreditsAddonParams, type CreateParams as CreateCustomerParams, type CreateFeatureParams, type CreateMeteredAddonParams, type CreatePlanGroupParams, type CreatePlanParams, type CreatePromoCodeParams, type CreateSubscriptionParams, type CreateWebhookParams, type CreatedSubscription, type CreditPack, type CreditPackDetail, type CreditsAddon, type Currency, type CustomIntroOffer, type Customer, type CustomerAddress, type CustomerID, type BatchResult as CustomersBatchResult, type DeactivateAddonParams, type DeactivateAddonResult, type DeleteAddonParams, type DeleteApiKeyParams, type DeleteCreditPackParams, type DeleteFeatureParams, type DeletePlanGroupParams, type DeletePlanParams, type DeletePlanPriceParams, type DeleteRegionalPricesParams, type DeleteResult, type DeleteWebhookParams, type DiscountSummary, type DiscountType, type EventID, type Feature, type FeatureAccess, type FeatureDef, type FeatureSummary, type FeatureType, type FixedPricingFeatureManage, type GetActiveParams, type GetAddonParams, type GetAllBalancesParams, type GetAllQuotaParams, type GetBalanceParams, type GetCustomerParams, type GetDownloadUrlParams, type GetFeatureParams, type GetInvoiceParams, type GetPlanGroupParams, type GetPromoCodeParams, type GetQuotaParams, type GetTransactionParams, type GetUrlParams, type GetWebhookParams, type InferFeatureCodes, type InferPlanCodes, type InferSeatCodes, type InferUsageCodes, type InvoiceDetail, type InvoiceDownloadResult, type InvoiceLineItem, type InvoiceLineType, type InvoiceListItem, type InvoiceSendResult, type InvoiceStatus, type InvoiceStatusResult, type InvoiceType, type ListActiveAddonsParams, type ListAddonsParams, type ListApiKeysParams, type ListCustomersParams, type ListFeaturesParams, type ListInvoicesParams, type ListPlanGroupsParams, type ListPlansParams, type ListPromoCodesParams, type ListSubscriptionsParams, type ListTransactionsParams, type ListWebhooksParams, type MeteredAddon, type PaginatedList, type PaginatedResponse, type Plan, type PlanDef, type PlanDetail, type PlanFeature, type PlanFeatureManage, type PlanFeatureValue, type PlanGroup, type PlanGroupDetail, type PlanID, type PlanManage, type PlanPrice, type PlanPriceManage, type PortalAccess, type PreviewChangeParams, type PreviewChangeResult, type PriceDef, type PromoCode, type PromoCodeDetail, type PurchaseCreditsParams, type PurchaseCreditsResult, type QuotaAllowance, type QuotaEvent, type RefundTransactionParams, type RegionalPriceResult, type RemovePlanFeatureParams, type RemovePlanFromGroupParams, type RemoveQuotaParams, type RemoveResult, type RemoveSeatsParams, type ReorderPlansParams, type RequestOptions, type ResolvedFeatureCode, type ResolvedPlanCode, type ResolvedSeatCode, type ResolvedUsageCode, type RetryTransactionParams, SDK_VERSION, type SeatBalance, type SeatEvent, type SendInvoiceParams, type SetAllSeatsParams, type SetDefaultPriceParams, type SetQuotaParams, type SetRegionalPricesParams, type SetSeatsParams, type SetVisibilityParams, type Subscription, type SubscriptionListItem, type SubscriptionStatus, type TestWebhookParams, type TopupBalanceParams, type TopupBalanceResult, type TrackModelTokensParams, type TrackParams, type TrackUsageParams, type TransactionDetail, type TransactionListItem, type TransactionRefundResult, type TransactionRetryResult, type TransactionStatus, type UncancelParams, type UpdateAddonParams, type UpdateCreditPackParams, type UpdateParams as UpdateCustomerParams, type UpdateFeatureParams, type UpdateInvoiceStatusParams, type UpdatePlanFeatureParams, type UpdatePlanGroupParams, type UpdatePlanParams, type UpdatePlanPriceParams, type UpdatePromoCodeParams, type UpdateWebhookParams, type UsageCheckDenialReason, type UsageCheckResult, type UsageEvent, type UsageEventProperty, type WebhookData, type WebhookEndpoint, type WebhookEndpointCreated, type WebhookEvent, type WebhookPayload, type WebhookTestResult, Webhooks, createCommet, Commet as default, defineConfig, registerIntegration };
2039
+ export { API_VERSION, type ActivateAddonParams, type ActiveAddon, type AddPayoutBankAccountParams, type AddPlanFeatureParams, type AddPlanPriceParams, type AddPlanToGroupParams, type AddQuotaParams, type AddSeatsParams, type AddedPlanToGroup, type Addon, type AdjustBalanceParams, type AdvanceTestClockParams, type ApiErrorDetail, type ApiKey, type ApiResponse, type BalanceAdjustment, type BalanceTopup, type BatchCreateCustomersParams, type BillingConfig, type BillingInterval, type BulkSeatUpdate, type BulkSetSeatsParams, type CanUseFeatureParams, type CancelSubscriptionParams, type CanceledSubscription, type ChangePlanParams, type CheckUsageParams, Commet, CommetAPIError, type CommetClientOptions, CommetError, CommetValidationError, type CompletePayoutVerificationParams, type ConsumptionModel, type CreateAddonParams, type CreateAdjustmentInvoiceParams, type CreateApiKeyParams, type CreateCreditPackParams, type CreateCustomerParams, type CreateFeatureParams, type CreatePlanGroupParams, type CreatePlanParams, type CreatePromoCodeParams, type CreateSubscriptionParams, type CreateWebhookParams, type CreatedApiKey, type CreatedInvoice, type CreditGrant, type CreditPack, type Currency, type Customer, type CustomerBatch, type CustomerID, type DeactivateAddonParams, type DefaultPlanPrice, type DeleteAddonParams, type DeleteApiKeyParams, type DeleteCreditPackParams, type DeleteFeatureParams, type DeletePlanGroupParams, type DeletePlanParams, type DeletePlanPriceParams, type DeleteRegionalPricesParams, type DeleteWebhookParams, type DeletedObject, type DeletedPlanRegionalPricing, type DeletedSubscriptionAddon, type DiscountType, type DownloadInvoiceParams, type EventID, type Feature, type FeatureAccess, type FeatureDef, type FeatureLookup, type FeatureType, type GetActiveSubscriptionParams, type GetAddonParams, type GetAllQuotaAllowancesParams, type GetAllSeatBalancesParams, type GetCustomerParams, type GetFeatureAccessParams, type GetFeatureParams, type GetInvoiceParams, type GetPlanGroupParams, type GetPlanParams, type GetPromoCodeParams, type GetQuotaAllowanceParams, type GetSeatBalanceParams, type GetSubscriptionParams, type GetTransactionParams, type GetWebhookParams, type InferFeatureCodes, type InferPlanCodes, type InferSeatCodes, type InferUsageCodes, type Invoice, type InvoiceDownload, type InvoiceStatus, type InvoiceType, type ListActiveAddonsParams, type ListAddonsParams, type ListApiKeysParams, type ListCustomersParams, type ListFeatureAccessParams, type ListInvoicesParams, type ListPlanGroupsParams, type ListPlansParams, type ListPromoCodesParams, type ListSubscriptionsParams, type ListTransactionsParams, type ListWebhooksParams, type PaginatedList, type PaginatedResponse, type Payout, type PayoutBankAccount, type PayoutVerification, type Plan, type PlanChange, type PlanDef, type PlanFeature, type PlanFeatureValue, type PlanGroup, type PlanPrice, type PlanRegionalPricing, type PlanRegionalPricingResult, type PlanVisibility, type PortalAccess, type PreviewChange, type PreviewChangePlanParams, type PriceDef, type PromoCode, type PurchaseCreditsParams, type RefundTransactionParams, type RemovePlanFeatureParams, type RemovePlanFromGroupParams, type RemoveQuotaParams, type RemoveSeatsParams, type RemovedPlanFeature, type RemovedPlanFromGroup, type ReorderPlansInGroupParams, type ReorderedPlans, type RequestOptions, type RequestPayoutParams, type RequestPortalAccessParams, type ResolvedFeatureCode, type ResolvedPlanCode, type ResolvedSeatCode, type ResolvedUsageCode, type RetryTransactionParams, SDK_VERSION, type SeatBalance, type SeatBalanceListItem, type SeatEvent, type SendInvoiceParams, type SentInvoice, type SetDefaultPlanPriceParams, type SetPlanRegionalPricingParams, type SetPlanVisibilityParams, type SetQuotaParams, type SetSeatsParams, type Subscription, type SubscriptionAddon, type SubscriptionStatus, type TestClock, type TestClockBilling, type TestWebhookParams, type Timezone, type TopupBalanceParams, type TrackModelTokensParams, type TrackParams, type TrackUsageParams, type Transaction, type TransactionRefund, type TransactionRetry, type TransactionStatus, type UncancelSubscriptionParams, type UncanceledSubscription, type UpdateAddonParams, type UpdateCreditPackParams, type UpdateCustomerParams, type UpdateFeatureParams, type UpdateInvoiceStatusParams, type UpdatePlanFeatureParams, type UpdatePlanGroupParams, type UpdatePlanParams, type UpdatePlanPriceParams, type UpdatePromoCodeParams, type UpdateWebhookParams, type UpsertRegionalPricesParams, type UsageCheckDenialReason, type UsageCheckResult, type UsageEvent, type UsageEventProperty, type UsageQuota, type UsageQuotaEvent, type WebhookData, type WebhookEndpoint, type WebhookEndpointCreated, type WebhookEvent, type WebhookPayload, type WebhookTestResult, Webhooks, createCommet, Commet as default, defineConfig, registerIntegration };