@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
@@ -25,7 +25,7 @@ Deactivate an add-on from a subscription.
25
25
 
26
26
  `POST /subscriptions/{id}/addons` · operation `activate-addon`
27
27
 
28
- Activate an add-on on a subscription. Charges a prorated amount for the current billing period.
28
+ Activate an add-on on a subscription. Charges a prorated amount for the current billing period. An add-on that the subscription's plan version does not sell is rejected with addon_unavailable.
29
29
 
30
30
  ### Parameters
31
31
 
@@ -176,13 +176,35 @@ Upgrade or change billing interval immediately, optionally applying an Offer by
176
176
 
177
177
  `PlanChange`
178
178
 
179
+ ## changeVersion
180
+
181
+ `commet.subscriptions.changeVersion(params, options?)`
182
+
183
+ `POST /subscriptions/{id}/change-version` · operation `change-subscription-version`
184
+
185
+ Move a subscription to a newer published version of its plan, now or at the end of the period, without proration; an older version is rejected with version_not_newer, and a subscription on a running experiment moves only to a later version of that experiment. The subscription keeps its currency and its price: a destination that does not sell its currency is rejected with missing_regional_price, and one that does not sell the price it pays with price_not_found. A free version moves only to a free version and a paid one only to a paid one (validation_error). A subscription whose usage does not fit the destination, or with an active add-on the destination does not sell, is not moved either, and the error says why. Each change is recorded as a move of this one subscription in the plan's moves. Repeating the same request changes nothing; a new one replaces the pending move.
186
+
187
+ ### Parameters
188
+
189
+ - `id` (`string`, required)
190
+ - `planVersionId` (`string`, required) — A published version of the subscription's plan.
191
+ - `effective` (`"now" | "period_end"`, required) — now changes features, limits and the included credits or balance at once (the included difference is added to or subtracted from the plan credits or plan balance: an increase first pays any plan-part debt, a decrease never creates new debt, and purchased credits and purchased balance are untouched) and charges the new price from the next renewal. period_end changes everything at the next renewal. There is never a proration charge or refund.
192
+
193
+ ### Request options
194
+
195
+ - `idempotencyKey` (`string`, optional) — Unique key used to safely retry this write for 24 hours without applying it twice.
196
+
197
+ ### Returns
198
+
199
+ `Subscription`
200
+
179
201
  ## purchaseCredits
180
202
 
181
203
  `commet.subscriptions.purchaseCredits(params, options?)`
182
204
 
183
205
  `POST /subscriptions/{id}/credits` · operation `purchase-credits`
184
206
 
185
- Purchase a fixed credit pack or choose a whole credit quantity at the subscription plan price and minimum. Charges the saved payment method and adds purchased credits.
207
+ Purchase a fixed credit pack or choose a whole credit quantity at the subscription plan price and minimum. Charges the saved payment method and adds purchased credits. A credit pack that the subscription's plan version does not sell is rejected with credit_pack_unavailable.
186
208
 
187
209
  ### Parameters
188
210
 
@@ -466,6 +488,22 @@ Revoke the plan or interval change scheduled for the end of the period, so the s
466
488
 
467
489
  `Subscription`
468
490
 
491
+ ## revokeScheduledVersionChange
492
+
493
+ `commet.subscriptions.revokeScheduledVersionChange(params, options?)`
494
+
495
+ `DELETE /subscriptions/{id}/scheduled-version-change` · operation `revoke-scheduled-version-change`
496
+
497
+ Cancel the move to another plan version pending for the next renewal, so the subscription stays on its version, and send subscription.version_change_canceled with reason canceled_by_merchant. A move made now has nothing pending to revoke. With nothing pending it changes nothing. Returns the subscription.
498
+
499
+ ### Parameters
500
+
501
+ - `id` (`string`, required)
502
+
503
+ ### Returns
504
+
505
+ `Subscription`
506
+
469
507
  ## uncancel
470
508
 
471
509
  `commet.subscriptions.uncancel(params, options?)`
@@ -514,6 +552,7 @@ List all subscriptions. Filter by customer ID or status.
514
552
 
515
553
  - `customerId` (`string`, optional)
516
554
  - `status` (`SubscriptionStatus`, optional)
555
+ - `planVersionId` (`string`, optional)
517
556
 
518
557
  ### Returns
519
558
 
@@ -540,12 +579,13 @@ Create a subscription for a customer. Commet selects the default price when pric
540
579
  - `successUrl` (`string`, optional)
541
580
  - `prepaidPeriods` (`number`, optional) — Billing periods of the subscription's interval paid with the first payment, including the current one. Defaults to 1. The interval does not change: each paid period renews at zero and the subscription renews normally after the last one unless `cancelAtPeriodEnd` is true.
542
581
  - `cancelAtPeriodEnd` (`boolean`, optional) — Schedules the cancellation from creation so the subscription ends after its last paid period and never renews with any payment method.
582
+ - `planVersionId` (`string`, optional) — Public ID of a published version of the plan, current or not, including an experiment's versions. The subscription is created on that version and stays on it: checkout charges its price and activation grants its credits, add-ons and credit packs. When omitted, the subscription gets the current version, or the version an experiment code (planCode `<plan code>:<experiment code>`) sells.
543
583
  - `offerId` (`string`, optional)
544
584
  - `promoCode` (`string`, optional)
545
585
  - `customTrialDays` (`number`, optional) — Trial length in days, replacing the price's trial. A customer who already had this plan, in a trial or paying, gets no trial and goes through the regular checkout.
546
586
  - `skipTrial` (`boolean`, optional)
547
587
  - `planId` (`string`, optional)
548
- - `planCode` (`string`, optional)
588
+ - `planCode` (`string`, optional) — The plan code, or an experiment code as `<plan code>:<experiment code>` to sell the version the experiment sells.
549
589
  - `cardPromotionId` (`string`, optional) — Public card promotion ID. The offer is shown immediately and remains conditional on card eligibility until checkout confirmation.
550
590
 
551
591
  ### Valid parameter combinations
@@ -45,11 +45,17 @@ A new version ships whenever a breaking change needs one — sometimes several l
45
45
  Non-breaking changes ship continuously and never require a version bump:
46
46
 
47
47
  - New fields added to responses
48
- - New event types
48
+ - New event types. An endpoint receives only the events it lists, so a new type reaches an endpoint only after you add it
49
49
  - New API endpoints
50
50
  - New optional request parameters
51
51
  - New values in existing enums, such as a new billing interval. Your integration should accept values it does not recognize instead of failing
52
52
 
53
+ ### Plan edits publish plan versions
54
+
55
+ Editing a plan's prices, features or credit and balance rules through the API, MCP or CLI publishes a new version of the plan. New buyers get the new version; existing subscriptions keep the version they are on until you move them with [Change subscription version](/docs/api-reference/subscriptions/change-subscription-version) or [Move subscribers to a plan version](/docs/api-reference/plans/create-plan-move). Before plan versions, some of these edits also changed existing subscriptions, at once or at their renewal.
56
+
57
+ This is a change in product behavior, not in the shape of requests or responses. Unlike the breaking changes listed above, it did not ship behind a new API version: it applies to every API version, including pinned ones.
58
+
53
59
  ## Backward compatibility policy
54
60
 
55
61
  When a new version is released:
@@ -97,4 +103,4 @@ Webhook payloads include an `apiVersion` field in the envelope so you always kno
97
103
  }
98
104
  ```
99
105
 
100
- Each webhook endpoint can be pinned independently. When migrating, create a second endpoint pinned to the new version — both receive every event, each transformed to its own version. Once the new endpoint is working, delete the old one.
106
+ Each webhook endpoint can be pinned independently. When migrating, create a second endpoint pinned to the new version — both receive every event they list, each transformed to its own version. Once the new endpoint is working, delete the old one.
@@ -118,6 +118,8 @@ After `commet pull`, your SDK calls get autocomplete for plan codes and feature
118
118
 
119
119
  Push your local `commet.config.ts` to Commet. Creates or updates features and plans to match your config.
120
120
 
121
+ A plan whose prices, features or credit and balance rules change gets a new current version. New buyers get it; existing subscriptions stay on their version until you move them through the API or MCP, with [Change subscription version](/docs/api-reference/subscriptions/change-subscription-version) or [Move subscribers to a plan version](/docs/api-reference/plans/create-plan-move).
122
+
121
123
  ```bash
122
124
  commet push
123
125
  ```
@@ -328,6 +330,8 @@ commet subscriptions update-auto-top-up --id sub_xxx --enabled true --threshold
328
330
 
329
331
  Create plans, attach features and prices, and configure regional pricing.
330
332
 
333
+ Commands that change a plan's prices, features or credit and balance rules publish a new current version of the plan. New buyers get it; existing subscriptions stay on their version until you move them through the API or MCP, with [Change subscription version](/docs/api-reference/subscriptions/change-subscription-version) or [Move subscribers to a plan version](/docs/api-reference/plans/create-plan-move).
334
+
331
335
  **`commet plans create`**
332
336
 
333
337
  Create a plan.
@@ -9,8 +9,8 @@ Self-service page where customers manage their subscription, view usage, change
9
9
 
10
10
  - View current subscription and billing cycle
11
11
  - See usage across all features
12
- - Upgrade or downgrade plans (requires a [Plan Group](/docs/plan-groups)), and keep the current plan when a change is scheduled (**Keep current plan**)
13
- - Purchase [Credit Packs](/docs/credit-packs), a chosen quantity of credits, balance top-ups, and [Add-ons](/docs/add-ons)
12
+ - Upgrade or downgrade to group plans that sell their currency (requires a [Plan Group](/docs/plan-groups)), and keep the current plan when a change is scheduled (**Keep current plan**)
13
+ - Purchase the [Credit Packs](/docs/credit-packs) and [Add-ons](/docs/add-ons) their [plan version](/docs/plan-versions) sells, a chosen quantity of credits, and balance top-ups
14
14
  - Turn on and edit [auto top-up](/docs/credit-packs#top-up-credits-automatically) for credits
15
15
  - Add a card during a [trial without a payment method](/docs/trial-periods#start-a-trial-without-a-payment-method) (**Add card**)
16
16
  - Manage saved payment methods and billing details
@@ -36,7 +36,7 @@ Add-ons declare their own consumption model. Boolean add-ons are compatible with
36
36
 
37
37
  Go to **Add-ons** and click **Create Add-on**. Configure the name, base price, feature, and consumption model. For metered add-ons, set included units and overage rate. For credits, set the credit cost per unit.
38
38
 
39
- The feature dropdown only shows features not already assigned to another add-on. Once created, the add-on is available to any customer whose plan is compatible.
39
+ The feature dropdown only shows features not already assigned to another add-on. Once created, the add-on is sold on the current version of every compatible plan, or of the plans you choose in `planIds`.
40
40
 
41
41
  ## Availability by subscription status
42
42
 
@@ -48,6 +48,17 @@ Add-ons can be activated on any subscription with a payment method:
48
48
  | **Trialing** | Yes — with a saved payment method |
49
49
  | **Free plan** | Yes — first purchase prompts for a payment method |
50
50
 
51
+ ## Add-ons and plan versions
52
+
53
+ Each [plan version](/docs/plan-versions) lists the add-ons it sells, with their prices. Creating or editing an add-on publishes a new version of each plan that sells it:
54
+
55
+ - New customers get the add-on and its price on the plan's current version.
56
+ - Existing subscribers keep the add-ons and prices of their version. Activating an add-on their version doesn't sell returns `409 addon_unavailable` until you [move them](/docs/plan-versions#move-subscribers) to a version that sells it.
57
+ - A subscription with an active add-on can't move to a version that doesn't sell it until the add-on is removed. A plan move can remove it at renewal with `removeAddonIds`.
58
+ - A canceled subscription that is [reactivated](/docs/plan-versions#reactivate-a-canceled-subscription) returns on the latest version of what was bought, and the add-ons that version doesn't sell are deactivated.
59
+
60
+ Send `planIds` when you create or update an add-on to choose the plans that sell it. Left out on create, or empty, every plan sells it, including plans created later. Removing a plan returns `409 addon_has_activations` while a subscription of that plan has the add-on active.
61
+
51
62
  ## Manage add-ons
52
63
 
53
64
  Add-ons are managed through the dashboard, the customer portal, or the API.
@@ -228,13 +239,13 @@ Subtotal $213.00
228
239
 
229
240
  ### Multi-currency
230
241
 
231
- Add-on prices are defined in USD. For non-USD subscriptions, the price is converted using the plan's exchange rate — the same mechanism used for plan base prices.
242
+ Add-on prices are defined in USD. For non-USD subscriptions, the price is converted using the plan's exchange rate — the same mechanism used for plan base prices. A plan version can also set an add-on's price by hand for a country in the [Regional prices](/docs/regional-prices#set-prices-by-country) tab.
232
243
 
233
244
  ## Customer portal
234
245
 
235
246
  Customers can self-service add-ons from the portal:
236
247
 
237
- - **Available add-ons** — see compatible add-ons with pricing
248
+ - **Available add-ons** — see the compatible add-ons their plan version sells, with pricing
238
249
  - **Activate** — confirmation dialog with prorated charge preview
239
250
  - **Active add-ons** — manage active add-ons
240
251
  - **Deactivate** — instant, no refund
@@ -55,7 +55,7 @@ Month 1: 800 unused → 800 + 1,000 = 1,800
55
55
  Month 2: 1,800 unused → 2,800, capped at 2,500. 300 expire.
56
56
  ```
57
57
 
58
- `{ type: 'expire' }` restores the default. Existing subscriptions apply a change from their next reset. A plan change applies the new plan's setting.
58
+ `{ type: 'expire' }` restores the default. Changing it publishes a new [plan version](/docs/plan-versions); each subscription keeps its version's setting until you move it. A plan change applies the new plan's setting.
59
59
 
60
60
  ### Limit plan credit spending
61
61
 
@@ -68,9 +68,9 @@ await commet.plans.update({
68
68
 
69
69
  `planCreditLimit` caps the plan credits a subscription spends per window: `day` is 24 hours and `week` is 7 days, starting at the time of day of the subscription's billing anchor. Purchased credits are never limited.
70
70
 
71
- An event past the limit uses purchased credits. Without enough, [Track Usage](/docs/track-usage#limit-plan-credit-spending) rejects it with `402 plan_credit_limit_reached`. Raising or removing the limit applies at once; lowering it, adding it, or changing its interval applies from the next period.
71
+ An event past the limit uses purchased credits. Without enough, [Track Usage](/docs/track-usage#limit-plan-credit-spending) rejects it with `402 plan_credit_limit_reached`. Changing the limit publishes a new plan version; each subscription keeps its version's limit until you move it.
72
72
 
73
- In the dashboard, open **Plans**, select a credits plan, and edit **Credit rollover**, **Credit limit**, or **Credit purchases**.
73
+ In the dashboard, open **Plans**, select a credits plan, and edit **Carry-over**, **Credit limit**, or **Buying credits** under **Credit rules**. The changes go into a draft until you publish it.
74
74
 
75
75
  ## Balance
76
76
 
@@ -24,6 +24,10 @@ A free plan has a price of $0 and no billing cycle. Customers are activated imme
24
24
 
25
25
  Go to **Plans** and click **Create Plan**. Fill in each component from the table above, then save. For detailed feature configuration, see [Configure Features](/docs/configure-features).
26
26
 
27
+ ## Edit a plan
28
+
29
+ Editing a plan's prices, trials, features, rules, add-ons, credit packs, or country prices publishes a new [plan version](/docs/plan-versions). New customers get it; existing subscribers keep their version until you move them. In the dashboard, edits go into a draft that you publish when ready. The name, description, and visibility are not versioned and change at once with **Edit details**.
30
+
27
31
  ## Retrieve plans via SDK
28
32
 
29
33
  ### TypeScript
@@ -107,7 +111,7 @@ curl "https://commet.co/api/v1/plans?includePrivate=true" \
107
111
  -H "x-api-key: $COMMET_API_KEY"
108
112
  ```
109
113
 
110
- Get a specific plan:
114
+ Get a specific plan. Plan reads return the terms of the current version; list a plan's versions with `GET /plans/{id}/versions`.
111
115
 
112
116
  ### TypeScript
113
117
 
@@ -19,7 +19,16 @@ Credit packs can be purchased on any subscription with a payment method — incl
19
19
 
20
20
  ## Create credit packs in the dashboard
21
21
 
22
- Go to **Credit Packs** and click **Create Credit Pack**. Pack names must be unique within your organization. Packs are available to all credits-based plans.
22
+ Go to **Credit Packs** and click **Create Credit Pack**. Pack names must be unique within your organization. A new pack is sold on the current version of every credits plan, or of the plans you choose in `planIds`.
23
+
24
+ ## Credit packs and plan versions
25
+
26
+ Each [plan version](/docs/plan-versions) lists the credit packs it sells, with their prices. Creating or editing a pack publishes a new version of each plan that sells it:
27
+
28
+ - New customers can buy the pack at its price on the plan's current version.
29
+ - Existing subscribers keep the packs and prices of their version. Buying a pack their version doesn't sell returns `409 credit_pack_unavailable` until you [move them](/docs/plan-versions#move-subscribers) to a version that sells it.
30
+
31
+ Send `planIds` when you create or update a pack to choose the plans that sell it. Left out on create, or empty, every plan sells it, including plans created later.
23
32
 
24
33
  ## List credit packs via SDK
25
34
 
@@ -78,11 +87,11 @@ curl https://commet.co/api/v1/credit-packs \
78
87
  }
79
88
  ```
80
89
 
81
- The `price` field is in **cents** (1000 = $10.00). Prices are always in USD.
90
+ The `price` field is the USD price in **cents** (1000 = $10.00). For other currencies, Commet converts it with the plan's exchange rate, unless the plan version sets the pack's price by hand for the buyer's country in the [Regional prices](/docs/regional-prices#set-prices-by-country) tab.
82
91
 
83
92
  ## Buy a chosen quantity of credits
84
93
 
85
- Set a price per credit on the plan to let customers buy any whole quantity instead of a fixed pack. Open **Plans**, select a credits plan, and edit **Credit purchases**: **Price per credit** and an optional **Minimum purchase**.
94
+ Set a price per credit on the plan to let customers buy any whole quantity instead of a fixed pack. Open **Plans**, select a credits plan, and edit **Buying credits** under **Credit rules**: the **Price per credit** and an optional minimum. The change goes into a draft until you [publish it](/docs/plan-versions#edit-in-the-dashboard).
86
95
 
87
96
  ```typescript
88
97
  await commet.subscriptions.purchaseCredits({
@@ -91,13 +100,14 @@ await commet.subscriptions.purchaseCredits({
91
100
  })
92
101
  ```
93
102
 
94
- Commet charges the saved payment method at the plan's price per credit and adds purchased credits. Send `creditPackId` instead of `quantity` to buy a pack. Both fire [`credits.purchased`](/docs/webhooks/credits-purchased).
103
+ Commet charges the saved payment method at the price per credit of the subscription's plan version and adds purchased credits. Send `creditPackId` instead of `quantity` to buy a pack. Both fire [`credits.purchased`](/docs/webhooks/credits-purchased).
95
104
 
96
- | Response | Cause |
97
- | ----------------------- | -------------------------------------------------------------------------- |
98
- | `400 validation_error` | The quantity is below the plan's minimum, or the plan doesn't sell credits |
99
- | `402 no_payment_method` | The subscription has no saved payment method Commet can charge |
100
- | `402 payment_failed` | The charge was declined |
105
+ | Response | Cause |
106
+ | ----------------------------- | -------------------------------------------------------------------------- |
107
+ | `400 validation_error` | The quantity is below the plan's minimum, or the plan doesn't sell credits |
108
+ | `402 no_payment_method` | The subscription has no saved payment method Commet can charge |
109
+ | `402 payment_failed` | The charge was declined |
110
+ | `409 credit_pack_unavailable` | The subscription's plan version doesn't sell the pack |
101
111
 
102
112
  The effective minimum is the larger of the configured minimum and the smallest quantity that reaches the currency's minimum charge.
103
113
 
@@ -17,7 +17,7 @@ A plan group is the [upgrade and downgrade path](/docs/what-happens-when-a-custo
17
17
 
18
18
  ## Create a plan group in the dashboard
19
19
 
20
- Go to **Plans** → **Groups** and click **Create Group**. Name the group, add your plans, then drag and drop to arrange them from lowest to highest tier. Each plan can only belong to one group. Plans with [Regional Prices](/docs/regional-prices) can be added, but all plans in a group must support the same set of currencies so any subscriber can move between them.
20
+ Go to **Plans** → **Groups** and click **Create Group**. Name the group, add your plans, then drag and drop to arrange them from lowest to highest tier. Each plan can only belong to one group. Plans in a group can sell different currencies and countries with [Regional Prices](/docs/regional-prices). A subscriber can switch only to group plans that sell its currency in its country: the Customer Portal shows only those, and the API rejects the others with `422 missing_regional_price`.
21
21
 
22
22
  This order defines the upgrade path and display order in the Customer Portal.
23
23
 
@@ -0,0 +1,265 @@
1
+ ---
2
+ title: Plan Versions
3
+ description: "Edit a plan without changing what existing subscribers pay: publish a new version or an experiment, then move subscribers when you choose."
4
+ ---
5
+
6
+ Every subscription is pinned to one version of its plan. A version holds the complete terms: prices, trials, features, credit and balance rules, add-ons, credit packs, and country prices. The plan points at its current version, which every new buyer gets.
7
+
8
+ Editing a plan publishes a new version and moves nobody. Existing subscribers keep the prices, features, and rules of their version, at renewal too, until you move them.
9
+
10
+ ## What a version holds
11
+
12
+ | Versioned | Not versioned |
13
+ | ------------------------------------------------------------------------------------ | ------------------------------------------------------ |
14
+ | Prices per billing interval, trial days, and the interval shown first | Name and description |
15
+ | The Introductory Offer of each price | Visibility |
16
+ | Features, included amounts, overage prices, and limits | [Market](/docs/regional-prices#create-a-market) prices |
17
+ | Credit and balance rules: carry-over, spending limits, credit purchases, and top-ups | |
18
+ | The add-ons and credit packs the plan sells, with their prices | |
19
+ | Countries with their currency and prices | |
20
+
21
+ **Edit details** changes the name, description, and visibility at once, for everyone. Market prices apply to every version: an edit to a Market price reaches the subscribers who pay it at their next renewal.
22
+
23
+ The plan's versions are numbered 1, 2, 3. An experiment's own versions carry its code, such as `price-test 2`.
24
+
25
+ ## Edit in the dashboard
26
+
27
+ Open a plan from **Plans**. The version menu opens the current version, drafts, experiments, and older versions. The plan page has six tabs:
28
+
29
+ | Tab | What it shows |
30
+ | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
31
+ | **Plan** | The prices, features, rules, add-ons, and credit packs of the version you opened |
32
+ | **Regional prices** | The version's countries, with their currency and prices |
33
+ | **Subscribers** | The plan's subscribers with their version and any move pending, with its date, plus **Needs a change** |
34
+ | **Versions** | The published versions with what changed in each, and the plan's drafts |
35
+ | **Experiments** | Each experiment with its status, the version it sells, and its subscribers |
36
+ | **Moves** | Every move with how many subscribers moved, are on track, need a change, or were left out. A move not yet finished can be canceled here |
37
+
38
+ 1. Edit any version. The first change starts a draft from it. A draft is saved as you edit, and nobody sees it until you publish it. A removed price, feature, add-on, or credit pack stays in place, struck through, with **Undo**. Disabling a feature appears in the changes as **Disabled**; only removing it appears as removed.
39
+ 2. The plan header shows the draft's number of changes. Open it to review **Changes in this draft** and undo any of them, or choose **Discard draft**.
40
+ 3. Choose **Review and publish** in the header, then publish it as:
41
+ - **The current version**, which new buyers get.
42
+ - **A new experiment**, sold only through its own code. Only for drafts started from the current version.
43
+ - **Next version of an experiment**, for drafts started from an experiment's latest version.
44
+ 4. Choose what happens to subscribers of earlier versions: **Keep them on their version**, **Move them at their next renewal**, or **Move them now**. When some of them don't fit the new version, the dialog lists each one with what would make it fit.
45
+
46
+ A draft publishes exactly its content. A draft started from an older version undoes what later versions changed, and the review lists those changes.
47
+
48
+ Publishing stops while a country is missing a price, or when the current version would drop the trial without a payment method of the plan group's [signup trial](/docs/plan-groups#default-plan-and-signup-trial).
49
+
50
+ To move subscribers later, open **Subscribers**, select them, and choose **Move to another version**.
51
+
52
+ ## Edit through the API
53
+
54
+ Every plan edit made through the API, MCP, or the CLI publishes a new current version at once and moves nobody. That includes adding, changing, or removing prices and features, regional pricing, and the credit and balance rules of `PATCH /plans/{id}`. New buyers get the new version; existing subscribers stay on theirs until you [move them](#move-subscribers).
55
+
56
+ To prepare several changes and publish them together, start a draft:
57
+
58
+ ```bash
59
+ curl -X POST https://commet.co/api/v1/plans/pln_xxx/drafts \
60
+ -H "x-api-key: $COMMET_API_KEY" \
61
+ -H "commet-version: 2026-08-27" \
62
+ -H "Content-Type: application/json" \
63
+ -d '{}'
64
+ ```
65
+
66
+ The draft starts from the current version unless you send `fromVersionId`. Change it with `PATCH /plans/{id}/drafts/{draftId}` and the blocks `prices`, `countries`, `rules`, and `undo`. Each block you send replaces that block, so `prices` lists every interval the draft sells:
67
+
68
+ ```bash
69
+ curl -X PATCH https://commet.co/api/v1/plans/pln_xxx/drafts/plr_draft \
70
+ -H "x-api-key: $COMMET_API_KEY" \
71
+ -H "commet-version: 2026-08-27" \
72
+ -H "Content-Type: application/json" \
73
+ -d '{"prices":[{"billingInterval":"monthly","price":5900,"isDefault":true},{"billingInterval":"yearly","price":59000}]}'
74
+ ```
75
+
76
+ Publish it with `"preview": true` first to check everything without publishing:
77
+
78
+ ```bash
79
+ curl -X POST https://commet.co/api/v1/plans/pln_xxx/drafts/plr_draft/publish \
80
+ -H "x-api-key: $COMMET_API_KEY" \
81
+ -H "commet-version: 2026-08-27" \
82
+ -H "Content-Type: application/json" \
83
+ -d '{"publishAs":"current","move":"period_end","preview":true}'
84
+ ```
85
+
86
+ | Field | Values |
87
+ | ----------- | ------------------------------------------------------------------------------------------------------------ |
88
+ | `publishAs` | `current`, `experiment` with `experimentCode`, or `experiment_version` |
89
+ | `move` | `keep` (default), `period_end`, or `now`, for subscribers of earlier versions. An experiment takes no `move` |
90
+ | `changes` | Per-subscriber changes that make each one fit. See [Resolve conflicts](#resolve-conflicts) |
91
+
92
+ Features and the add-ons and credit packs a plan sells are not part of an API draft: their own endpoints publish a new version at once. Introductory Offers are set in a dashboard draft.
93
+
94
+ `POST /plans/{id}/versions` publishes a new current version without a draft. It changes only money terms: prices, included credits or balance, per-currency amounts, and the carry-over cap.
95
+
96
+ ## Move subscribers
97
+
98
+ Only you move subscribers, and a move changes a subscription's version, never its plan. Move one subscription with `change-version`:
99
+
100
+ ```bash
101
+ curl -X POST https://commet.co/api/v1/subscriptions/sub_xxx/change-version \
102
+ -H "x-api-key: $COMMET_API_KEY" \
103
+ -H "commet-version: 2026-08-27" \
104
+ -H "Content-Type: application/json" \
105
+ -d '{"planVersionId":"plr_new","effective":"period_end"}'
106
+ ```
107
+
108
+ Repeating the same request changes nothing, and a new one replaces the pending move. Move many at once with `POST /plans/{id}/moves`, sending `subscriptionIds` (up to 10,000) or `fromVersionId` to move every subscription of that version:
109
+
110
+ ```bash
111
+ curl -X POST https://commet.co/api/v1/plans/pln_xxx/moves \
112
+ -H "x-api-key: $COMMET_API_KEY" \
113
+ -H "commet-version: 2026-08-27" \
114
+ -H "Content-Type: application/json" \
115
+ -d '{"fromVersionId":"plr_old","toVersionId":"plr_new","effective":"period_end","preview":true}'
116
+ ```
117
+
118
+ | `effective` | What changes |
119
+ | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
120
+ | `now` | Features, limits, and included credits or balance change today, without resetting usage. The new price is charged from the next renewal |
121
+ | `period_end` | Everything changes at the next renewal. Until then nothing in the current period changes: balance, usage checks, features, and access stay as they are |
122
+
123
+ A move never prorates or refunds. With `now`, a larger included amount first pays any plan credit or balance debt, a smaller one never creates new debt, and purchased credits and balance are untouched.
124
+
125
+ ### What a move keeps
126
+
127
+ - **Currency, country, interval, and price.** A move never changes a subscription's currency. A version that doesn't sell its currency returns `422 missing_regional_price`, and one that doesn't sell the price it pays returns `404 price_not_found`.
128
+ - **Market prices.** A subscription that pays a Market price keeps paying it.
129
+ - **Free or paid.** A free version moves only to a free version, and a paid one only to a paid one (`400 validation_error`).
130
+
131
+ ### Who can move
132
+
133
+ - Subscriptions move only to a newer version (`422 version_not_newer`). One on a running experiment moves only to a later version of that experiment.
134
+ - Only `active`, `trialing`, and `past_due` subscriptions move; `change-version` rejects the others with `409 invalid_subscription_status`. A plan move leaves out the others, such as paused ones, and listed subscriptions already on the destination; they stay on their version. A scheduled cancellation, pause, downgrade, or interval change doesn't leave a subscription out.
135
+ - A one-time subscription never renews, so it moves only now. `change-version` with `period_end` returns `409 invalid_subscription_status`, and a plan move at renewal leaves it out.
136
+ - An active add-on the version doesn't sell (`409 addon_unavailable`), or more seats than the version allows (`400 seat_limit_exceeded`), keeps a subscription from moving until you resolve it.
137
+
138
+ ### Resolve conflicts
139
+
140
+ A plan move, a publish with `move`, and an experiment archive check every subscriber first. If any of them doesn't fit, nobody moves and the response is `409 subscribers_do_not_fit`, listing each one with the reasons. Send a change for each one in `changes`:
141
+
142
+ | Change | Effect at the subscriber's renewal |
143
+ | --------------------- | ---------------------------------------------- |
144
+ | `billingInterval` | Moves it to another interval the version sells |
145
+ | `seatLimit: true` | Lowers its seats to the version's limit |
146
+ | `removeAddonIds` | Stops charging the listed add-ons |
147
+ | `keepOnVersion: true` | Leaves it on its version |
148
+
149
+ ```json
150
+ {
151
+ "fromVersionId": "plr_old",
152
+ "toVersionId": "plr_new",
153
+ "effective": "now",
154
+ "changes": [{ "subscriptionId": "sub_xxx", "removeAddonIds": ["adn_xxx"] }]
155
+ }
156
+ ```
157
+
158
+ A subscriber with a change always moves at its renewal, even in a move made now.
159
+
160
+ ### When a move at renewal applies
161
+
162
+ A move at renewal waits for the subscription's next renewal, the date `scheduledVersionChange.effectiveAt` shows. The renewal invoices the new period on the new version and sends one `subscription.version_changed`.
163
+
164
+ | Subscription | When it moves |
165
+ | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
166
+ | `active` | At the end of its current period |
167
+ | `trialing` | When the trial ends. Its first charge is already on the new version |
168
+ | `past_due` | It keeps its version while Commet collects the overdue renewal. Once that's paid, it moves at the end of the period it paid for; `effectiveAt` shows that date meanwhile |
169
+ | Paused and resumed, or changing interval | At its next renewal after that, with that date |
170
+
171
+ A subscription that ends instead of renewing ends on its version, whether by a cancellation at the end of its period or trial, exhausted dunning, the suspension of the organization, or an immediate cancellation. It sends no version webhook, `scheduledVersionChange` becomes `null`, and its plan move stops waiting for it. A change to another plan, now or at that renewal, such as a scheduled downgrade or the plan group's default plan, lands on the other plan's current version, also without a version webhook.
172
+
173
+ While a cancellation or a downgrade is scheduled, the API and the Subscribers tab still show the move with its date. If the cancellation or downgrade is revoked, the subscription moves at its renewal.
174
+
175
+ ### Track and cancel moves
176
+
177
+ - `GET /plans/{id}/moves` lists the plan's moves, and `GET /plans/{id}/moves/{moveId}` reports each subscriber as `moving`, `moved`, `needs_a_change`, `left_out`, `canceled`, or `kept_on_version`.
178
+ - A change of one subscription with `change-version` is recorded as a move of that one subscriber. It appears in `GET /plans/{id}/moves` and the **Moves** tab like any other move.
179
+ - `POST /plans/{id}/moves/{moveId}/cancel` cancels the move for everyone who hasn't moved yet. `POST /plans/{id}/moves/{moveId}/subscriptions/{subscriptionId}/cancel` cancels it for one.
180
+ - `DELETE /subscriptions/{id}/scheduled-version-change` revokes one subscription's pending move.
181
+
182
+ Canceling or revoking a pending move sends `subscription.version_change_canceled` with `reason: "canceled_by_merchant"` for each subscriber it cancels, and records them as `canceled`.
183
+
184
+ A move scheduled for renewal is checked again at the renewal. If the subscription no longer fits, it renews on its version and appears in `GET /plans/{id}/needs-a-change` and under **Needs a change** on the Subscribers tab. Each entry carries the `moveId` of the move it couldn't complete. Move it again with a change, or leave it with `POST /plans/{id}/needs-a-change/{subscriptionId}/keep`.
185
+
186
+ ## Run an experiment
187
+
188
+ An experiment sells a version only to the buyers you send to it; everyone else keeps buying the current version. Publish a draft started from the current version as **A new experiment**, or create one with `POST /plans/{id}/experiments`. Its code uses lowercase letters, numbers, hyphens, and underscores, and is never reused in the plan.
189
+
190
+ Sell it by sending the experiment code after the plan code:
191
+
192
+ ```bash
193
+ curl -X POST https://commet.co/api/v1/subscriptions \
194
+ -H "x-api-key: $COMMET_API_KEY" \
195
+ -H "commet-version: 2026-08-27" \
196
+ -H "Content-Type: application/json" \
197
+ -d '{"customerId":"user_123","planCode":"pro:price-test"}'
198
+ ```
199
+
200
+ An unknown experiment code returns `404 plan_experiment_not_found`.
201
+
202
+ | Action | Endpoint | Result |
203
+ | ------------------------ | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
204
+ | Publish its next version | `POST /plans/{id}/experiments/{code}/versions` | Its code sells the new version; earlier subscribers of the experiment stay on theirs |
205
+ | Make it current | `POST /plans/{id}/experiments/{code}/make-current` | Its latest version becomes the plan's current version with the next number. Its subscribers are already on it, and its code sells the current version from then on |
206
+ | Archive it | `POST /plans/{id}/experiments/{code}/archive` | Its code sells the current version, so links already shared keep working. `subscribers` chooses `keep`, `period_end`, or `now` for its subscribers |
207
+
208
+ Making an experiment current through the API moves nobody else. The dashboard also asks what happens to subscribers of earlier versions.
209
+
210
+ ## Sell a specific version
211
+
212
+ Send `planVersionId` on `POST /subscriptions` to create the subscription on any published version, current or not, including an experiment's versions. Checkout charges that version's price, and activation grants its credits, add-ons, and credit packs. Sending `planVersionId` with an experiment code returns `400`.
213
+
214
+ ## Unpaid checkouts
215
+
216
+ A checkout that hasn't been paid isn't a subscriber yet, so it follows the latest version of what was requested:
217
+
218
+ | Requested with | The checkout charges |
219
+ | -------------------------------------------- | ------------------------------------------------------------- |
220
+ | The plan code, such as `pro` | The plan's current version |
221
+ | An experiment code, such as `pro:price-test` | The experiment's latest version, never the plan's current one |
222
+ | `planVersionId` | That version |
223
+
224
+ Its link charges that version without a new request. Repeating the same `POST /subscriptions` after you edit the plan reuses the checkout: the response is `200` with the same subscription ID and `checkoutUrl`.
225
+
226
+ A different request replaces it: another plan, experiment, version, interval, or price, the plan code after an experiment code, or `planVersionId` instead of a code or the other way round. The old subscription is canceled, its invoice is voided, and its link stops working.
227
+
228
+ ## Reactivate a canceled subscription
229
+
230
+ Reactivating a canceled subscription returns it on the latest version of what was bought:
231
+
232
+ - the plan's current version, when it was bought with the plan code;
233
+ - the experiment's latest version, when it was bought with an experiment code, or the plan's current version once the experiment is no longer running;
234
+ - the same version, when it was bought with `planVersionId`.
235
+
236
+ Add-ons that version doesn't sell are deactivated. A version that doesn't sell the subscription's currency returns `422 missing_regional_price`. Reactivating a `past_due` subscription keeps its version.
237
+
238
+ ## Add-ons, credit packs, and countries
239
+
240
+ Each version lists the add-ons and credit packs it sells, with their prices. Creating or editing an add-on or credit pack publishes a new version of each plan that sells it. A subscriber buys only what its version sells: an add-on or pack added in a newer version returns `409 addon_unavailable` or `409 credit_pack_unavailable` until you move the subscriber. See [Add-ons](/docs/add-ons#add-ons-and-plan-versions) and [Credit Packs](/docs/credit-packs#credit-packs-and-plan-versions).
241
+
242
+ Each version also sets countries with their own currency and prices. See [Set prices by country](/docs/regional-prices#set-prices-by-country).
243
+
244
+ ## Read versions
245
+
246
+ | Request | Returns |
247
+ | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
248
+ | `GET /plans/{id}/versions` | The plan's published versions, newest first, with their prices and subscription counts |
249
+ | `GET /plans/{id}/versions/{versionId}` | One version |
250
+ | `GET /plans/{id}/versions/{versionId}/changes?against={otherVersionId}` | Every term that differs between two versions. A disabled feature reads `Disabled`; a removed term has `after: null` |
251
+
252
+ Versions published before Commet recorded every term are not listed, and reading one by ID returns `404 plan_version_not_found`.
253
+
254
+ Every subscription includes `planVersion`, with its `id` and `label`, and `scheduledVersionChange`, with the `planVersionId`, `label`, and `effectiveAt` of the move pending for its next renewal, or `null`. See [When a move at renewal applies](#when-a-move-at-renewal-applies). Filter `GET /subscriptions` by version with `planVersionId`.
255
+
256
+ ## Webhooks
257
+
258
+ | Event | When it fires |
259
+ | --------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
260
+ | [`subscription.version_changed`](/docs/webhooks/subscription-version-changed) | A subscription changed version: a move made now or a scheduled move at renewal. Making an experiment current moves nobody, so it sends none |
261
+ | [`subscription.version_change_canceled`](/docs/webhooks/subscription-version-change-canceled) | A pending move will not happen. `reason` is `canceled_by_merchant` when you canceled or revoked it, `version_change_failed`, or the code of what the subscription no longer fits |
262
+
263
+ Neither is sent when the subscription ends or changes to another plan before the move applies, or when a new move replaces the pending one.
264
+
265
+ Both reach only the webhook endpoints that list them. Add them to your endpoint's events to receive them.