@commet/node 7.1.0 → 7.2.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.mts CHANGED
@@ -140,7 +140,7 @@ type ResolvedPlanCode<TConfig> = [InferPlanCodes<TConfig>] extends [
140
140
  type SubscriptionStatus = "draft" | "pending_payment" | "trialing" | "active" | "past_due" | "canceled";
141
141
  type BillingInterval = "weekly" | "monthly" | "quarterly" | "yearly" | "one_time";
142
142
  type ConsumptionModel = "metered" | "credits" | "balance";
143
- type InvoiceType = "recurring" | "overage" | "plan_change" | "adjustment" | "credit_purchase" | "balance_topup" | "addon_activation";
143
+ type InvoiceType = "recurring" | "overage" | "plan_change" | "adjustment" | "credit_purchase" | "balance_topup" | "addon_activation" | "one_time_payment";
144
144
  type TransactionStatus = "pending" | "succeeded" | "failed" | "refunded" | "disputed";
145
145
  type FeatureType = "boolean" | "usage" | "seats" | "quota";
146
146
  type DiscountType = "percentage" | "amount";
@@ -436,7 +436,7 @@ interface Invoice {
436
436
  /** @format date-time */
437
437
  updatedAt: string;
438
438
  lineItems?: Array<{
439
- lineType: "plan_base" | "feature_overage" | "feature_seats" | "feature_quota" | "discount" | "promo_code_discount" | "credit" | "balance_overage" | "addon_base";
439
+ lineType: "plan_base" | "feature_overage" | "feature_seats" | "feature_quota" | "discount" | "promo_code_discount" | "credit" | "balance_overage" | "addon_base" | "one_time";
440
440
  featureName: string | null;
441
441
  description: string;
442
442
  quantity: number;
@@ -468,6 +468,32 @@ interface InvoiceStatus {
468
468
  object: "invoice";
469
469
  livemode: boolean;
470
470
  }
471
+ interface Payment {
472
+ id: string;
473
+ customerId: string | null;
474
+ kind: "link" | "charge";
475
+ status: "pending" | "processing" | "succeeded" | "requires_action" | "failed" | "canceled";
476
+ provider: "stripe" | "commet";
477
+ amountSubtotal: number;
478
+ taxAmount: number;
479
+ amountTotal: number;
480
+ currency: string;
481
+ description: string;
482
+ metadata: Record<string, unknown> | null;
483
+ url: string | null;
484
+ expiresAt: string | null;
485
+ /** @format date-time */
486
+ createdAt: string;
487
+ /** @format date-time */
488
+ updatedAt: string;
489
+ object: "payment";
490
+ livemode: boolean;
491
+ }
492
+ interface PaymentMethodUpdateCheckout {
493
+ checkoutUrl: string;
494
+ object: "subscription";
495
+ livemode: boolean;
496
+ }
471
497
  interface Payout {
472
498
  id: string;
473
499
  status: "pending" | "in_transit" | "paid" | "failed" | "canceled";
@@ -603,6 +629,15 @@ interface PlanChange {
603
629
  remainingCreditBalance: number;
604
630
  };
605
631
  invoiceId?: string;
632
+ seatLimitWarning?: {
633
+ featureCode: string;
634
+ featureName: string;
635
+ currentSeats: number;
636
+ included: number;
637
+ newPlanName: string;
638
+ /** @format date-time */
639
+ effectiveDate: string;
640
+ };
606
641
  object: "subscription";
607
642
  livemode: boolean;
608
643
  }
@@ -721,6 +756,18 @@ interface PromoCode {
721
756
  object: "promo_code";
722
757
  livemode: boolean;
723
758
  }
759
+ interface ReactivatedSubscription {
760
+ id: string;
761
+ retryInitiated: boolean;
762
+ object: "subscription";
763
+ livemode: boolean;
764
+ }
765
+ interface RecoveryLink {
766
+ url: string;
767
+ token: string;
768
+ object: "subscription";
769
+ livemode: boolean;
770
+ }
724
771
  interface RemovedPlanFeature {
725
772
  id: string;
726
773
  removed: true;
@@ -897,7 +944,6 @@ interface TransactionRefund {
897
944
  interface TransactionRetry {
898
945
  id: string;
899
946
  status: "processing";
900
- retryInvoiceNumber: string;
901
947
  object: "transaction";
902
948
  livemode: boolean;
903
949
  }
@@ -1246,6 +1292,48 @@ declare class InvoicesResource {
1246
1292
  updateStatus(params: UpdateInvoiceStatusParams, options?: RequestOptions): Promise<ApiResponse<InvoiceStatus>>;
1247
1293
  }
1248
1294
 
1295
+ interface ListPaymentsParams {
1296
+ customerId?: string;
1297
+ /** @format date-time */
1298
+ cursor?: string;
1299
+ limit?: number;
1300
+ }
1301
+ interface CreatePaymentParams {
1302
+ amount: number;
1303
+ currency: string;
1304
+ customerId?: string;
1305
+ description: string;
1306
+ successUrl?: string;
1307
+ metadata?: Record<string, string>;
1308
+ }
1309
+ interface ChargePaymentParams {
1310
+ customerId: string;
1311
+ amount: number;
1312
+ currency: string;
1313
+ description: string;
1314
+ metadata?: Record<string, string>;
1315
+ }
1316
+ interface GetPaymentParams {
1317
+ id: string;
1318
+ }
1319
+ interface CancelPaymentParams {
1320
+ id: string;
1321
+ }
1322
+ declare class PaymentsResource {
1323
+ private httpClient;
1324
+ constructor(httpClient: CommetHTTPClient);
1325
+ /** List payments with cursor-based pagination. Filter by customer. */
1326
+ list(params?: ListPaymentsParams, options?: RequestOptions): Promise<ApiResponse<Array<Payment>>>;
1327
+ /** Create a hosted payment link. Returns a url the customer opens to pay with any card. Calculates tax, generates an invoice, and vaults the payment method on confirmation. No subscription or plan required. */
1328
+ create(params: CreatePaymentParams, options?: RequestOptions): Promise<ApiResponse<Payment>>;
1329
+ /** Charge a customer's vaulted payment method off-session. Calculates tax, generates an invoice, and sends a receipt. No subscription or plan required. */
1330
+ charge(params: ChargePaymentParams, options?: RequestOptions): Promise<ApiResponse<Payment>>;
1331
+ /** Retrieve a payment by its public ID. */
1332
+ get(params: GetPaymentParams, options?: RequestOptions): Promise<ApiResponse<Payment>>;
1333
+ /** Cancel a pending payment link so it can no longer be paid. Only a link that has not been paid or started processing can be canceled; canceling an already canceled link is a no-op. Charges cannot be canceled. */
1334
+ cancel(params: CancelPaymentParams, options?: RequestOptions): Promise<ApiResponse<Payment>>;
1335
+ }
1336
+
1249
1337
  interface AddPayoutBankAccountParams {
1250
1338
  accountNumber: string;
1251
1339
  accountHolderName: string;
@@ -1707,6 +1795,16 @@ interface CancelSubscriptionParams {
1707
1795
  interface UncancelSubscriptionParams {
1708
1796
  id: string;
1709
1797
  }
1798
+ interface ReactivateSubscriptionParams {
1799
+ id: string;
1800
+ }
1801
+ interface CreateSubscriptionRecoveryLinkParams {
1802
+ id: string;
1803
+ }
1804
+ interface UpdatePaymentMethodParams {
1805
+ id: string;
1806
+ successUrl?: string;
1807
+ }
1710
1808
  interface ChangePlanParams {
1711
1809
  id: string;
1712
1810
  newPlanId?: string;
@@ -1755,6 +1853,12 @@ declare class SubscriptionsResource {
1755
1853
  cancel(params: CancelSubscriptionParams, options?: RequestOptions): Promise<ApiResponse<CanceledSubscription>>;
1756
1854
  /** Revert a scheduled cancellation. Only works when canceledAt is set but status is not yet 'canceled'. */
1757
1855
  uncancel(params: UncancelSubscriptionParams, options?: RequestOptions): Promise<ApiResponse<UncanceledSubscription>>;
1856
+ /** Retries the outstanding renewal charge for a past_due subscription. On a successful charge the subscription recovers to active and a payment.recovered webhook is delivered; a declined charge returns an error and the subscription stays past_due. */
1857
+ reactivate(params: ReactivateSubscriptionParams, options?: RequestOptions): Promise<ApiResponse<ReactivatedSubscription>>;
1858
+ /** Generates a hosted, signed recovery link that lets the customer pay the outstanding renewal charge for a past_due subscription. Unlike reactivate, which charges server-to-server, this returns a link the merchant can deliver through their own email, SMS, or dashboard. The link carries a self-contained signed token and stays valid until the charge is paid or the subscription is no longer past due. */
1859
+ createRecoveryLink(params: CreateSubscriptionRecoveryLinkParams, options?: RequestOptions): Promise<ApiResponse<RecoveryLink>>;
1860
+ /** Creates a hosted checkout session for the customer to update the subscription's default payment method. */
1861
+ updatePaymentMethod(params: UpdatePaymentMethodParams, options?: RequestOptions): Promise<ApiResponse<PaymentMethodUpdateCheckout>>;
1758
1862
  /** Upgrade, downgrade, or change billing interval. */
1759
1863
  changePlan(params: ChangePlanParams, options?: RequestOptions): Promise<ApiResponse<PlanChange>>;
1760
1864
  /** 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. */
@@ -1811,7 +1915,7 @@ declare class TransactionsResource {
1811
1915
  get(params: GetTransactionParams, options?: RequestOptions): Promise<ApiResponse<Transaction>>;
1812
1916
  /** Issue a full refund for a payment transaction. */
1813
1917
  refund(params: RefundTransactionParams, options?: RequestOptions): Promise<ApiResponse<TransactionRefund>>;
1814
- /** Retry a failed payment transaction. Creates a new invoice and initiates a new payment attempt. */
1918
+ /** Retry a failed subscription renewal. Re-charges the outstanding renewal invoice through the recovery engine. */
1815
1919
  retry(params: RetryTransactionParams, options?: RequestOptions): Promise<ApiResponse<TransactionRetry>>;
1816
1920
  }
1817
1921
 
@@ -1823,6 +1927,7 @@ declare class GeneratedResources {
1823
1927
  featureAccess: FeatureAccessResource;
1824
1928
  features: FeaturesResource;
1825
1929
  invoices: InvoicesResource;
1930
+ payments: PaymentsResource;
1826
1931
  payouts: PayoutsResource;
1827
1932
  planGroups: PlanGroupsResource;
1828
1933
  plans: PlansResource;
@@ -2038,4 +2143,4 @@ declare function registerIntegration(name: string, version: string): void;
2038
2143
  declare const API_VERSION = "2026-06-10";
2039
2144
  declare const SDK_VERSION: string;
2040
2145
 
2041
- 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 };
2146
+ 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 CancelPaymentParams, type CancelSubscriptionParams, type CanceledSubscription, type ChangePlanParams, type ChargePaymentParams, 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 CreatePaymentParams, type CreatePlanGroupParams, type CreatePlanParams, type CreatePromoCodeParams, type CreateSubscriptionParams, type CreateSubscriptionRecoveryLinkParams, 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 GetPaymentParams, 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 ListPaymentsParams, type ListPlanGroupsParams, type ListPlansParams, type ListPromoCodesParams, type ListSubscriptionsParams, type ListTransactionsParams, type ListWebhooksParams, type PaginatedList, type PaginatedResponse, type Payment, type PaymentMethodUpdateCheckout, 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 ReactivateSubscriptionParams, type ReactivatedSubscription, type RecoveryLink, 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 UpdatePaymentMethodParams, 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 };
package/dist/index.d.ts CHANGED
@@ -140,7 +140,7 @@ type ResolvedPlanCode<TConfig> = [InferPlanCodes<TConfig>] extends [
140
140
  type SubscriptionStatus = "draft" | "pending_payment" | "trialing" | "active" | "past_due" | "canceled";
141
141
  type BillingInterval = "weekly" | "monthly" | "quarterly" | "yearly" | "one_time";
142
142
  type ConsumptionModel = "metered" | "credits" | "balance";
143
- type InvoiceType = "recurring" | "overage" | "plan_change" | "adjustment" | "credit_purchase" | "balance_topup" | "addon_activation";
143
+ type InvoiceType = "recurring" | "overage" | "plan_change" | "adjustment" | "credit_purchase" | "balance_topup" | "addon_activation" | "one_time_payment";
144
144
  type TransactionStatus = "pending" | "succeeded" | "failed" | "refunded" | "disputed";
145
145
  type FeatureType = "boolean" | "usage" | "seats" | "quota";
146
146
  type DiscountType = "percentage" | "amount";
@@ -436,7 +436,7 @@ interface Invoice {
436
436
  /** @format date-time */
437
437
  updatedAt: string;
438
438
  lineItems?: Array<{
439
- lineType: "plan_base" | "feature_overage" | "feature_seats" | "feature_quota" | "discount" | "promo_code_discount" | "credit" | "balance_overage" | "addon_base";
439
+ lineType: "plan_base" | "feature_overage" | "feature_seats" | "feature_quota" | "discount" | "promo_code_discount" | "credit" | "balance_overage" | "addon_base" | "one_time";
440
440
  featureName: string | null;
441
441
  description: string;
442
442
  quantity: number;
@@ -468,6 +468,32 @@ interface InvoiceStatus {
468
468
  object: "invoice";
469
469
  livemode: boolean;
470
470
  }
471
+ interface Payment {
472
+ id: string;
473
+ customerId: string | null;
474
+ kind: "link" | "charge";
475
+ status: "pending" | "processing" | "succeeded" | "requires_action" | "failed" | "canceled";
476
+ provider: "stripe" | "commet";
477
+ amountSubtotal: number;
478
+ taxAmount: number;
479
+ amountTotal: number;
480
+ currency: string;
481
+ description: string;
482
+ metadata: Record<string, unknown> | null;
483
+ url: string | null;
484
+ expiresAt: string | null;
485
+ /** @format date-time */
486
+ createdAt: string;
487
+ /** @format date-time */
488
+ updatedAt: string;
489
+ object: "payment";
490
+ livemode: boolean;
491
+ }
492
+ interface PaymentMethodUpdateCheckout {
493
+ checkoutUrl: string;
494
+ object: "subscription";
495
+ livemode: boolean;
496
+ }
471
497
  interface Payout {
472
498
  id: string;
473
499
  status: "pending" | "in_transit" | "paid" | "failed" | "canceled";
@@ -603,6 +629,15 @@ interface PlanChange {
603
629
  remainingCreditBalance: number;
604
630
  };
605
631
  invoiceId?: string;
632
+ seatLimitWarning?: {
633
+ featureCode: string;
634
+ featureName: string;
635
+ currentSeats: number;
636
+ included: number;
637
+ newPlanName: string;
638
+ /** @format date-time */
639
+ effectiveDate: string;
640
+ };
606
641
  object: "subscription";
607
642
  livemode: boolean;
608
643
  }
@@ -721,6 +756,18 @@ interface PromoCode {
721
756
  object: "promo_code";
722
757
  livemode: boolean;
723
758
  }
759
+ interface ReactivatedSubscription {
760
+ id: string;
761
+ retryInitiated: boolean;
762
+ object: "subscription";
763
+ livemode: boolean;
764
+ }
765
+ interface RecoveryLink {
766
+ url: string;
767
+ token: string;
768
+ object: "subscription";
769
+ livemode: boolean;
770
+ }
724
771
  interface RemovedPlanFeature {
725
772
  id: string;
726
773
  removed: true;
@@ -897,7 +944,6 @@ interface TransactionRefund {
897
944
  interface TransactionRetry {
898
945
  id: string;
899
946
  status: "processing";
900
- retryInvoiceNumber: string;
901
947
  object: "transaction";
902
948
  livemode: boolean;
903
949
  }
@@ -1246,6 +1292,48 @@ declare class InvoicesResource {
1246
1292
  updateStatus(params: UpdateInvoiceStatusParams, options?: RequestOptions): Promise<ApiResponse<InvoiceStatus>>;
1247
1293
  }
1248
1294
 
1295
+ interface ListPaymentsParams {
1296
+ customerId?: string;
1297
+ /** @format date-time */
1298
+ cursor?: string;
1299
+ limit?: number;
1300
+ }
1301
+ interface CreatePaymentParams {
1302
+ amount: number;
1303
+ currency: string;
1304
+ customerId?: string;
1305
+ description: string;
1306
+ successUrl?: string;
1307
+ metadata?: Record<string, string>;
1308
+ }
1309
+ interface ChargePaymentParams {
1310
+ customerId: string;
1311
+ amount: number;
1312
+ currency: string;
1313
+ description: string;
1314
+ metadata?: Record<string, string>;
1315
+ }
1316
+ interface GetPaymentParams {
1317
+ id: string;
1318
+ }
1319
+ interface CancelPaymentParams {
1320
+ id: string;
1321
+ }
1322
+ declare class PaymentsResource {
1323
+ private httpClient;
1324
+ constructor(httpClient: CommetHTTPClient);
1325
+ /** List payments with cursor-based pagination. Filter by customer. */
1326
+ list(params?: ListPaymentsParams, options?: RequestOptions): Promise<ApiResponse<Array<Payment>>>;
1327
+ /** Create a hosted payment link. Returns a url the customer opens to pay with any card. Calculates tax, generates an invoice, and vaults the payment method on confirmation. No subscription or plan required. */
1328
+ create(params: CreatePaymentParams, options?: RequestOptions): Promise<ApiResponse<Payment>>;
1329
+ /** Charge a customer's vaulted payment method off-session. Calculates tax, generates an invoice, and sends a receipt. No subscription or plan required. */
1330
+ charge(params: ChargePaymentParams, options?: RequestOptions): Promise<ApiResponse<Payment>>;
1331
+ /** Retrieve a payment by its public ID. */
1332
+ get(params: GetPaymentParams, options?: RequestOptions): Promise<ApiResponse<Payment>>;
1333
+ /** Cancel a pending payment link so it can no longer be paid. Only a link that has not been paid or started processing can be canceled; canceling an already canceled link is a no-op. Charges cannot be canceled. */
1334
+ cancel(params: CancelPaymentParams, options?: RequestOptions): Promise<ApiResponse<Payment>>;
1335
+ }
1336
+
1249
1337
  interface AddPayoutBankAccountParams {
1250
1338
  accountNumber: string;
1251
1339
  accountHolderName: string;
@@ -1707,6 +1795,16 @@ interface CancelSubscriptionParams {
1707
1795
  interface UncancelSubscriptionParams {
1708
1796
  id: string;
1709
1797
  }
1798
+ interface ReactivateSubscriptionParams {
1799
+ id: string;
1800
+ }
1801
+ interface CreateSubscriptionRecoveryLinkParams {
1802
+ id: string;
1803
+ }
1804
+ interface UpdatePaymentMethodParams {
1805
+ id: string;
1806
+ successUrl?: string;
1807
+ }
1710
1808
  interface ChangePlanParams {
1711
1809
  id: string;
1712
1810
  newPlanId?: string;
@@ -1755,6 +1853,12 @@ declare class SubscriptionsResource {
1755
1853
  cancel(params: CancelSubscriptionParams, options?: RequestOptions): Promise<ApiResponse<CanceledSubscription>>;
1756
1854
  /** Revert a scheduled cancellation. Only works when canceledAt is set but status is not yet 'canceled'. */
1757
1855
  uncancel(params: UncancelSubscriptionParams, options?: RequestOptions): Promise<ApiResponse<UncanceledSubscription>>;
1856
+ /** Retries the outstanding renewal charge for a past_due subscription. On a successful charge the subscription recovers to active and a payment.recovered webhook is delivered; a declined charge returns an error and the subscription stays past_due. */
1857
+ reactivate(params: ReactivateSubscriptionParams, options?: RequestOptions): Promise<ApiResponse<ReactivatedSubscription>>;
1858
+ /** Generates a hosted, signed recovery link that lets the customer pay the outstanding renewal charge for a past_due subscription. Unlike reactivate, which charges server-to-server, this returns a link the merchant can deliver through their own email, SMS, or dashboard. The link carries a self-contained signed token and stays valid until the charge is paid or the subscription is no longer past due. */
1859
+ createRecoveryLink(params: CreateSubscriptionRecoveryLinkParams, options?: RequestOptions): Promise<ApiResponse<RecoveryLink>>;
1860
+ /** Creates a hosted checkout session for the customer to update the subscription's default payment method. */
1861
+ updatePaymentMethod(params: UpdatePaymentMethodParams, options?: RequestOptions): Promise<ApiResponse<PaymentMethodUpdateCheckout>>;
1758
1862
  /** Upgrade, downgrade, or change billing interval. */
1759
1863
  changePlan(params: ChangePlanParams, options?: RequestOptions): Promise<ApiResponse<PlanChange>>;
1760
1864
  /** 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. */
@@ -1811,7 +1915,7 @@ declare class TransactionsResource {
1811
1915
  get(params: GetTransactionParams, options?: RequestOptions): Promise<ApiResponse<Transaction>>;
1812
1916
  /** Issue a full refund for a payment transaction. */
1813
1917
  refund(params: RefundTransactionParams, options?: RequestOptions): Promise<ApiResponse<TransactionRefund>>;
1814
- /** Retry a failed payment transaction. Creates a new invoice and initiates a new payment attempt. */
1918
+ /** Retry a failed subscription renewal. Re-charges the outstanding renewal invoice through the recovery engine. */
1815
1919
  retry(params: RetryTransactionParams, options?: RequestOptions): Promise<ApiResponse<TransactionRetry>>;
1816
1920
  }
1817
1921
 
@@ -1823,6 +1927,7 @@ declare class GeneratedResources {
1823
1927
  featureAccess: FeatureAccessResource;
1824
1928
  features: FeaturesResource;
1825
1929
  invoices: InvoicesResource;
1930
+ payments: PaymentsResource;
1826
1931
  payouts: PayoutsResource;
1827
1932
  planGroups: PlanGroupsResource;
1828
1933
  plans: PlansResource;
@@ -2038,4 +2143,4 @@ declare function registerIntegration(name: string, version: string): void;
2038
2143
  declare const API_VERSION = "2026-06-10";
2039
2144
  declare const SDK_VERSION: string;
2040
2145
 
2041
- 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 };
2146
+ 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 CancelPaymentParams, type CancelSubscriptionParams, type CanceledSubscription, type ChangePlanParams, type ChargePaymentParams, 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 CreatePaymentParams, type CreatePlanGroupParams, type CreatePlanParams, type CreatePromoCodeParams, type CreateSubscriptionParams, type CreateSubscriptionRecoveryLinkParams, 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 GetPaymentParams, 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 ListPaymentsParams, type ListPlanGroupsParams, type ListPlansParams, type ListPromoCodesParams, type ListSubscriptionsParams, type ListTransactionsParams, type ListWebhooksParams, type PaginatedList, type PaginatedResponse, type Payment, type PaymentMethodUpdateCheckout, 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 ReactivateSubscriptionParams, type ReactivatedSubscription, type RecoveryLink, 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 UpdatePaymentMethodParams, 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 };
package/dist/index.js CHANGED
@@ -246,6 +246,35 @@ var InvoicesResource = class {
246
246
  }
247
247
  };
248
248
 
249
+ // src/resources/payments.ts
250
+ var PaymentsResource = class {
251
+ constructor(httpClient) {
252
+ this.httpClient = httpClient;
253
+ }
254
+ /** List payments with cursor-based pagination. Filter by customer. */
255
+ async list(params, options) {
256
+ return this.httpClient.get("/payments", params, options);
257
+ }
258
+ /** Create a hosted payment link. Returns a url the customer opens to pay with any card. Calculates tax, generates an invoice, and vaults the payment method on confirmation. No subscription or plan required. */
259
+ async create(params, options) {
260
+ return this.httpClient.post("/payments", params, options);
261
+ }
262
+ /** Charge a customer's vaulted payment method off-session. Calculates tax, generates an invoice, and sends a receipt. No subscription or plan required. */
263
+ async charge(params, options) {
264
+ return this.httpClient.post("/payments/charge", params, options);
265
+ }
266
+ /** Retrieve a payment by its public ID. */
267
+ async get(params, options) {
268
+ const { id } = params;
269
+ return this.httpClient.get(`/payments/${id}`, void 0, options);
270
+ }
271
+ /** Cancel a pending payment link so it can no longer be paid. Only a link that has not been paid or started processing can be canceled; canceling an already canceled link is a no-op. Charges cannot be canceled. */
272
+ async cancel(params, options) {
273
+ const { id } = params;
274
+ return this.httpClient.post(`/payments/${id}/cancel`, {}, options);
275
+ }
276
+ };
277
+
249
278
  // src/resources/payouts.ts
250
279
  var PayoutsResource = class {
251
280
  constructor(httpClient) {
@@ -553,6 +582,29 @@ var SubscriptionsResource = class {
553
582
  const { id } = params;
554
583
  return this.httpClient.post(`/subscriptions/${id}/uncancel`, {}, options);
555
584
  }
585
+ /** Retries the outstanding renewal charge for a past_due subscription. On a successful charge the subscription recovers to active and a payment.recovered webhook is delivered; a declined charge returns an error and the subscription stays past_due. */
586
+ async reactivate(params, options) {
587
+ const { id } = params;
588
+ return this.httpClient.post(`/subscriptions/${id}/reactivate`, {}, options);
589
+ }
590
+ /** Generates a hosted, signed recovery link that lets the customer pay the outstanding renewal charge for a past_due subscription. Unlike reactivate, which charges server-to-server, this returns a link the merchant can deliver through their own email, SMS, or dashboard. The link carries a self-contained signed token and stays valid until the charge is paid or the subscription is no longer past due. */
591
+ async createRecoveryLink(params, options) {
592
+ const { id } = params;
593
+ return this.httpClient.post(
594
+ `/subscriptions/${id}/recovery-link`,
595
+ {},
596
+ options
597
+ );
598
+ }
599
+ /** Creates a hosted checkout session for the customer to update the subscription's default payment method. */
600
+ async updatePaymentMethod(params, options) {
601
+ const { id, ...rest } = params;
602
+ return this.httpClient.post(
603
+ `/subscriptions/${id}/payment-method/update`,
604
+ rest,
605
+ options
606
+ );
607
+ }
556
608
  /** Upgrade, downgrade, or change billing interval. */
557
609
  async changePlan(params, options) {
558
610
  const { id, ...rest } = params;
@@ -648,7 +700,7 @@ var TransactionsResource = class {
648
700
  const { id } = params;
649
701
  return this.httpClient.post(`/transactions/${id}/refund`, {}, options);
650
702
  }
651
- /** Retry a failed payment transaction. Creates a new invoice and initiates a new payment attempt. */
703
+ /** Retry a failed subscription renewal. Re-charges the outstanding renewal invoice through the recovery engine. */
652
704
  async retry(params, options) {
653
705
  const { id } = params;
654
706
  return this.httpClient.post(`/transactions/${id}/retry`, {}, options);
@@ -665,6 +717,7 @@ var GeneratedResources = class {
665
717
  this.featureAccess = new FeatureAccessResource(http);
666
718
  this.features = new FeaturesResource(http);
667
719
  this.invoices = new InvoicesResource(http);
720
+ this.payments = new PaymentsResource(http);
668
721
  this.payouts = new PayoutsResource(http);
669
722
  this.planGroups = new PlanGroupsResource(http);
670
723
  this.plans = new PlansResource(http);
@@ -810,7 +863,7 @@ var CommetValidationError = class extends CommetError {
810
863
 
811
864
  // src/version.ts
812
865
  var API_VERSION = "2026-06-10";
813
- var SDK_VERSION = "7.1.0";
866
+ var SDK_VERSION = "7.2.0";
814
867
 
815
868
  // src/utils/telemetry.ts
816
869
  var registeredIntegrations = /* @__PURE__ */ new Set();