@commet/node 9.9.0 → 9.10.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.
Files changed (50) hide show
  1. package/dist/index.d.mts +813 -15
  2. package/dist/index.d.ts +813 -15
  3. package/dist/index.js +199 -6
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +199 -6
  6. package/dist/index.mjs.map +1 -1
  7. package/docs/ai-onboarding/mcp-server.md +2 -0
  8. package/docs/api-reference/addons.md +3 -1
  9. package/docs/api-reference/credit-packs.md +3 -1
  10. package/docs/api-reference/generated-webhooks.md +2 -2
  11. package/docs/api-reference/index.md +3 -3
  12. package/docs/api-reference/plans.md +483 -6
  13. package/docs/api-reference/subscriptions.md +43 -3
  14. package/docs/documentation/api-versioning.md +8 -2
  15. package/docs/documentation/cli.md +4 -0
  16. package/docs/documentation/customers/customer-portal.md +2 -2
  17. package/docs/documentation/plans/add-ons.md +14 -3
  18. package/docs/documentation/plans/consumption-models.md +3 -3
  19. package/docs/documentation/plans/create-plans.md +5 -1
  20. package/docs/documentation/plans/credit-packs.md +19 -9
  21. package/docs/documentation/plans/plan-groups.md +1 -1
  22. package/docs/documentation/plans/plan-versions.md +265 -0
  23. package/docs/documentation/sales/regional-prices.md +23 -9
  24. package/docs/documentation/sales/trial-periods.md +3 -3
  25. package/docs/documentation/subscriptions/manage-subscriptions.md +50 -13
  26. package/docs/documentation/subscriptions/upgrade-and-downgrade-plans.md +2 -0
  27. package/docs/errors/addon_has_activations.md +2 -2
  28. package/docs/errors/addon_unavailable.md +22 -0
  29. package/docs/errors/credit_pack_unavailable.md +22 -0
  30. package/docs/errors/index.md +8 -2
  31. package/docs/errors/missing_regional_price.md +3 -3
  32. package/docs/errors/plan_experiment_not_found.md +22 -0
  33. package/docs/errors/plan_version_not_found.md +22 -0
  34. package/docs/errors/subscribers_do_not_fit.md +22 -0
  35. package/docs/errors/version_not_newer.md +22 -0
  36. package/docs/knowledge-base/how-do-free-plans-work-without-payment.md +4 -3
  37. package/docs/knowledge-base/how-do-trial-periods-work.md +3 -3
  38. package/docs/knowledge-base/how-does-billing-work.md +26 -28
  39. package/docs/knowledge-base/how-does-quota-based-billing-work.md +12 -22
  40. package/docs/knowledge-base/how-does-seat-based-billing-work.md +12 -22
  41. package/docs/knowledge-base/what-happens-when-a-customer-changes-plans.md +11 -8
  42. package/docs/knowledge-base/what-happens-when-you-change-your-prices.md +34 -29
  43. package/docs/knowledge-base/what-invoices-do-customers-receive-and-when.md +1 -1
  44. package/docs/manifest.json +191 -2
  45. package/docs/platform-documentation.md +1 -0
  46. package/docs/schemas.md +107 -0
  47. package/docs/webhooks/introduction.md +3 -1
  48. package/docs/webhooks.md +24 -0
  49. package/docs/webhooks.openapi.json +231 -1
  50. package/package.json +1 -1
package/docs/schemas.md CHANGED
@@ -140,6 +140,7 @@ Generated from Commet API version `2026-08-27`.
140
140
  - `includedUnits` (`number | null`, required)
141
141
  - `overageRate` (`number | null`, required)
142
142
  - `creditCost` (`number | null`, required)
143
+ - `planIds` (`Array<string>`, required) — Plans that sell the add-on.
143
144
  - `object` (`"addon"`, required)
144
145
  - `livemode` (`boolean`, required)
145
146
 
@@ -214,6 +215,7 @@ Generated from Commet API version `2026-08-27`.
214
215
  - `hasPaymentMethod` (`boolean`, required) — Whether Commet can charge this subscription on its own at its next charge (the trial end or the renewal). A trial that started without a payment method reports false until the customer adds one for this subscription; a payment method saved for another subscription does not count. A subscription on a free plan reports false.
215
216
  - `createdAt` (`string`, required)
216
217
  - `updatedAt` (`string`, required)
218
+ - `planVersion` (`{ id: string; label: string } | null`, required) — The plan version whose terms the subscription has now. It keeps paying and receiving everything from this version until it is moved.
217
219
  - `offerApplications` (`Array<SubscriptionOfferApplication>`, required)
218
220
  - `pause` (`{ status: "scheduled"; mode: "period_end"; requestedAt: string; effectiveAt: string; resumeAt: string | null } | { status: "active"; mode: "immediate" | "period_end"; requestedAt: string; effectiveAt: string; resumeAt: string | null } | null`, required)
219
221
  - `checkoutProvider` (`PaymentProvider | null`, required) — Payment provider resolved for this checkout when the subscription response was created. This is an informational snapshot and may differ when the checkout is loaded if its country or the organization's routing changes.
@@ -247,6 +249,7 @@ Generated from Commet API version `2026-08-27`.
247
249
  - `description` (`string | null`, required)
248
250
  - `credits` (`number`, required)
249
251
  - `price` (`number`, required)
252
+ - `planIds` (`Array<string>`, required) — Plans that sell the credit pack.
250
253
  - `isActive` (`boolean`, required)
251
254
  - `createdAt` (`string`, required)
252
255
  - `updatedAt` (`string`, required)
@@ -260,6 +263,7 @@ Generated from Commet API version `2026-08-27`.
260
263
  - `description` (`string | null`, required)
261
264
  - `credits` (`number`, required)
262
265
  - `price` (`number`, required)
266
+ - `planIds` (`Array<string>`, required) — Plans that sell the credit pack.
263
267
  - `currency` (`string`, required)
264
268
  - `object` (`"credit_pack"`, required)
265
269
  - `livemode` (`boolean`, required)
@@ -421,6 +425,13 @@ Variants:
421
425
  - `object` (`"invoice"`, required)
422
426
  - `livemode` (`boolean`, required)
423
427
 
428
+ ### KeptOnVersion
429
+
430
+ - `subscriptionId` (`string`, required)
431
+ - `keptOnVersion` (`true`, required)
432
+ - `object` (`"kept_on_version"`, required)
433
+ - `livemode` (`boolean`, required)
434
+
424
435
  ### ManagedBy
425
436
 
426
437
  Variants:
@@ -534,6 +545,7 @@ Variants:
534
545
  - `features` (`Array<{ code: string; name: string; type: FeatureType; unitName: string | null; enabled: boolean; includedAmount: number | null; unlimited: boolean; overage: { enabled: boolean; model: "per_unit" | null; unitPrice: number | null } | null; regionalPrices: Array<{ currency: string; overageUnitPrice: number | null; autoSynced: boolean }> }>`, required)
535
546
  - `prices` (`Array<{ id: string; billingInterval: BillingInterval; price: number; isDefault: boolean; trialDays: number; trialRequiresPaymentMethod: boolean | null; includedBalance: number | null; includedCredits: number | null; offerId: string | null; inheritsFromPriceId: string | null; metadata: Record<string, unknown>; marketPrices: Array<{ marketGroupId: string; currency: string; price: number }>; regionalPrices: Array<{ currency: string; price: number; includedBalance: number | null; autoSynced: boolean }> }>`, required)
536
547
  - `exchangeRates` (`Array<{ currency: string; exchangeRate: number }>`, required)
548
+ - `countries` (`Array<{ country: string; currency: string; prices: Array<{ billingInterval: BillingInterval; price: number; manual: boolean }>; addons: Array<{ addonId: string; price: number; manual: boolean }>; creditPacks: Array<{ creditPackId: string; price: number; manual: boolean }> }>`, required) — Countries with their own currency or prices in the current version. Buyers from any other country pay the USD prices.
537
549
  - `object` (`"plan"`, required)
538
550
  - `livemode` (`boolean`, required)
539
551
 
@@ -545,6 +557,46 @@ Variants:
545
557
  - `{ outcome: "scheduled"; id: string; scheduled: true; scheduledFor: string; changeType: "subscription.plan_downgrade" | "subscription.interval_change" | "subscription.cancel"; customerId: string; newPlanId?: string; newPlanName?: string; newBillingInterval?: string; seatLimitWarning?: { featureCode: string; featureName: string; currentSeats: number; included: number; newPlanName: string; effectiveDate: string }; object: "plan_change"; livemode: boolean }`
546
558
  - `{ outcome: "completed"; id: string; scheduled: false; customerId: string; previousPlan: { id: string; name: string }; currentPlan: { id: string; name: string; price: number }; billingInterval: string; billing: { credit: number; creditsApplied: number; charge: number; taxAmount: number; netAmount: number; totalCharged: number; remainingCreditBalance: number }; invoiceId?: string; offerApplication?: { id: string; offerId: string; name: string; currency: string; subtotal: number; discountAmount: number; total: number; phases: Array<{ type: "free_trial"; durationDays: number; startsAt: string | null; endsAt: string | null } | { type: "percentage"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; startsAt: string | null; endsAt: string | null; percentage: number } | { type: "amount_off"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; startsAt: string | null; endsAt: string | null; amount: number } | { type: "fixed_price"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; startsAt: string | null; endsAt: string | null; price: number }>; appliesTo: { type: "plan_price"; id: string } | { type: "addon"; id: string } | { type: "credit_pack"; id: string } }; object: "plan_change"; livemode: boolean }`
547
559
 
560
+ ### PlanDraft
561
+
562
+ - `id` (`string`, required) — Public plan draft ID.
563
+ - `fromVersionId` (`string`, required) — The version the draft started from.
564
+ - `changes` (`Array<{ key: string; section: string; country: string | null; label: string; before: string | null; after: string | null }>`, required) — What the draft changes against the version it started from.
565
+ - `createdAt` (`string`, required)
566
+ - `updatedAt` (`string`, required)
567
+ - `object` (`"plan_draft"`, required)
568
+ - `livemode` (`boolean`, required)
569
+
570
+ ### PlanDraftPublication
571
+
572
+ - `preview` (`boolean`, required)
573
+ - `version` (`{ id: string; label: string; number: number | null; experiment: { code: string; version: number } | null; isCurrent: boolean; parentVersionId: string | null; subscriptionCount: number; maxPlanCredits: number | null; maxPlanBalance: number | null; prices: Array<{ id: string; billingInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time"; price: number; includedCredits: number | null; includedBalance: number | null; regionalPrices: Array<{ currency: string; price: number; includedBalance: number | null }> }>; createdAt: string } | null`, required) — The published version. Null for a preview.
574
+ - `moveId` (`string | null`, required) — The move of subscribers, if any.
575
+ - `subscribers` (`{ moving: number; keptOnVersion: number; needsAChange: number; leftOut: Array<{ subscriptionId: string; code: string; message: string }> } | null`, required)
576
+ - `object` (`"plan_draft_publication"`, required)
577
+ - `livemode` (`boolean`, required)
578
+
579
+ ### PlanExperiment
580
+
581
+ - `id` (`string`, required) — Public plan experiment ID.
582
+ - `code` (`string`, required) — The code to sell it with as planCode, such as pro:price-test. It always sells the experiment's latest version while running, and the plan's current version once closed.
583
+ - `status` (`"running" | "won" | "archived"`, required) — running sells its latest version; won became the plan's current version; archived stopped selling.
584
+ - `startedFromVersionId` (`string`, required) — The plan's version that was current when it started.
585
+ - `latestVersionId` (`string`, required) — Its latest version.
586
+ - `sellsVersionId` (`string`, required) — The version its code sells to new buyers today.
587
+ - `subscriptionCount` (`number`, required) — Active, trialing, past due and paused subscriptions on its versions.
588
+ - `createdAt` (`string`, required)
589
+ - `closedAt` (`string | null`, required)
590
+ - `object` (`"plan_experiment"`, required)
591
+ - `livemode` (`boolean`, required)
592
+
593
+ ### PlanExperimentArchive
594
+
595
+ - `experiment` (`{ id: string; code: string; status: "running" | "won" | "archived"; startedFromVersionId: string; latestVersionId: string; sellsVersionId: string; subscriptionCount: number; createdAt: string; closedAt: string | null }`, required)
596
+ - `moveId` (`string | null`, required) — The move of its subscribers, or null when they stay.
597
+ - `object` (`"plan_experiment_archive"`, required)
598
+ - `livemode` (`boolean`, required)
599
+
548
600
  ### PlanFeature
549
601
 
550
602
  - `planId` (`string`, required)
@@ -604,6 +656,22 @@ Variants:
604
656
  - `object` (`"plan_group"`, required)
605
657
  - `livemode` (`boolean`, required)
606
658
 
659
+ ### PlanMove
660
+
661
+ - `id` (`string | null`, required) — Public move ID. Null for a preview, which records nothing.
662
+ - `toVersionId` (`string`, required)
663
+ - `fromVersionIds` (`Array<string>`, required) — The versions its subscribers are moving from.
664
+ - `effective` (`"now" | "period_end"`, required)
665
+ - `preview` (`boolean`, required)
666
+ - `status` (`"checking" | "blocked" | "checked" | "moving" | "completed" | "canceled"`, required) — checked is a preview where everyone fits; moving while subscribers wait for their move; completed once every move ran; canceled after it was canceled.
667
+ - `counts` (`{ moving: number; moved: number; needsAChange: number; leftOut: number; canceled: number; keptOnVersion: number }`, required)
668
+ - `subscriptions` (`Array<{ subscriptionId: string; status: "moving" | "moved" | "needs_a_change" | "left_out" | "canceled" | "kept_on_version"; code: string | null; message: string | null }>`, required)
669
+ - `createdAt` (`string | null`, required)
670
+ - `completedAt` (`string | null`, required)
671
+ - `canceledAt` (`string | null`, required)
672
+ - `object` (`"plan_move"`, required)
673
+ - `livemode` (`boolean`, required)
674
+
607
675
  ### PlanPrice
608
676
 
609
677
  - `id` (`string`, required) — Public plan price ID.
@@ -641,6 +709,30 @@ Variants:
641
709
  - `object` (`"plan_regional_pricing"`, required)
642
710
  - `livemode` (`boolean`, required)
643
711
 
712
+ ### PlanVersion
713
+
714
+ - `id` (`string`, required) — Public plan version ID.
715
+ - `label` (`string`, required) — The plan's versions are numbered 1, 2, 3; an experiment's own versions read with its code, such as price-test 2.
716
+ - `number` (`number | null`, required) — The plan's version number. Null for a version that only belongs to an experiment; an experiment version made current takes the next number.
717
+ - `experiment` (`{ code: string; version: number } | null`, required) — The experiment this version belongs to, if any.
718
+ - `isCurrent` (`boolean`, required) — Whether new buyers get this version.
719
+ - `parentVersionId` (`string | null`, required) — The version this one was created from.
720
+ - `subscriptionCount` (`number`, required) — Active, trialing, past due and paused subscriptions on it.
721
+ - `maxPlanCredits` (`number | null`, required)
722
+ - `maxPlanBalance` (`number | null`, required)
723
+ - `prices` (`Array<{ id: string; billingInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time"; price: number; includedCredits: number | null; includedBalance: number | null; regionalPrices: Array<{ currency: string; price: number; includedBalance: number | null }> }>`, required)
724
+ - `createdAt` (`string`, required)
725
+ - `object` (`"plan_version"`, required)
726
+ - `livemode` (`boolean`, required)
727
+
728
+ ### PlanVersionComparison
729
+
730
+ - `versionId` (`string`, required) — The version the changes start from.
731
+ - `againstVersionId` (`string`, required) — The version they end at.
732
+ - `changes` (`Array<{ key: string; section: string; country: string | null; label: string; before: string | null; after: string | null }>`, required) — Every term that differs, the plan's first and then each country.
733
+ - `object` (`"plan_version_comparison"`, required)
734
+ - `livemode` (`boolean`, required)
735
+
644
736
  ### PortalAccess
645
737
 
646
738
  - `portalUrl` (`string`, required)
@@ -663,6 +755,7 @@ Variants:
663
755
  - `daysRemaining` (`number`, required)
664
756
  - `totalDays` (`number`, required)
665
757
  - `isUpgrade` (`boolean`, required)
758
+ - `deactivatedAddons` (`Array<{ addonId: string; name: string }>`, required) — Active add-ons that the version the change moves the subscription to does not sell. The change deactivates them when it applies.
666
759
  - `offerApplication` (`{ id: string; offerId: string; name: string; currency: string; subtotal: number; discountAmount: number; total: number; phases: Array<{ type: "free_trial"; durationDays: number; startsAt: string | null; endsAt: string | null } | { type: "percentage"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; startsAt: string | null; endsAt: string | null; percentage: number } | { type: "amount_off"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; startsAt: string | null; endsAt: string | null; amount: number } | { type: "fixed_price"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; startsAt: string | null; endsAt: string | null; price: number }>; appliesTo: { type: "plan_price"; id: string } | { type: "addon"; id: string } | { type: "credit_pack"; id: string } }`, optional)
667
760
  - `object` (`"plan_change_preview"`, required)
668
761
  - `livemode` (`boolean`, required)
@@ -764,6 +857,17 @@ Variants:
764
857
  - `object` (`"invoice_delivery"`, required)
765
858
  - `livemode` (`boolean`, required)
766
859
 
860
+ ### SubscriberNeedingAChange
861
+
862
+ - `subscriptionId` (`string`, required)
863
+ - `moveId` (`string`, required) — The move it could not complete.
864
+ - `fromVersionId` (`string`, required) — The version it stays on.
865
+ - `toVersionId` (`string`, required) — The version it could not move to.
866
+ - `code` (`string`, required) — Why it could not move.
867
+ - `message` (`string`, required)
868
+ - `object` (`"subscriber_needing_a_change"`, required)
869
+ - `livemode` (`boolean`, required)
870
+
767
871
  ### Subscription
768
872
 
769
873
  - `id` (`string`, required)
@@ -786,8 +890,10 @@ Variants:
786
890
  - `hasPaymentMethod` (`boolean`, required) — Whether Commet can charge this subscription on its own at its next charge (the trial end or the renewal). A trial that started without a payment method reports false until the customer adds one for this subscription; a payment method saved for another subscription does not count. A subscription on a free plan reports false.
787
891
  - `createdAt` (`string`, required)
788
892
  - `updatedAt` (`string`, required)
893
+ - `planVersion` (`{ id: string; label: string } | null`, required) — The plan version whose terms the subscription has now. It keeps paying and receiving everything from this version until it is moved.
789
894
  - `offerApplications` (`Array<SubscriptionOfferApplication>`, required)
790
895
  - `pause` (`{ status: "scheduled"; mode: "period_end"; requestedAt: string; effectiveAt: string; resumeAt: string | null } | { status: "active"; mode: "immediate" | "period_end"; requestedAt: string; effectiveAt: string; resumeAt: string | null } | null`, required)
896
+ - `scheduledVersionChange` (`{ planVersionId: string; label: string; effectiveAt: string } | null`, required) — A move to another version of the plan pending for the next renewal.
791
897
  - `planGrant` (`{ id: string; plan: { id: string; name: string }; expiresAt: string | null }`, optional)
792
898
  - `consumptionModel` (`ConsumptionModel | null`, required)
793
899
  - `features` (`Array<{ code: string; name: string; type: "boolean"; enabled: boolean; baseAccess?: { enabled: boolean } | null } | { code: string; name: string; type: "usage"; usage?: { current: number; included: number; overageQuantity: number; overageUnitPrice?: number; unlimited?: boolean }; baseAccess?: { included: number; unlimited: boolean } | null } | { code: string; name: string; type: "seats"; usage: { current: number; included: number; overageQuantity: number; overageUnitPrice?: number; unlimited?: boolean }; baseAccess?: { included: number; unlimited: boolean } | null } | { code: string; name: string; type: "quota"; usage?: { current: number; included: number; overageQuantity: number; overageUnitPrice?: number; unlimited?: boolean }; baseAccess?: { included: number; unlimited: boolean } | null }>`, required)
@@ -875,6 +981,7 @@ Variants:
875
981
  - `hasPaymentMethod` (`boolean`, required) — Whether Commet can charge this subscription on its own at its next charge (the trial end or the renewal). A trial that started without a payment method reports false until the customer adds one for this subscription; a payment method saved for another subscription does not count. A subscription on a free plan reports false.
876
982
  - `createdAt` (`string`, required)
877
983
  - `updatedAt` (`string`, required)
984
+ - `planVersion` (`{ id: string; label: string } | null`, required) — The plan version whose terms the subscription has now. It keeps paying and receiving everything from this version until it is moved.
878
985
  - `offerApplications` (`Array<SubscriptionOfferApplication>`, required)
879
986
  - `pause` (`{ status: "scheduled"; mode: "period_end"; requestedAt: string; effectiveAt: string; resumeAt: string | null } | { status: "active"; mode: "immediate" | "period_end"; requestedAt: string; effectiveAt: string; resumeAt: string | null } | null`, required)
880
987
  - `priceId` (`string | null`, required)
@@ -11,6 +11,8 @@ Webhooks let your application receive real-time HTTP notifications when events h
11
11
  2. You select which events you want to receive
12
12
  3. When an event occurs, Commet sends a `POST` request to your URL with the event data
13
13
 
14
+ An endpoint receives only the events it lists. New event types are not added to existing endpoints: when Commet adds one, such as `subscription.version_changed`, edit the endpoint to receive it.
15
+
14
16
  ## Local development
15
17
 
16
18
  Use the Commet CLI to forward webhook events to your local server in real time — no tunneling tools needed:
@@ -472,7 +474,7 @@ You can monitor delivery status, inspect payloads, and retry individual deliveri
472
474
 
473
475
  ## Subscription status lifecycle
474
476
 
475
- Every `subscription.*` webhook includes a `status` field. These are the valid values and which ones grant access to your product:
477
+ Most `subscription.*` webhooks include a `status` field. These are the valid values and which ones grant access to your product:
476
478
 
477
479
  | Status | Grants access? | Meaning |
478
480
  | ----------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
package/docs/webhooks.md CHANGED
@@ -221,6 +221,30 @@ Fired when a scheduled plan change will no longer take effect: it was revoked th
221
221
  - `billingInterval` (`string | null`, required) — The current billing interval.
222
222
  - `revokedBillingInterval` (`string | null`, required) — The previously scheduled billing interval, if the revoked change included one.
223
223
 
224
+ ## subscription.version_changed
225
+
226
+ Fired when a subscription moves to another version of its plan: a move applied now or a scheduled move that took effect at renewal. Making an experiment current moves nobody, so it sends none. The plan stays the same; the version's prices and features apply from now on.
227
+
228
+ ### Data
229
+
230
+ - `subscriptionId` (`string`, required) — The subscription ID.
231
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
232
+ - `fromVersionId` (`string`, required) — The version the subscription left.
233
+ - `toVersionId` (`string`, required) — The version the subscription is on now.
234
+ - `currency` (`string`, required) — The currency the subscription pays in.
235
+ - `billingInterval` (`string`, required) — The billing interval the subscription pays.
236
+
237
+ ## subscription.version_change_canceled
238
+
239
+ Fired when a scheduled move to another plan version will no longer take effect because the subscription no longer fit the version at its renewal, or because the merchant revoked the scheduled version change or canceled the plan move. A new move that replaces it, a move made now, a plan change or an immediate cancellation sends none. The subscription stays on its version; reason says why.
240
+
241
+ ### Data
242
+
243
+ - `subscriptionId` (`string`, required) — The subscription ID.
244
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
245
+ - `toVersionId` (`string`, required) — The version the subscription was going to move to.
246
+ - `reason` (`string`, required) — Why the move was canceled: canceled_by_merchant, version_change_failed when the move could not be applied at renewal, or the code of what the subscription no longer fits (addon_unavailable, seat_limit_exceeded, price_not_found, missing_regional_price).
247
+
224
248
  ## subscription.past_due
225
249
 
226
250
  Fired when a recurring payment fails on a previously paid subscription and its status becomes past_due. past_due is a grace window, not a cutoff: usage and seats keep working while new purchases are blocked, and dunning retries the charge — use this to notify the customer and recover the payment.
@@ -454,7 +454,7 @@
454
454
  "description": "Fired when a canceled subscription is reactivated and its reactivation charge succeeds.",
455
455
  "playground": "none"
456
456
  },
457
- "content": "## When this fires\n\nA canceled subscription was reactivated through `reactivate` and the reactivation charge succeeded. Commet generates a fresh invoice, charges the saved payment method, and sets the status back to `active` with a billing period anchored to the reactivation date.\n\nThe subscription returns to `active` at the same time, so `customer.state_changed` also fires. Restore access on either event.\n\nThis is distinct from two similar events. `subscription.activated` fires on a subscription's first activation. `payment.recovered` fires when a `past_due` subscription is recovered — that path keeps the original invoice and billing anchor, while reactivation issues a new invoice and resets the anchor to now.\n\nReactivation requires the plan to still be available in the subscription's currency. If the reactivation charge declines, no event fires and the API returns a `recoveryUrl` the customer can use to add a new card and pay."
457
+ "content": "## When this fires\n\nA canceled subscription was reactivated through `reactivate` and the reactivation charge succeeded. Commet generates a fresh invoice, charges the saved payment method, and sets the status back to `active` with a billing period anchored to the reactivation date.\n\nThe subscription returns to `active` at the same time, so `customer.state_changed` also fires. Restore access on either event.\n\nThis is distinct from two similar events. `subscription.activated` fires on a subscription's first activation. `payment.recovered` fires when a `past_due` subscription is recovered — that path keeps the original invoice and billing anchor, while reactivation issues a new invoice and resets the anchor to now.\n\nThe subscription returns on the latest [version](/plan-versions#reactivate-a-canceled-subscription) of what was bought, which must sell the subscription's currency. If the reactivation charge declines, no event fires and the API returns a `recoveryUrl` the customer can use to add a new card and pay."
458
458
  }
459
459
  }
460
460
  },
@@ -2115,6 +2115,236 @@
2115
2115
  }
2116
2116
  }
2117
2117
  },
2118
+ "subscription.version_changed": {
2119
+ "post": {
2120
+ "summary": "subscription.version_changed",
2121
+ "description": "Fired when a subscription moves to another version of its plan: a move applied now or a scheduled move that took effect at renewal. Making an experiment current moves nobody, so it sends none. The plan stays the same; the version's prices and features apply from now on.",
2122
+ "tags": [
2123
+ "Webhooks"
2124
+ ],
2125
+ "requestBody": {
2126
+ "required": true,
2127
+ "content": {
2128
+ "application/json": {
2129
+ "schema": {
2130
+ "type": "object",
2131
+ "properties": {
2132
+ "id": {
2133
+ "type": "string"
2134
+ },
2135
+ "event": {
2136
+ "type": "string",
2137
+ "const": "subscription.version_changed"
2138
+ },
2139
+ "timestamp": {
2140
+ "type": "string"
2141
+ },
2142
+ "organizationId": {
2143
+ "type": "string"
2144
+ },
2145
+ "mode": {
2146
+ "type": "string",
2147
+ "enum": [
2148
+ "live",
2149
+ "sandbox"
2150
+ ]
2151
+ },
2152
+ "apiVersion": {
2153
+ "type": "string"
2154
+ },
2155
+ "data": {
2156
+ "type": "object",
2157
+ "properties": {
2158
+ "subscriptionId": {
2159
+ "type": "string",
2160
+ "description": "The subscription ID."
2161
+ },
2162
+ "customerId": {
2163
+ "type": "string",
2164
+ "description": "The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId."
2165
+ },
2166
+ "fromVersionId": {
2167
+ "type": "string",
2168
+ "description": "The version the subscription left."
2169
+ },
2170
+ "toVersionId": {
2171
+ "type": "string",
2172
+ "description": "The version the subscription is on now."
2173
+ },
2174
+ "currency": {
2175
+ "type": "string",
2176
+ "description": "The currency the subscription pays in."
2177
+ },
2178
+ "billingInterval": {
2179
+ "type": "string",
2180
+ "description": "The billing interval the subscription pays."
2181
+ }
2182
+ },
2183
+ "required": [
2184
+ "subscriptionId",
2185
+ "customerId",
2186
+ "fromVersionId",
2187
+ "toVersionId",
2188
+ "currency",
2189
+ "billingInterval"
2190
+ ],
2191
+ "additionalProperties": false
2192
+ }
2193
+ },
2194
+ "required": [
2195
+ "id",
2196
+ "event",
2197
+ "timestamp",
2198
+ "organizationId",
2199
+ "mode",
2200
+ "apiVersion",
2201
+ "data"
2202
+ ],
2203
+ "additionalProperties": false
2204
+ },
2205
+ "example": {
2206
+ "event": "subscription.version_changed",
2207
+ "timestamp": "2026-06-23T14:30:00.000Z",
2208
+ "organizationId": "8f14e45f-ceea-4e7a-9c3d-1c2b3a4d5e6f",
2209
+ "mode": "live",
2210
+ "apiVersion": "2026-08-27",
2211
+ "data": {
2212
+ "subscriptionId": "sub_1a2b3c4d",
2213
+ "customerId": "user_123",
2214
+ "fromVersionId": "plnrel_v3",
2215
+ "toVersionId": "plnrel_v4",
2216
+ "currency": "usd",
2217
+ "billingInterval": "monthly"
2218
+ }
2219
+ }
2220
+ }
2221
+ }
2222
+ },
2223
+ "responses": {
2224
+ "200": {
2225
+ "description": "Return any 2xx status code to acknowledge receipt of the event."
2226
+ }
2227
+ },
2228
+ "x-mint": {
2229
+ "href": "/webhooks/subscription-version-changed",
2230
+ "metadata": {
2231
+ "title": "subscription.version_changed",
2232
+ "description": "Fired when a subscription moves to another version of its plan, now or at its renewal.",
2233
+ "playground": "none"
2234
+ },
2235
+ "content": "## When this fires\n\nA subscription moves to another version of the same plan:\n\n- right away, after [Change subscription version](/api-reference/subscriptions/change-subscription-version) or a plan move made now;\n- at its renewal, when a move scheduled for the end of the period takes effect.\n\nFrom this event the subscription has the destination version's features, limits and included credits or balance. A move made now charges the new version's price from the next renewal; a move never creates a proration charge or refund.\n\n`currency` is the subscription's currency, which a move never changes. `billingInterval` is the interval it pays after the move.\n\n| Moment | Event | What to do |\n| --- | --- | --- |\n| Move scheduled for renewal | None. The subscription shows it in `scheduledVersionChange`. | Show the upcoming change if your UI lists plan terms. |\n| Move takes effect | `subscription.version_changed` | Refresh the features and limits you keep for the subscription. |\n| Scheduled move no longer happens | `subscription.version_change_canceled` | Remove the upcoming change. |\n\nA trialing subscription with a pending move moves when its trial ends, so its first charge is already on the destination version. A subscription that ends or changes to another plan instead of renewing on its plan never moves and sends neither event.\n\nOnly endpoints that list this event receive it. New event types are not added to existing endpoints: add it to the endpoint's events in **Settings → Webhooks** or with [Update webhook endpoint](/api-reference/webhooks/update-webhook-endpoint)."
2236
+ }
2237
+ }
2238
+ },
2239
+ "subscription.version_change_canceled": {
2240
+ "post": {
2241
+ "summary": "subscription.version_change_canceled",
2242
+ "description": "Fired when a scheduled move to another plan version will no longer take effect because the subscription no longer fit the version at its renewal, or because the merchant revoked the scheduled version change or canceled the plan move. A new move that replaces it, a move made now, a plan change or an immediate cancellation sends none. The subscription stays on its version; reason says why.",
2243
+ "tags": [
2244
+ "Webhooks"
2245
+ ],
2246
+ "requestBody": {
2247
+ "required": true,
2248
+ "content": {
2249
+ "application/json": {
2250
+ "schema": {
2251
+ "type": "object",
2252
+ "properties": {
2253
+ "id": {
2254
+ "type": "string"
2255
+ },
2256
+ "event": {
2257
+ "type": "string",
2258
+ "const": "subscription.version_change_canceled"
2259
+ },
2260
+ "timestamp": {
2261
+ "type": "string"
2262
+ },
2263
+ "organizationId": {
2264
+ "type": "string"
2265
+ },
2266
+ "mode": {
2267
+ "type": "string",
2268
+ "enum": [
2269
+ "live",
2270
+ "sandbox"
2271
+ ]
2272
+ },
2273
+ "apiVersion": {
2274
+ "type": "string"
2275
+ },
2276
+ "data": {
2277
+ "type": "object",
2278
+ "properties": {
2279
+ "subscriptionId": {
2280
+ "type": "string",
2281
+ "description": "The subscription ID."
2282
+ },
2283
+ "customerId": {
2284
+ "type": "string",
2285
+ "description": "The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId."
2286
+ },
2287
+ "toVersionId": {
2288
+ "type": "string",
2289
+ "description": "The version the subscription was going to move to."
2290
+ },
2291
+ "reason": {
2292
+ "type": "string",
2293
+ "description": "Why the move was canceled: canceled_by_merchant, version_change_failed when the move could not be applied at renewal, or the code of what the subscription no longer fits (addon_unavailable, seat_limit_exceeded, price_not_found, missing_regional_price)."
2294
+ }
2295
+ },
2296
+ "required": [
2297
+ "subscriptionId",
2298
+ "customerId",
2299
+ "toVersionId",
2300
+ "reason"
2301
+ ],
2302
+ "additionalProperties": false
2303
+ }
2304
+ },
2305
+ "required": [
2306
+ "id",
2307
+ "event",
2308
+ "timestamp",
2309
+ "organizationId",
2310
+ "mode",
2311
+ "apiVersion",
2312
+ "data"
2313
+ ],
2314
+ "additionalProperties": false
2315
+ },
2316
+ "example": {
2317
+ "event": "subscription.version_change_canceled",
2318
+ "timestamp": "2026-06-23T14:30:00.000Z",
2319
+ "organizationId": "8f14e45f-ceea-4e7a-9c3d-1c2b3a4d5e6f",
2320
+ "mode": "live",
2321
+ "apiVersion": "2026-08-27",
2322
+ "data": {
2323
+ "subscriptionId": "sub_1a2b3c4d",
2324
+ "customerId": "user_123",
2325
+ "toVersionId": "plnrel_v4",
2326
+ "reason": "addon_unavailable"
2327
+ }
2328
+ }
2329
+ }
2330
+ }
2331
+ },
2332
+ "responses": {
2333
+ "200": {
2334
+ "description": "Return any 2xx status code to acknowledge receipt of the event."
2335
+ }
2336
+ },
2337
+ "x-mint": {
2338
+ "href": "/webhooks/subscription-version-change-canceled",
2339
+ "metadata": {
2340
+ "title": "subscription.version_change_canceled",
2341
+ "description": "Fired when a move to another plan version scheduled for renewal will no longer happen.",
2342
+ "playground": "none"
2343
+ },
2344
+ "content": "## When this fires\n\nA move to another version that was waiting for the subscription's renewal will not happen, and the subscription stays on its version. `toVersionId` is the version it was going to move to, and `reason` says why:\n\n| `reason` | What happened |\n| --- | --- |\n| `canceled_by_merchant` | You canceled the move with [Revoke scheduled version change](/api-reference/subscriptions/revoke-scheduled-version-change), or canceled the plan move for every subscriber or for this one. |\n| `addon_unavailable` | At renewal the subscription has an active add-on the destination version does not sell. |\n| `seat_limit_exceeded` | At renewal the subscription has more seats than the destination version allows. |\n| `price_not_found` | The destination version does not sell the price the subscription pays. |\n| `missing_regional_price` | The destination version does not sell the subscription's currency. A move never changes the currency. |\n| `version_change_failed` | The move could not be applied at renewal. |\n\nA move made now has nothing pending, so it never fires this event. Neither does a new move that replaces the pending one, a change to another plan, or a subscription that ends instead of renewing: the pending move is dropped and `scheduledVersionChange` becomes `null`. To move the subscription later, resolve what `reason` names and request the move again.\n\nOnly endpoints that list this event receive it. New event types are not added to existing endpoints: add it to the endpoint's events in **Settings → Webhooks** or with [Update webhook endpoint](/api-reference/webhooks/update-webhook-endpoint)."
2345
+ }
2346
+ }
2347
+ },
2118
2348
  "subscription.past_due": {
2119
2349
  "post": {
2120
2350
  "summary": "subscription.past_due",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commet/node",
3
- "version": "9.9.0",
3
+ "version": "9.10.0",
4
4
  "description": "Commet SDK for Node.js - Billing and usage tracking",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",