@commet/node 7.1.0 → 7.3.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;
@@ -1914,6 +2019,1033 @@ declare class UsageResource {
1914
2019
  check(params: CheckUsageParams, options?: RequestOptions): Promise<ApiResponse<UsageCheckResult>>;
1915
2020
  }
1916
2021
 
2022
+ interface WebhookPlanRef {
2023
+ id: string;
2024
+ name: string;
2025
+ }
2026
+ interface WebhookAddonRef {
2027
+ id: string;
2028
+ name: string;
2029
+ }
2030
+ interface WebhookCardInfo {
2031
+ brand: string;
2032
+ last4: string;
2033
+ expMonth: number;
2034
+ expYear: number;
2035
+ }
2036
+ interface WebhookBankRef {
2037
+ bankName: string;
2038
+ last4: string;
2039
+ }
2040
+ interface WebhookFeatureAccess {
2041
+ code: string;
2042
+ name: string;
2043
+ type: string;
2044
+ allowed: boolean;
2045
+ enabled: boolean | null;
2046
+ current: number | null;
2047
+ included: number | null;
2048
+ remaining: number | null;
2049
+ overageQuantity: number | null;
2050
+ overageUnitPrice: number | null;
2051
+ unlimited: boolean | null;
2052
+ overageEnabled: boolean | null;
2053
+ billedQuantity: number | null;
2054
+ }
2055
+ interface WebhookSeatSummary {
2056
+ code: string;
2057
+ current: number | null;
2058
+ included: number | null;
2059
+ remaining: number | null;
2060
+ unlimited: boolean | null;
2061
+ }
2062
+ interface WebhookCreditsBalance {
2063
+ planCredits: number;
2064
+ purchasedCredits: number;
2065
+ totalCredits: number;
2066
+ }
2067
+ interface WebhookBalance {
2068
+ currentBalance: number;
2069
+ }
2070
+
2071
+ type WebhookEvent = "subscription.created" | "subscription.activated" | "subscription.reactivated" | "subscription.canceled" | "subscription.updated" | "subscription.plan_changed" | "subscription.cancellation_scheduled" | "subscription.cancellation_revoked" | "subscription.plan_change_scheduled" | "subscription.plan_change_revoked" | "subscription.past_due" | "trial.started" | "trial.converted" | "trial.expired" | "trial.will_end" | "trial.checkout_ready" | "checkout.ready" | "payment.received" | "payment.failed" | "payment.recovered" | "payment.retry_failed" | "payment.refunded" | "payment.disputed" | "payment.dispute_resolved" | "payment_link.created" | "payment_link.completed" | "payment_link.failed" | "payment_link.canceled" | "invoice.created" | "invoice.upcoming" | "invoice.overdue" | "invoice.voided" | "payment_method.attached" | "payment_method.updated" | "customer.created" | "customer.updated" | "customer.state_changed" | "credits.granted" | "credits.purchased" | "credits.low" | "credits.depleted" | "credits.expired" | "balance.topped_up" | "balance.low" | "balance.depleted" | "quota.threshold_reached" | "quota.exceeded" | "usage.recorded" | "seats.updated" | "seats.limit_reached" | "addon.activated" | "addon.deactivated" | "payout.available" | "payout.created" | "payout.paid" | "payout.failed";
2072
+ /** Fired when a subscription record is created with status pending_payment. The first charge has not been confirmed yet — do NOT grant access here. Wait for subscription.activated. */
2073
+ interface SubscriptionCreatedData {
2074
+ /** The subscription ID. */
2075
+ subscriptionId: string;
2076
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2077
+ customerId: string;
2078
+ /** The plan ID. */
2079
+ planId: string;
2080
+ /** The plan name. */
2081
+ planName: string;
2082
+ /** Current status. One of: draft, pending_payment, trialing, active, past_due, canceled, expired. Grant access only when trialing or active. */
2083
+ status: string;
2084
+ /** ISO 8601 datetime when the subscription starts. */
2085
+ startDate: string | null;
2086
+ /** Optional custom name for the subscription. */
2087
+ name: string | null;
2088
+ }
2089
+ /** Fired when the first charge succeeds and status becomes active (or trialing if a trial is configured). This is where you grant access. */
2090
+ interface SubscriptionActivatedData {
2091
+ /** The subscription ID. */
2092
+ subscriptionId: string;
2093
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2094
+ customerId: string;
2095
+ /** Current status. One of: draft, pending_payment, trialing, active, past_due, canceled, expired. Grant access only when trialing or active. */
2096
+ status: string;
2097
+ /** ISO 8601 start of the current billing period. */
2098
+ currentPeriodStart: string | null;
2099
+ /** ISO 8601 end of the current billing period. */
2100
+ currentPeriodEnd: string | null;
2101
+ /** Optional custom name for the subscription. */
2102
+ name: string | null;
2103
+ /** The invoice ID for this payment. */
2104
+ invoiceId: string;
2105
+ /** The human-readable invoice number. */
2106
+ invoiceNumber: string;
2107
+ /** Invoice total in cents (100 = $1.00). */
2108
+ invoiceTotal: number;
2109
+ /** The invoice currency code. */
2110
+ invoiceCurrency: string;
2111
+ }
2112
+ /** Fired when a canceled subscription is reactivated and its reactivation charge succeeds. The subscription returns to active with a fresh invoice and a billing period anchored to the reactivation date. */
2113
+ interface SubscriptionReactivatedData {
2114
+ /** The subscription ID. */
2115
+ subscriptionId: string;
2116
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2117
+ customerId: string;
2118
+ /** Current status. Always "active" for this event. */
2119
+ status: string;
2120
+ /** ISO 8601 start of the new billing period, anchored to the reactivation date. */
2121
+ currentPeriodStart: string | null;
2122
+ /** ISO 8601 end of the new billing period. */
2123
+ currentPeriodEnd: string | null;
2124
+ /** Optional custom name for the subscription. */
2125
+ name: string | null;
2126
+ /** The fresh reactivation invoice ID. */
2127
+ invoiceId: string;
2128
+ /** The human-readable invoice number. */
2129
+ invoiceNumber: string;
2130
+ /** Invoice total in cents (100 = $1.00). */
2131
+ invoiceTotal: number;
2132
+ /** The invoice currency code. */
2133
+ invoiceCurrency: string;
2134
+ }
2135
+ /** Fired when a subscription is actually terminated at the end of the billing period. The status is now canceled and access should be revoked. This event is NOT fired when cancellation is scheduled — that triggers subscription.updated instead. See the cancellation lifecycle below. */
2136
+ interface SubscriptionCanceledData {
2137
+ /** The subscription ID. */
2138
+ subscriptionId: string;
2139
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2140
+ customerId: string;
2141
+ /** Always "canceled" for this event. Revoke access when you receive this. */
2142
+ status: string;
2143
+ /** ISO 8601 datetime when the customer originally requested cancellation. */
2144
+ canceledAt: string;
2145
+ /** The reason for cancellation, if provided. */
2146
+ cancelReason: string | null;
2147
+ /** ISO 8601 datetime when the subscription ended (matches the billing period end). */
2148
+ endDate: string;
2149
+ }
2150
+ /** Fired when subscription details change. The most common trigger is scheduling a cancellation — when a customer cancels, the status stays "active" until the billing period ends, but canceledAt and endDate are set immediately. Use this event to show "your subscription will end on {endDate}" in your UI. Access should NOT be revoked here — wait for subscription.canceled. */
2151
+ interface SubscriptionUpdatedData {
2152
+ /** The subscription ID. */
2153
+ subscriptionId: string;
2154
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2155
+ customerId: string;
2156
+ /** Current status. When cancellation is scheduled, this is still "active" — the subscription remains usable until endDate. */
2157
+ status: string;
2158
+ /** ISO 8601 datetime when cancellation was requested. Present when cancellation is scheduled, null otherwise. */
2159
+ canceledAt: string | null;
2160
+ /** The reason for cancellation, if provided. */
2161
+ cancelReason: string | null;
2162
+ /** ISO 8601 datetime when the subscription will end. Present when cancellation is scheduled — this is the date access should be revoked (via subscription.canceled). */
2163
+ endDate: string | null;
2164
+ }
2165
+ /** Fired when a subscription changes from one plan to another, including upgrades, downgrades, and billing interval changes. Access does not change on this event — the subscription stays active. */
2166
+ interface SubscriptionPlanChangedData {
2167
+ /** The subscription ID. */
2168
+ subscriptionId: string;
2169
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2170
+ customerId: string;
2171
+ /** The previous plan (id and name). */
2172
+ previousPlan: WebhookPlanRef;
2173
+ /** The new plan (id and name). */
2174
+ currentPlan: WebhookPlanRef;
2175
+ /** The billing interval (monthly, yearly). */
2176
+ billingInterval: string | null;
2177
+ /** Prorated credit in cents from the previous plan. */
2178
+ credit: number | null;
2179
+ /** Prorated charge in cents for the new plan. */
2180
+ charge: number | null;
2181
+ /** Total amount charged in cents. */
2182
+ totalCharged: number | null;
2183
+ }
2184
+ /** Fired when a cancellation is scheduled for the end of the billing period. The subscription stays active until effectiveAt — do NOT revoke access here. subscription.updated also fires for backward compatibility. */
2185
+ interface SubscriptionCancellationScheduledData {
2186
+ /** The subscription ID. */
2187
+ subscriptionId: string;
2188
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2189
+ customerId: string;
2190
+ /** Still "active" — the subscription remains usable until effectiveAt. */
2191
+ status: string;
2192
+ /** ISO 8601 datetime when the cancellation was requested. */
2193
+ canceledAt: string;
2194
+ /** The reason for cancellation, if provided. */
2195
+ cancelReason: string | null;
2196
+ /** ISO 8601 datetime when the cancellation will execute (the billing period end). subscription.canceled fires at this moment. */
2197
+ effectiveAt: string;
2198
+ }
2199
+ /** Fired when a scheduled cancellation is reverted before it executes. The subscription continues on its current plan and billing period as if it had never been canceled. */
2200
+ interface SubscriptionCancellationRevokedData {
2201
+ /** The subscription ID. */
2202
+ subscriptionId: string;
2203
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2204
+ customerId: string;
2205
+ /** Current status — typically "active". The scheduled cancellation no longer applies. */
2206
+ status: string;
2207
+ /** ISO 8601 end of the current billing period, which continues normally. */
2208
+ currentPeriodEnd: string | null;
2209
+ }
2210
+ /** Fired when a plan change (downgrade or shorter interval) is scheduled for the end of the billing period. The subscription stays on the current plan until effectiveAt, when subscription.plan_changed fires. */
2211
+ interface SubscriptionPlanChangeScheduledData {
2212
+ /** The subscription ID. */
2213
+ subscriptionId: string;
2214
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2215
+ customerId: string;
2216
+ /** Current status — the subscription stays usable. */
2217
+ status: string;
2218
+ /** The plan currently in effect (id and name). */
2219
+ currentPlan: WebhookPlanRef;
2220
+ /** The plan that takes effect at effectiveAt (id and name). */
2221
+ scheduledPlan: WebhookPlanRef;
2222
+ /** The current billing interval. */
2223
+ billingInterval: string | null;
2224
+ /** The new billing interval, if the change includes one. Null when only the plan changes. */
2225
+ scheduledBillingInterval: string | null;
2226
+ /** ISO 8601 datetime when the change executes (the billing period end). */
2227
+ effectiveAt: string;
2228
+ }
2229
+ /** Fired when a scheduled plan change is replaced by a different one before it executes. The replacement also fires subscription.plan_change_scheduled with the new target plan. */
2230
+ interface SubscriptionPlanChangeRevokedData {
2231
+ /** The subscription ID. */
2232
+ subscriptionId: string;
2233
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2234
+ customerId: string;
2235
+ /** Current status — the subscription stays usable. */
2236
+ status: string;
2237
+ /** The plan currently in effect (id and name). */
2238
+ currentPlan: WebhookPlanRef;
2239
+ /** The previously scheduled plan that will no longer take effect (id and name). */
2240
+ revokedPlan: WebhookPlanRef;
2241
+ /** The current billing interval. */
2242
+ billingInterval: string | null;
2243
+ /** The previously scheduled billing interval, if the revoked change included one. */
2244
+ revokedBillingInterval: string | null;
2245
+ }
2246
+ /** Fired when a recurring payment fails on a previously paid subscription and its status becomes past_due. Access is cut immediately for past_due subscriptions — use this to notify the customer and recover the payment. */
2247
+ interface SubscriptionPastDueData {
2248
+ /** The subscription ID. */
2249
+ subscriptionId: string;
2250
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2251
+ customerId: string;
2252
+ /** Always "past_due" for this event. */
2253
+ status: string;
2254
+ /** The invoice whose payment failure triggered the status. */
2255
+ invoiceId: string;
2256
+ /** The human-readable invoice number. */
2257
+ invoiceNumber: string;
2258
+ }
2259
+ /** Fired when a subscription enters its trial period after checkout. Grant access here — trialing subscriptions have full access until trialEndsAt. */
2260
+ interface TrialStartedData {
2261
+ /** The subscription ID. */
2262
+ subscriptionId: string;
2263
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2264
+ customerId: string;
2265
+ /** Always "trialing" for this event. */
2266
+ status: string;
2267
+ /** The plan ID. */
2268
+ planId: string;
2269
+ /** The plan name. */
2270
+ planName: string;
2271
+ /** ISO 8601 datetime when the trial ends. */
2272
+ trialEndsAt: string;
2273
+ }
2274
+ /** Fired when a trialing customer converts to a paid subscription before the trial ends — today this happens when they change plan during the trial, which charges the full new plan price immediately. Trials that simply run out fire trial.expired instead. */
2275
+ interface TrialConvertedData {
2276
+ /** The subscription ID. */
2277
+ subscriptionId: string;
2278
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2279
+ customerId: string;
2280
+ /** Always "active" for this event. */
2281
+ status: string;
2282
+ /** The plan ID the customer converted to. */
2283
+ planId: string;
2284
+ /** The plan name. */
2285
+ planName: string;
2286
+ }
2287
+ /** Fired when a trial period runs out and the billing cycle activates the subscription. The first regular invoice is generated right after — this is the natural trial-to-paid transition. */
2288
+ interface TrialExpiredData {
2289
+ /** The subscription ID. */
2290
+ subscriptionId: string;
2291
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2292
+ customerId: string;
2293
+ /** Current status — "active" once the billing cycle has activated the subscription. */
2294
+ status: string;
2295
+ /** The plan ID. */
2296
+ planId: string;
2297
+ /** The plan name. */
2298
+ planName: string;
2299
+ /** ISO 8601 datetime when the trial ended. */
2300
+ trialEndsAt: string;
2301
+ }
2302
+ /** Predictive event fired once, 3 days before a trial ends. Use it to remind the customer that billing starts soon. Emitted by a daily scan with a deterministic idempotency key, so it never fires twice for the same trial end date. */
2303
+ interface TrialWillEndData {
2304
+ /** The subscription ID. */
2305
+ subscriptionId: string;
2306
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2307
+ customerId: string;
2308
+ /** Always "trialing" for this event. */
2309
+ status: string;
2310
+ /** The plan ID. */
2311
+ planId: string;
2312
+ /** The plan name. */
2313
+ planName: string;
2314
+ /** ISO 8601 datetime when the trial will end. */
2315
+ trialEndsAt: string;
2316
+ }
2317
+ /** Fired when a trial checkout link is ready to share with the customer. Completing this checkout saves a payment method and starts the trial (trial.started) — the customer is not charged until the trial ends. */
2318
+ interface TrialCheckoutReadyData {
2319
+ /** The subscription ID. */
2320
+ subscriptionId: string;
2321
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2322
+ customerId: string;
2323
+ /** The plan name. */
2324
+ planName: string;
2325
+ /** The length of the trial in days. */
2326
+ trialDays: number;
2327
+ /** The hosted checkout URL to share with the customer. */
2328
+ checkoutUrl: string;
2329
+ }
2330
+ /** Fired when a checkout link for a subscription's first invoice is ready to share with the customer. Commet also emails the link — use this event to deliver it through your own channels. */
2331
+ interface CheckoutReadyData {
2332
+ /** The subscription ID. */
2333
+ subscriptionId: string;
2334
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2335
+ customerId: string;
2336
+ /** The invoice this checkout collects. */
2337
+ invoiceId: string;
2338
+ /** The human-readable invoice number. */
2339
+ invoiceNumber: string;
2340
+ /** Invoice total in cents (100 = $1.00). */
2341
+ invoiceTotal: number;
2342
+ /** The invoice currency code. */
2343
+ invoiceCurrency: string;
2344
+ /** The hosted checkout URL to share with the customer. */
2345
+ checkoutUrl: string;
2346
+ }
2347
+ /** Fired when a recurring payment is successfully processed. This event is for recurring charges only — the first checkout payment triggers subscription.activated instead. */
2348
+ interface PaymentReceivedData {
2349
+ /** The invoice ID. */
2350
+ invoiceId: string;
2351
+ /** The human-readable invoice number. */
2352
+ invoiceNumber: string;
2353
+ /** Invoice total in cents (100 = $1.00). */
2354
+ invoiceTotal: number;
2355
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2356
+ customerId: string;
2357
+ /** The subscription ID. */
2358
+ subscriptionId: string;
2359
+ /** The payment transaction ID. */
2360
+ paymentTransactionId: string;
2361
+ /** Gross amount in cents before fees. */
2362
+ grossAmount: number;
2363
+ /** The payment currency code. */
2364
+ currency: string;
2365
+ /** Net amount after fees in cents. */
2366
+ orgNetAmount: number;
2367
+ /** The customer email used for this payment. */
2368
+ customerEmail: string | null;
2369
+ /** ISO 8601 datetime when the payment was received. */
2370
+ paidAt: string | null;
2371
+ }
2372
+ /** Fired when a recurring charge fails. This event is for recurring charge failures only — card declines during initial checkout do not trigger this event. */
2373
+ interface PaymentFailedData {
2374
+ /** The invoice ID, if available. */
2375
+ invoiceId: string | null;
2376
+ /** The human-readable invoice number, if available. */
2377
+ invoiceNumber: string | null;
2378
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2379
+ customerId: string;
2380
+ /** The subscription ID, if the invoice is linked to a subscription. */
2381
+ subscriptionId: string | null;
2382
+ /** The failure code from the payment processor. */
2383
+ failureCode: string | null;
2384
+ /** A human-readable failure message. */
2385
+ failureMessage: string | null;
2386
+ }
2387
+ /** Fired when an outstanding invoice that previously failed is successfully paid — automatically on retry or by the customer through the portal. The subscription returns to active at the same time; use this event to close the dunning flow you opened on payment.failed. */
2388
+ interface PaymentRecoveredData {
2389
+ /** The recovered invoice ID. */
2390
+ invoiceId: string;
2391
+ /** The human-readable invoice number. */
2392
+ invoiceNumber: string;
2393
+ /** Invoice total in cents (100 = $1.00). */
2394
+ invoiceTotal: number;
2395
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2396
+ customerId: string;
2397
+ /** The subscription ID, if the invoice is linked to a subscription. */
2398
+ subscriptionId: string | null;
2399
+ }
2400
+ /** Fired after all dunning retries are exhausted and the subscription is canceled. Use it to close the recovery loop opened by payment.failed. */
2401
+ interface PaymentRetryFailedData {
2402
+ /** The invoice whose retries were exhausted. */
2403
+ invoiceId: string;
2404
+ /** The human-readable invoice number. */
2405
+ invoiceNumber: string;
2406
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2407
+ customerId: string;
2408
+ /** The subscription ID. */
2409
+ subscriptionId: string;
2410
+ /** Terminal dunning reason, usually the last processor decline code or "dunning_exhausted". */
2411
+ reason: string;
2412
+ }
2413
+ /** Fired when a payment is refunded, fully or partially. A full refund of a subscription invoice also cancels the subscription immediately (subscription.canceled fires with reason refund); partial refunds leave the subscription untouched. */
2414
+ interface PaymentRefundedData {
2415
+ /** The refunded payment transaction ID. */
2416
+ paymentTransactionId: string;
2417
+ /** The invoice the payment collected, or null for payments without an invoice. */
2418
+ invoiceId: string | null;
2419
+ /** The human-readable invoice number, if available. */
2420
+ invoiceNumber: string | null;
2421
+ /** The customer ID, when the payment is linked to an invoice. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2422
+ customerId: string | null;
2423
+ /** The subscription ID, if the invoice is linked to a subscription. */
2424
+ subscriptionId: string | null;
2425
+ /** The refunded amount in cents (100 = $1.00). */
2426
+ refundAmount: number;
2427
+ /** The refund currency code. */
2428
+ currency: string;
2429
+ }
2430
+ /** Fired when a cardholder opens a dispute (chargeback) against a payment. The disputed amount is frozen from your payout balance while the dispute is open; Commet, as the Merchant of Record, handles the resolution process. payment.dispute_resolved fires with the outcome. */
2431
+ interface PaymentDisputedData {
2432
+ /** The disputed payment transaction ID. */
2433
+ paymentTransactionId: string;
2434
+ /** The invoice the payment collected, or null for payments without an invoice. */
2435
+ invoiceId: string | null;
2436
+ /** The human-readable invoice number, if available. */
2437
+ invoiceNumber: string | null;
2438
+ /** The customer ID, when the payment is linked to an invoice. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2439
+ customerId: string | null;
2440
+ /** The subscription ID, if the invoice is linked to a subscription. */
2441
+ subscriptionId: string | null;
2442
+ /** The contested amount in cents (100 = $1.00). */
2443
+ disputeAmount: number;
2444
+ /** The dispute currency code. */
2445
+ currency: string;
2446
+ /** The provider's reason code (e.g. fraudulent, product_not_received), or null when none is given. */
2447
+ disputeReason: string | null;
2448
+ }
2449
+ /** Fired when a dispute is closed. Carries the same identifiers as payment.disputed plus the outcome: won restores the frozen amount to your balance, lost keeps the chargeback deducted. */
2450
+ interface PaymentDisputeResolvedData {
2451
+ /** The disputed payment transaction ID. */
2452
+ paymentTransactionId: string;
2453
+ /** The invoice the payment collected, or null for payments without an invoice. */
2454
+ invoiceId: string | null;
2455
+ /** The human-readable invoice number, if available. */
2456
+ invoiceNumber: string | null;
2457
+ /** The customer ID, when the payment is linked to an invoice. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2458
+ customerId: string | null;
2459
+ /** The subscription ID, if the invoice is linked to a subscription. */
2460
+ subscriptionId: string | null;
2461
+ /** The contested amount in cents (100 = $1.00). */
2462
+ disputeAmount: number;
2463
+ /** The dispute currency code. */
2464
+ currency: string;
2465
+ /** The provider's reason code, or null when none is given. */
2466
+ disputeReason: string | null;
2467
+ /** The resolution: "won" or "lost". */
2468
+ outcome: string;
2469
+ }
2470
+ /** Fired when a payment link is created. The link is pending — the customer has not paid yet. Do NOT fulfill here; wait for payment_link.completed. */
2471
+ interface PaymentLinkCreatedData {
2472
+ /** The payment link ID. */
2473
+ paymentId: string;
2474
+ /** The link status. Always "pending" for this event. */
2475
+ status: string;
2476
+ /** The total amount to collect in cents (100 = $1.00). */
2477
+ amount: number;
2478
+ /** The payment currency code. */
2479
+ currency: string;
2480
+ /** The payment description shown to the customer. */
2481
+ description: string;
2482
+ /** The customer ID, or null when the link is not tied to a customer. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2483
+ customerId: string | null;
2484
+ }
2485
+ /** Fired when a payment link is paid. The charge settled and a one-time invoice was generated. Fulfill the purchase on this event. */
2486
+ interface PaymentLinkCompletedData {
2487
+ /** The payment link ID. */
2488
+ paymentId: string;
2489
+ /** The link status. Always "succeeded" for this event. */
2490
+ status: string;
2491
+ /** The collected amount in cents (100 = $1.00). */
2492
+ amount: number;
2493
+ /** The payment currency code. */
2494
+ currency: string;
2495
+ /** The payment description shown to the customer. */
2496
+ description: string;
2497
+ /** The customer ID, or null when the link is not tied to a customer. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2498
+ customerId: string | null;
2499
+ /** The one-time invoice generated for this payment. */
2500
+ invoiceId: string;
2501
+ /** The human-readable invoice number. */
2502
+ invoiceNumber: string;
2503
+ /** The payment transaction ID for the settled charge. */
2504
+ paymentTransactionId: string;
2505
+ }
2506
+ /** Fired when a payment link charge attempt is declined. The link stays open and can be paid again — a failed link is retryable. */
2507
+ interface PaymentLinkFailedData {
2508
+ /** The payment link ID. */
2509
+ paymentId: string;
2510
+ /** The link status. Always "failed" for this event. */
2511
+ status: string;
2512
+ /** The amount that was attempted in cents (100 = $1.00). */
2513
+ amount: number;
2514
+ /** The payment currency code. */
2515
+ currency: string;
2516
+ /** The payment description shown to the customer. */
2517
+ description: string;
2518
+ /** The customer ID, or null when the link is not tied to a customer. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2519
+ customerId: string | null;
2520
+ /** The failure code from the payment processor. */
2521
+ failureCode: string | null;
2522
+ /** A human-readable failure message. */
2523
+ failureMessage: string | null;
2524
+ }
2525
+ /** Fired when a pending payment link is canceled before being paid. A canceled link can no longer be paid. */
2526
+ interface PaymentLinkCanceledData {
2527
+ /** The payment link ID. */
2528
+ paymentId: string;
2529
+ /** The link status. Always "canceled" for this event. */
2530
+ status: string;
2531
+ /** The total amount of the canceled link in cents (100 = $1.00). */
2532
+ amount: number;
2533
+ /** The payment currency code. */
2534
+ currency: string;
2535
+ /** The payment description shown to the customer. */
2536
+ description: string;
2537
+ /** The customer ID, or null when the link is not tied to a customer. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2538
+ customerId: string | null;
2539
+ }
2540
+ /** Fired when a new invoice is generated for a subscription, typically at the start of a billing period. */
2541
+ interface InvoiceCreatedData {
2542
+ /** The invoice ID. */
2543
+ invoiceId: string;
2544
+ /** The human-readable invoice number. */
2545
+ invoiceNumber: string;
2546
+ /** The invoice status (e.g. pending, paid). */
2547
+ invoiceStatus: string;
2548
+ /** ISO 8601 start of the billing period. */
2549
+ periodStart: string | null;
2550
+ /** ISO 8601 end of the billing period. */
2551
+ periodEnd: string | null;
2552
+ /** ISO 8601 date the invoice was issued. */
2553
+ issueDate: string | null;
2554
+ /** ISO 8601 date the invoice is due. */
2555
+ dueDate: string | null;
2556
+ /** The invoice currency code. */
2557
+ currency: string;
2558
+ /** Subtotal in cents (100 = $1.00). */
2559
+ subtotal: number;
2560
+ /** Total in cents (100 = $1.00). */
2561
+ total: number;
2562
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2563
+ customerId: string;
2564
+ /** The subscription ID, if the invoice is linked to a subscription. */
2565
+ subscriptionId: string | null;
2566
+ }
2567
+ /** Predictive event fired once, 3 days before an active subscription renews. Use it to notify the customer before they are charged. Carries no amount — usage-based charges are only final at renewal, when invoice.created delivers the actual invoice. */
2568
+ interface InvoiceUpcomingData {
2569
+ /** The subscription ID. */
2570
+ subscriptionId: string;
2571
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2572
+ customerId: string;
2573
+ /** Always "active" for this event. */
2574
+ status: string;
2575
+ /** The plan ID. */
2576
+ planId: string;
2577
+ /** The plan name. */
2578
+ planName: string;
2579
+ /** The billing interval (monthly, yearly). */
2580
+ billingInterval: string | null;
2581
+ /** ISO 8601 datetime when the current period ends and the renewal invoice is issued. */
2582
+ currentPeriodEnd: string;
2583
+ }
2584
+ /** Fired once when an outstanding invoice passes its due date without payment. The invoice keeps its outstanding status — overdue is a fact about the due date, not a new status. Use it to start your own dunning flow. */
2585
+ interface InvoiceOverdueData {
2586
+ /** The invoice ID. */
2587
+ invoiceId: string;
2588
+ /** The human-readable invoice number. */
2589
+ invoiceNumber: string;
2590
+ /** Always "outstanding" for this event. */
2591
+ invoiceStatus: string;
2592
+ /** ISO 8601 start of the billing period. */
2593
+ periodStart: string | null;
2594
+ /** ISO 8601 end of the billing period. */
2595
+ periodEnd: string | null;
2596
+ /** ISO 8601 date the invoice was issued. */
2597
+ issueDate: string | null;
2598
+ /** ISO 8601 date the invoice was due — now in the past. */
2599
+ dueDate: string;
2600
+ /** The invoice currency code. */
2601
+ currency: string;
2602
+ /** Subtotal in cents (100 = $1.00). */
2603
+ subtotal: number;
2604
+ /** Total in cents (100 = $1.00). */
2605
+ total: number;
2606
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2607
+ customerId: string;
2608
+ /** The subscription ID, if the invoice is linked to a subscription. */
2609
+ subscriptionId: string | null;
2610
+ }
2611
+ /** Fired when an invoice is voided — nullified before collection, either manually or automatically when its subscription is canceled. Voiding is terminal: a void invoice is never retried or collected. */
2612
+ interface InvoiceVoidedData {
2613
+ /** The invoice ID. */
2614
+ invoiceId: string;
2615
+ /** The human-readable invoice number. */
2616
+ invoiceNumber: string;
2617
+ /** Always "void" for this event. */
2618
+ invoiceStatus: string;
2619
+ /** ISO 8601 start of the billing period. */
2620
+ periodStart: string | null;
2621
+ /** ISO 8601 end of the billing period. */
2622
+ periodEnd: string | null;
2623
+ /** ISO 8601 date the invoice was issued. */
2624
+ issueDate: string | null;
2625
+ /** ISO 8601 date the invoice was due. */
2626
+ dueDate: string | null;
2627
+ /** The invoice currency code. */
2628
+ currency: string;
2629
+ /** Subtotal in cents (100 = $1.00). */
2630
+ subtotal: number;
2631
+ /** Total in cents (100 = $1.00). */
2632
+ total: number;
2633
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2634
+ customerId: string;
2635
+ /** The subscription ID, if the invoice is linked to a subscription. */
2636
+ subscriptionId: string | null;
2637
+ }
2638
+ /** Fired when Commet records a payment method for a subscription: after a paid checkout, when a trial starts with a card on file, or when a zero-total checkout completes. The card object carries display metadata only — full numbers never leave the payment provider. */
2639
+ interface PaymentMethodAttachedData {
2640
+ /** The subscription the payment method was saved for. */
2641
+ subscriptionId: string;
2642
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2643
+ customerId: string;
2644
+ /** Card display metadata: brand, last4, expMonth, expYear. Null when the method is not a card or its details cannot be retrieved. */
2645
+ card: WebhookCardInfo | null;
2646
+ }
2647
+ /** Fired when a customer replaces their default payment method through the customer portal. The new method applies to all of the customer's subscriptions. A payment method update is also a strong recovery signal for past-due subscriptions. */
2648
+ interface PaymentMethodUpdatedData {
2649
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2650
+ customerId: string;
2651
+ /** Card display metadata for the new method: brand, last4, expMonth, expYear. Null when the method is not a card or its details cannot be retrieved. */
2652
+ card: WebhookCardInfo | null;
2653
+ }
2654
+ /** Fired when a customer is created, via the API (including batch create), SDK, or dashboard. The payload is the customer resource exactly as GET /customers returns it. */
2655
+ interface CustomerCreatedData {
2656
+ /** The Commet customer ID (cus_...). */
2657
+ id: string;
2658
+ /** Your own identifier for this customer, if you provided one. */
2659
+ externalId: string | null;
2660
+ /** The customer's full name. */
2661
+ fullName: string | null;
2662
+ /** The customer's email. */
2663
+ email: string;
2664
+ /** The customer's timezone. */
2665
+ timezone: string | null;
2666
+ /** Custom key-value metadata you attached to the customer. */
2667
+ metadata: Record<string, unknown> | null;
2668
+ /** ISO 8601 datetime when the customer was created. */
2669
+ createdAt: string;
2670
+ /** ISO 8601 datetime of the last update. */
2671
+ updatedAt: string;
2672
+ }
2673
+ /** Fired when a customer's details change (email, name, timezone, externalId, or metadata). Carries the same customer resource shape as customer.created with the current values. */
2674
+ interface CustomerUpdatedData {
2675
+ /** The Commet customer ID (cus_...). */
2676
+ id: string;
2677
+ /** Your own identifier for this customer, if you provided one. */
2678
+ externalId: string | null;
2679
+ /** The customer's full name. */
2680
+ fullName: string | null;
2681
+ /** The customer's email. */
2682
+ email: string;
2683
+ /** The customer's timezone. */
2684
+ timezone: string | null;
2685
+ /** Custom key-value metadata you attached to the customer. */
2686
+ metadata: Record<string, unknown> | null;
2687
+ /** ISO 8601 datetime when the customer was created. */
2688
+ createdAt: string;
2689
+ /** ISO 8601 datetime of this update. */
2690
+ updatedAt: string;
2691
+ }
2692
+ /** Aggregate entitlement event answering one question: what can this customer access right now? Fired on every entitlement transition (subscription lifecycle, plan changes, trials, past due, scheduled cancellations) with the customer's CURRENT subscription, plan, features, seats, and credits or balance. Handle this single event to keep access in sync instead of wiring every lifecycle event. */
2693
+ interface CustomerStateChangedData {
2694
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2695
+ customerId: string;
2696
+ /** What caused the transition. One of: subscription_created, subscription_activated, subscription_canceled, plan_change, past_due, trial_started, trial_converted, trial_expired, cancellation_scheduled, cancellation_revoked, seats_updated, addon_activated, addon_deactivated, credits_depleted, balance_depleted, quota_exceeded. */
2697
+ trigger: string;
2698
+ /** The customer's current subscription status, or "none" when no live subscription exists. Grant access only when trialing or active. */
2699
+ status: string;
2700
+ /** The live subscription ID, or null when status is none. */
2701
+ subscriptionId: string | null;
2702
+ /** The current plan (id and name), or null when status is none. */
2703
+ plan: WebhookPlanRef | null;
2704
+ /** The current billing interval. */
2705
+ billingInterval: string | null;
2706
+ /** The plan's consumption model: metered, credits, or balance. */
2707
+ consumptionModel: string | null;
2708
+ /** Current feature access, one entry per plan feature: code, name, type, allowed, enabled, current, included, remaining, overageQuantity, overageUnitPrice, unlimited, overageEnabled, billedQuantity. Fields that do not apply to a feature type are null. */
2709
+ features: Array<WebhookFeatureAccess>;
2710
+ /** Summary of seats-type features: code, current, included, remaining, unlimited. */
2711
+ seats: Array<WebhookSeatSummary>;
2712
+ /** For credits plans: planCredits, purchasedCredits, totalCredits. Null otherwise. */
2713
+ credits: WebhookCreditsBalance | null;
2714
+ /** For balance plans: currentBalance in rate scale (10000 = $1.00). Null otherwise. */
2715
+ balance: WebhookBalance | null;
2716
+ }
2717
+ /** Fired when non-purchase credits are granted to a subscription: plan-included credits at the start of each billing period, or a manual adjustment from the dashboard. Credit pack purchases fire credits.purchased instead. */
2718
+ interface CreditsGrantedData {
2719
+ /** The subscription ID. */
2720
+ subscriptionId: string;
2721
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2722
+ customerId: string;
2723
+ /** The number of credits granted. */
2724
+ credits: number;
2725
+ /** Why the credits were granted: period_reset or manual_adjustment. */
2726
+ reason: string;
2727
+ }
2728
+ /** Fired when a customer buys a credit pack through the customer portal and the payment succeeds. Purchased credits never expire — unlike plan credits, they survive period resets. Plan-included credit grants fire credits.granted instead. */
2729
+ interface CreditsPurchasedData {
2730
+ /** The subscription ID. */
2731
+ subscriptionId: string;
2732
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2733
+ customerId: string;
2734
+ /** The invoice issued for the purchase. */
2735
+ invoiceId: string;
2736
+ /** The human-readable invoice number. */
2737
+ invoiceNumber: string;
2738
+ /** The purchased credit pack's name. */
2739
+ creditPackName: string;
2740
+ /** The number of credits purchased. */
2741
+ credits: number;
2742
+ }
2743
+ /** Fired when a subscription's remaining credits cross below 10% of the credits granted for the current period. Emitted once per billing period, when the crossing happens. */
2744
+ interface CreditsLowData {
2745
+ /** The subscription ID. */
2746
+ subscriptionId: string;
2747
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2748
+ customerId: string;
2749
+ /** Total credits remaining (plan plus purchased). */
2750
+ remainingCredits: number;
2751
+ /** The low-credit threshold that was crossed: 10% of the period's granted plan credits. */
2752
+ thresholdCredits: number;
2753
+ /** The plan credits granted at the last period reset. */
2754
+ periodCredits: number;
2755
+ }
2756
+ /** Fired when a subscription's credits hit zero. Usage requests that need more credits than remain are rejected from this point. Also fires customer.state_changed with trigger credits_depleted. */
2757
+ interface CreditsDepletedData {
2758
+ /** The subscription ID. */
2759
+ subscriptionId: string;
2760
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2761
+ customerId: string;
2762
+ /** Credits remaining after depletion. Always 0. */
2763
+ remainingCredits: number;
2764
+ }
2765
+ /** Fired at the period reset when unused plan credits from the previous period are discarded. Plan credits expire at period end; purchased credits never expire and are not affected. */
2766
+ interface CreditsExpiredData {
2767
+ /** The subscription ID. */
2768
+ subscriptionId: string;
2769
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2770
+ customerId: string;
2771
+ /** The unused plan credits that were discarded. */
2772
+ expiredCredits: number;
2773
+ }
2774
+ /** Fired when a customer on a balance plan tops up their prepaid balance through the customer portal and the payment succeeds. */
2775
+ interface BalanceToppedUpData {
2776
+ /** The subscription ID. */
2777
+ subscriptionId: string;
2778
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2779
+ customerId: string;
2780
+ /** The invoice issued for the top-up. */
2781
+ invoiceId: string;
2782
+ /** The human-readable invoice number. */
2783
+ invoiceNumber: string;
2784
+ /** The topped-up value in rate scale (10000 = $1.00 of the subscription currency). */
2785
+ amount: number;
2786
+ /** The subscription currency. */
2787
+ currency: string;
2788
+ }
2789
+ /** Fired when a subscription's prepaid balance crosses below 10% of its last refill (period reset, top-up, or manual adjustment). Emitted once per crossing. */
2790
+ interface BalanceLowData {
2791
+ /** The subscription ID. */
2792
+ subscriptionId: string;
2793
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2794
+ customerId: string;
2795
+ /** The remaining balance in rate scale (10000 = $1.00 of the subscription currency). */
2796
+ currentBalance: number;
2797
+ /** The low-balance threshold that was crossed: 10% of the last refill, in rate scale. */
2798
+ thresholdBalance: number;
2799
+ /** The subscription currency. */
2800
+ currency: string;
2801
+ }
2802
+ /** Fired when a subscription's prepaid balance crosses to zero or below. With block-on-exhaustion plans further usage is rejected; otherwise the balance can go negative. Also fires customer.state_changed with trigger balance_depleted. */
2803
+ interface BalanceDepletedData {
2804
+ /** The subscription ID. */
2805
+ subscriptionId: string;
2806
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2807
+ customerId: string;
2808
+ /** The balance after depletion in rate scale. Zero, or negative when overage is allowed. */
2809
+ currentBalance: number;
2810
+ /** The subscription currency. */
2811
+ currency: string;
2812
+ }
2813
+ /** Fired when a metered feature's usage crosses 80% of its included quantity for the current period. Emitted once per feature per billing period, when the crossing happens. */
2814
+ interface QuotaThresholdReachedData {
2815
+ /** The subscription ID. */
2816
+ subscriptionId: string;
2817
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2818
+ customerId: string;
2819
+ /** The metered feature code. */
2820
+ featureCode: string;
2821
+ /** Total usage in the current period after the crossing. */
2822
+ currentUsage: number;
2823
+ /** The included quantity for the period. */
2824
+ includedAmount: number;
2825
+ /** ISO 8601 start of the usage period. */
2826
+ periodStart: string;
2827
+ }
2828
+ /** Fired when a metered feature passes its included quantity. With overage enabled it means overage billing began; with overage disabled it means the hard limit was hit and further usage is rejected (this case also fires customer.state_changed with trigger quota_exceeded). Emitted once per feature per billing period. */
2829
+ interface QuotaExceededData {
2830
+ /** The subscription ID. */
2831
+ subscriptionId: string;
2832
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2833
+ customerId: string;
2834
+ /** The metered feature code. */
2835
+ featureCode: string;
2836
+ /** Total usage in the current period. */
2837
+ currentUsage: number;
2838
+ /** The included quantity for the period. */
2839
+ includedAmount: number;
2840
+ /** True when overage billing began; false when the hard limit was hit and usage is now blocked. */
2841
+ overageEnabled: boolean;
2842
+ /** ISO 8601 start of the usage period. */
2843
+ periodStart: string;
2844
+ }
2845
+ /** Fired for every processed usage event. HIGH VOLUME: this fires once per tracked event, so it is excluded from family select-all in the dashboard — subscribe to it explicitly and make sure your endpoint can absorb your own ingest rate. */
2846
+ interface UsageRecordedData {
2847
+ /** The usage event ID. */
2848
+ usageEventId: string;
2849
+ /** The subscription ID. */
2850
+ subscriptionId: string;
2851
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2852
+ customerId: string;
2853
+ /** The feature code the usage was tracked against. */
2854
+ featureCode: string;
2855
+ /** The recorded quantity. For AI model events this is the total token count. */
2856
+ value: number;
2857
+ /** ISO 8601 timestamp of the usage event. */
2858
+ ts: string;
2859
+ }
2860
+ /** Fired when a customer's seat count changes for a seats-type feature — via the SDK seats endpoints or the dashboard. Also fires customer.state_changed with trigger seats_updated. */
2861
+ interface SeatsUpdatedData {
2862
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2863
+ customerId: string;
2864
+ /** The live subscription ID, or null when the customer has no live subscription. */
2865
+ subscriptionId: string | null;
2866
+ /** The seats feature code. */
2867
+ featureCode: string;
2868
+ /** The seat count before the change. */
2869
+ previousSeats: number;
2870
+ /** The seat count after the change. */
2871
+ currentSeats: number;
2872
+ }
2873
+ /** Fired when a seat change reaches or passes the included seat limit of the customer's plan. Emitted once per crossing — only when the count moves from below the limit to at or above it. */
2874
+ interface SeatsLimitReachedData {
2875
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2876
+ customerId: string;
2877
+ /** The subscription ID. */
2878
+ subscriptionId: string;
2879
+ /** The seats feature code. */
2880
+ featureCode: string;
2881
+ /** The seat count after the change. */
2882
+ currentSeats: number;
2883
+ /** The included seat limit of the plan. */
2884
+ includedSeats: number;
2885
+ }
2886
+ /** Fired when an add-on is activated on a subscription — via the API or a customer portal purchase. The prorated activation charge, if any, has already succeeded. Also fires customer.state_changed with trigger addon_activated. */
2887
+ interface AddonActivatedData {
2888
+ /** The subscription ID. */
2889
+ subscriptionId: string;
2890
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2891
+ customerId: string;
2892
+ /** The add-on: id and name. */
2893
+ addon: WebhookAddonRef;
2894
+ /** The feature the add-on unlocks or extends. */
2895
+ featureCode: string;
2896
+ /** The prorated amount charged at activation in rate scale (10000 = $1.00). Zero when nothing was charged. */
2897
+ proratedPrice: number;
2898
+ /** The subscription currency. */
2899
+ currency: string;
2900
+ }
2901
+ /** Fired when an active add-on is deactivated from a subscription. Also fires customer.state_changed with trigger addon_deactivated. */
2902
+ interface AddonDeactivatedData {
2903
+ /** The subscription ID. */
2904
+ subscriptionId: string;
2905
+ /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
2906
+ customerId: string;
2907
+ /** The add-on: id and name. */
2908
+ addon: WebhookAddonRef;
2909
+ /** The feature the add-on unlocked or extended. */
2910
+ featureCode: string;
2911
+ }
2912
+ /** Organization-level event about YOUR money as the merchant. Fired when payment funds the provider was holding become available to pay out to your bank. */
2913
+ interface PayoutAvailableData {
2914
+ /** Your full available payout balance in cents (100 = $1.00) at the time of the event — not just the newly released funds. */
2915
+ availableAmount: number;
2916
+ /** The payout balance currency. Always "usd". */
2917
+ currency: string;
2918
+ }
2919
+ /** Fired when a payout of your available balance is requested and the transfer toward your bank is initiated. The lifecycle continues with payout.paid or payout.failed. */
2920
+ interface PayoutCreatedData {
2921
+ /** The payout ID. */
2922
+ payoutId: string;
2923
+ /** Gross payout amount in cents (100 = $1.00). */
2924
+ amount: number;
2925
+ /** Provider transfer fee in cents. */
2926
+ fee: number;
2927
+ /** What reaches your bank in cents (amount minus fee). */
2928
+ netAmount: number;
2929
+ /** The payout currency. Always "usd". */
2930
+ currency: string;
2931
+ /** The payout status. "pending" at creation. */
2932
+ status: string;
2933
+ /** Destination bank display metadata: bankName and last4. Full account numbers never appear in webhook payloads. */
2934
+ destinationBank: WebhookBankRef | null;
2935
+ /** ISO 8601 datetime when the payout was created. */
2936
+ createdAt: string;
2937
+ }
2938
+ /** Fired when the bank settlement of a payout completes — the moment the money actually reaches your bank account, confirmed by the payment provider. Fires exactly once per payout. */
2939
+ interface PayoutPaidData {
2940
+ /** The payout ID. */
2941
+ payoutId: string;
2942
+ /** Gross payout amount in cents (100 = $1.00). */
2943
+ amount: number;
2944
+ /** Provider transfer fee in cents. */
2945
+ fee: number;
2946
+ /** What reached your bank in cents (amount minus fee). */
2947
+ netAmount: number;
2948
+ /** The payout currency. Always "usd". */
2949
+ currency: string;
2950
+ /** Always "paid" for this event. */
2951
+ status: string;
2952
+ /** Destination bank display metadata: bankName and last4. */
2953
+ destinationBank: WebhookBankRef | null;
2954
+ /** ISO 8601 datetime when the provider confirmed the deposit arrived. */
2955
+ paidAt: string | null;
2956
+ }
2957
+ /** Fired when the provider reports a payout could not be completed — most commonly a bank rejection (closed account, invalid details). The funds return to your available balance. */
2958
+ interface PayoutFailedData {
2959
+ /** The payout ID. */
2960
+ payoutId: string;
2961
+ /** Gross payout amount in cents (100 = $1.00). */
2962
+ amount: number;
2963
+ /** Provider transfer fee in cents. */
2964
+ fee: number;
2965
+ /** What would have reached your bank in cents. */
2966
+ netAmount: number;
2967
+ /** The payout currency. Always "usd". */
2968
+ currency: string;
2969
+ /** Always "failed" for this event. */
2970
+ status: string;
2971
+ /** Destination bank display metadata: bankName and last4. */
2972
+ destinationBank: WebhookBankRef | null;
2973
+ /** ISO 8601 datetime when the failure was recorded. */
2974
+ failedAt: string | null;
2975
+ /** The provider's failure code, when available. */
2976
+ failureCode: string | null;
2977
+ /** A human-readable failure message, when available. */
2978
+ failureMessage: string | null;
2979
+ }
2980
+ interface WebhookEventEnvelope<E extends WebhookEvent, D> {
2981
+ event: E;
2982
+ timestamp: string;
2983
+ organizationId: string;
2984
+ mode: "live" | "sandbox";
2985
+ /** API version date, e.g. "2026-06-10" */
2986
+ apiVersion: string;
2987
+ data: D;
2988
+ }
2989
+ type WebhookEventPayload = WebhookEventEnvelope<"subscription.created", SubscriptionCreatedData> | WebhookEventEnvelope<"subscription.activated", SubscriptionActivatedData> | WebhookEventEnvelope<"subscription.reactivated", SubscriptionReactivatedData> | WebhookEventEnvelope<"subscription.canceled", SubscriptionCanceledData> | WebhookEventEnvelope<"subscription.updated", SubscriptionUpdatedData> | WebhookEventEnvelope<"subscription.plan_changed", SubscriptionPlanChangedData> | WebhookEventEnvelope<"subscription.cancellation_scheduled", SubscriptionCancellationScheduledData> | WebhookEventEnvelope<"subscription.cancellation_revoked", SubscriptionCancellationRevokedData> | WebhookEventEnvelope<"subscription.plan_change_scheduled", SubscriptionPlanChangeScheduledData> | WebhookEventEnvelope<"subscription.plan_change_revoked", SubscriptionPlanChangeRevokedData> | WebhookEventEnvelope<"subscription.past_due", SubscriptionPastDueData> | WebhookEventEnvelope<"trial.started", TrialStartedData> | WebhookEventEnvelope<"trial.converted", TrialConvertedData> | WebhookEventEnvelope<"trial.expired", TrialExpiredData> | WebhookEventEnvelope<"trial.will_end", TrialWillEndData> | WebhookEventEnvelope<"trial.checkout_ready", TrialCheckoutReadyData> | WebhookEventEnvelope<"checkout.ready", CheckoutReadyData> | WebhookEventEnvelope<"payment.received", PaymentReceivedData> | WebhookEventEnvelope<"payment.failed", PaymentFailedData> | WebhookEventEnvelope<"payment.recovered", PaymentRecoveredData> | WebhookEventEnvelope<"payment.retry_failed", PaymentRetryFailedData> | WebhookEventEnvelope<"payment.refunded", PaymentRefundedData> | WebhookEventEnvelope<"payment.disputed", PaymentDisputedData> | WebhookEventEnvelope<"payment.dispute_resolved", PaymentDisputeResolvedData> | WebhookEventEnvelope<"payment_link.created", PaymentLinkCreatedData> | WebhookEventEnvelope<"payment_link.completed", PaymentLinkCompletedData> | WebhookEventEnvelope<"payment_link.failed", PaymentLinkFailedData> | WebhookEventEnvelope<"payment_link.canceled", PaymentLinkCanceledData> | WebhookEventEnvelope<"invoice.created", InvoiceCreatedData> | WebhookEventEnvelope<"invoice.upcoming", InvoiceUpcomingData> | WebhookEventEnvelope<"invoice.overdue", InvoiceOverdueData> | WebhookEventEnvelope<"invoice.voided", InvoiceVoidedData> | WebhookEventEnvelope<"payment_method.attached", PaymentMethodAttachedData> | WebhookEventEnvelope<"payment_method.updated", PaymentMethodUpdatedData> | WebhookEventEnvelope<"customer.created", CustomerCreatedData> | WebhookEventEnvelope<"customer.updated", CustomerUpdatedData> | WebhookEventEnvelope<"customer.state_changed", CustomerStateChangedData> | WebhookEventEnvelope<"credits.granted", CreditsGrantedData> | WebhookEventEnvelope<"credits.purchased", CreditsPurchasedData> | WebhookEventEnvelope<"credits.low", CreditsLowData> | WebhookEventEnvelope<"credits.depleted", CreditsDepletedData> | WebhookEventEnvelope<"credits.expired", CreditsExpiredData> | WebhookEventEnvelope<"balance.topped_up", BalanceToppedUpData> | WebhookEventEnvelope<"balance.low", BalanceLowData> | WebhookEventEnvelope<"balance.depleted", BalanceDepletedData> | WebhookEventEnvelope<"quota.threshold_reached", QuotaThresholdReachedData> | WebhookEventEnvelope<"quota.exceeded", QuotaExceededData> | WebhookEventEnvelope<"usage.recorded", UsageRecordedData> | WebhookEventEnvelope<"seats.updated", SeatsUpdatedData> | WebhookEventEnvelope<"seats.limit_reached", SeatsLimitReachedData> | WebhookEventEnvelope<"addon.activated", AddonActivatedData> | WebhookEventEnvelope<"addon.deactivated", AddonDeactivatedData> | WebhookEventEnvelope<"payout.available", PayoutAvailableData> | WebhookEventEnvelope<"payout.created", PayoutCreatedData> | WebhookEventEnvelope<"payout.paid", PayoutPaidData> | WebhookEventEnvelope<"payout.failed", PayoutFailedData>;
2990
+ interface WebhookEventDataMap {
2991
+ "subscription.created": SubscriptionCreatedData;
2992
+ "subscription.activated": SubscriptionActivatedData;
2993
+ "subscription.reactivated": SubscriptionReactivatedData;
2994
+ "subscription.canceled": SubscriptionCanceledData;
2995
+ "subscription.updated": SubscriptionUpdatedData;
2996
+ "subscription.plan_changed": SubscriptionPlanChangedData;
2997
+ "subscription.cancellation_scheduled": SubscriptionCancellationScheduledData;
2998
+ "subscription.cancellation_revoked": SubscriptionCancellationRevokedData;
2999
+ "subscription.plan_change_scheduled": SubscriptionPlanChangeScheduledData;
3000
+ "subscription.plan_change_revoked": SubscriptionPlanChangeRevokedData;
3001
+ "subscription.past_due": SubscriptionPastDueData;
3002
+ "trial.started": TrialStartedData;
3003
+ "trial.converted": TrialConvertedData;
3004
+ "trial.expired": TrialExpiredData;
3005
+ "trial.will_end": TrialWillEndData;
3006
+ "trial.checkout_ready": TrialCheckoutReadyData;
3007
+ "checkout.ready": CheckoutReadyData;
3008
+ "payment.received": PaymentReceivedData;
3009
+ "payment.failed": PaymentFailedData;
3010
+ "payment.recovered": PaymentRecoveredData;
3011
+ "payment.retry_failed": PaymentRetryFailedData;
3012
+ "payment.refunded": PaymentRefundedData;
3013
+ "payment.disputed": PaymentDisputedData;
3014
+ "payment.dispute_resolved": PaymentDisputeResolvedData;
3015
+ "payment_link.created": PaymentLinkCreatedData;
3016
+ "payment_link.completed": PaymentLinkCompletedData;
3017
+ "payment_link.failed": PaymentLinkFailedData;
3018
+ "payment_link.canceled": PaymentLinkCanceledData;
3019
+ "invoice.created": InvoiceCreatedData;
3020
+ "invoice.upcoming": InvoiceUpcomingData;
3021
+ "invoice.overdue": InvoiceOverdueData;
3022
+ "invoice.voided": InvoiceVoidedData;
3023
+ "payment_method.attached": PaymentMethodAttachedData;
3024
+ "payment_method.updated": PaymentMethodUpdatedData;
3025
+ "customer.created": CustomerCreatedData;
3026
+ "customer.updated": CustomerUpdatedData;
3027
+ "customer.state_changed": CustomerStateChangedData;
3028
+ "credits.granted": CreditsGrantedData;
3029
+ "credits.purchased": CreditsPurchasedData;
3030
+ "credits.low": CreditsLowData;
3031
+ "credits.depleted": CreditsDepletedData;
3032
+ "credits.expired": CreditsExpiredData;
3033
+ "balance.topped_up": BalanceToppedUpData;
3034
+ "balance.low": BalanceLowData;
3035
+ "balance.depleted": BalanceDepletedData;
3036
+ "quota.threshold_reached": QuotaThresholdReachedData;
3037
+ "quota.exceeded": QuotaExceededData;
3038
+ "usage.recorded": UsageRecordedData;
3039
+ "seats.updated": SeatsUpdatedData;
3040
+ "seats.limit_reached": SeatsLimitReachedData;
3041
+ "addon.activated": AddonActivatedData;
3042
+ "addon.deactivated": AddonDeactivatedData;
3043
+ "payout.available": PayoutAvailableData;
3044
+ "payout.created": PayoutCreatedData;
3045
+ "payout.paid": PayoutPaidData;
3046
+ "payout.failed": PayoutFailedData;
3047
+ }
3048
+
1917
3049
  /**
1918
3050
  * Webhook payload structure from Commet
1919
3051
  */
@@ -1946,10 +3078,9 @@ interface WebhookData {
1946
3078
  canceledAt?: string;
1947
3079
  [key: string]: unknown;
1948
3080
  }
1949
- /**
1950
- * Supported webhook events
1951
- */
1952
- type WebhookEvent = "subscription.created" | "subscription.activated" | "subscription.canceled" | "subscription.updated" | "subscription.plan_changed" | "payment.received" | "payment.failed" | "invoice.created";
3081
+ type WebhookEventHandler<E extends WebhookEvent> = (data: WebhookEventDataMap[E], payload: Extract<WebhookEventPayload, {
3082
+ event: E;
3083
+ }>) => void | Promise<void>;
1953
3084
  interface VerifyParams {
1954
3085
  payload: string;
1955
3086
  signature: string | null;
@@ -2008,12 +3139,13 @@ interface TestWebhookParams {
2008
3139
  }
2009
3140
  declare class Webhooks {
2010
3141
  private httpClient?;
3142
+ private readonly eventHandlers;
2011
3143
  constructor(httpClient?: CommetHTTPClient | undefined);
2012
- /** HMAC-SHA256 verification. Payload must be the raw request body string, not parsed JSON. */
2013
3144
  verify(params: VerifyParams): boolean;
2014
3145
  private generateSignature;
2015
- /** Verifies signature and parses JSON in one step. Returns null if invalid. */
2016
3146
  verifyAndParse(params: VerifyAndParseParams): WebhookPayload | null;
3147
+ on<E extends WebhookEvent>(event: E, handler: WebhookEventHandler<E>): this;
3148
+ process(params: VerifyAndParseParams): Promise<WebhookPayload | null>;
2017
3149
  list(params?: ListWebhooksParams, options?: RequestOptions): Promise<ApiResponse<WebhookEndpoint[]>>;
2018
3150
  create(params: CreateWebhookParams, options?: RequestOptions): Promise<ApiResponse<WebhookEndpointCreated>>;
2019
3151
  get(params: GetWebhookParams, options?: RequestOptions): Promise<ApiResponse<WebhookEndpoint>>;
@@ -2038,4 +3170,4 @@ declare function registerIntegration(name: string, version: string): void;
2038
3170
  declare const API_VERSION = "2026-06-10";
2039
3171
  declare const SDK_VERSION: string;
2040
3172
 
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 };
3173
+ export { API_VERSION, type ActivateAddonParams, type ActiveAddon, type AddPayoutBankAccountParams, type AddPlanFeatureParams, type AddPlanPriceParams, type AddPlanToGroupParams, type AddQuotaParams, type AddSeatsParams, type AddedPlanToGroup, type Addon, type AddonActivatedData, type AddonDeactivatedData, type AdjustBalanceParams, type AdvanceTestClockParams, type ApiErrorDetail, type ApiKey, type ApiResponse, type BalanceAdjustment, type BalanceDepletedData, type BalanceLowData, type BalanceToppedUpData, 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, type CheckoutReadyData, 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 CreditsDepletedData, type CreditsExpiredData, type CreditsGrantedData, type CreditsLowData, type CreditsPurchasedData, type Currency, type Customer, type CustomerBatch, type CustomerCreatedData, type CustomerID, type CustomerStateChangedData, type CustomerUpdatedData, 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 InvoiceCreatedData, type InvoiceDownload, type InvoiceOverdueData, type InvoiceStatus, type InvoiceType, type InvoiceUpcomingData, type InvoiceVoidedData, 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 PaymentDisputeResolvedData, type PaymentDisputedData, type PaymentFailedData, type PaymentLinkCanceledData, type PaymentLinkCompletedData, type PaymentLinkCreatedData, type PaymentLinkFailedData, type PaymentMethodAttachedData, type PaymentMethodUpdateCheckout, type PaymentMethodUpdatedData, type PaymentReceivedData, type PaymentRecoveredData, type PaymentRefundedData, type PaymentRetryFailedData, type Payout, type PayoutAvailableData, type PayoutBankAccount, type PayoutCreatedData, type PayoutFailedData, type PayoutPaidData, 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 QuotaExceededData, type QuotaThresholdReachedData, 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 SeatsLimitReachedData, type SeatsUpdatedData, type SendInvoiceParams, type SentInvoice, type SetDefaultPlanPriceParams, type SetPlanRegionalPricingParams, type SetPlanVisibilityParams, type SetQuotaParams, type SetSeatsParams, type Subscription, type SubscriptionActivatedData, type SubscriptionAddon, type SubscriptionCanceledData, type SubscriptionCancellationRevokedData, type SubscriptionCancellationScheduledData, type SubscriptionCreatedData, type SubscriptionPastDueData, type SubscriptionPlanChangeRevokedData, type SubscriptionPlanChangeScheduledData, type SubscriptionPlanChangedData, type SubscriptionReactivatedData, type SubscriptionStatus, type SubscriptionUpdatedData, 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 TrialCheckoutReadyData, type TrialConvertedData, type TrialExpiredData, type TrialStartedData, type TrialWillEndData, 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 UsageRecordedData, type WebhookAddonRef, type WebhookBalance, type WebhookBankRef, type WebhookCardInfo, type WebhookCreditsBalance, type WebhookData, type WebhookEndpoint, type WebhookEndpointCreated, type WebhookEvent, type WebhookEventDataMap, type WebhookEventEnvelope, type WebhookEventHandler, type WebhookEventPayload, type WebhookFeatureAccess, type WebhookPayload, type WebhookPlanRef, type WebhookSeatSummary, type WebhookTestResult, Webhooks, createCommet, Commet as default, defineConfig, registerIntegration };