@commet/node 9.12.0 → 9.13.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 +298 -495
- package/dist/index.d.ts +298 -495
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -11
- package/dist/index.mjs.map +1 -1
- package/docs/api-reference/addons.md +8 -15
- package/docs/api-reference/api-keys.md +1 -1
- package/docs/api-reference/credit-packs.md +2 -2
- package/docs/api-reference/customers.md +7 -19
- package/docs/api-reference/offers.md +9 -5
- package/docs/api-reference/payments.md +1 -1
- package/docs/api-reference/plan-groups.md +2 -2
- package/docs/api-reference/plans.md +28 -44
- package/docs/api-reference/portal.md +3 -8
- package/docs/api-reference/promo-codes.md +3 -3
- package/docs/api-reference/quota.md +6 -21
- package/docs/api-reference/subscriptions.md +38 -55
- package/docs/api-reference/test-clock.md +3 -8
- package/docs/api-reference/usage.md +6 -11
- package/docs/documentation/create-api-key.md +4 -2
- package/docs/documentation/invoicing/handle-failed-payments.md +12 -3
- package/docs/documentation/plans/one-time-payments.md +1 -0
- package/docs/documentation/sales/offers.md +21 -3
- package/docs/documentation/sales/promo-codes.md +2 -2
- package/docs/documentation/sales/promotional-offers.md +1 -1
- package/docs/documentation/subscriptions/manage-subscriptions.md +3 -3
- package/docs/documentation/subscriptions/pay-in-advance.md +6 -4
- package/docs/errors/already_has_active_subscription.md +1 -1
- package/docs/errors/charge_failed.md +1 -1
- package/docs/errors/no_payment_method.md +1 -1
- package/docs/errors/payment_failed.md +1 -1
- package/docs/errors/subscription_not_active.md +1 -1
- package/docs/errors/validation_error.md +1 -1
- package/docs/knowledge-base/how-do-discounts-work.md +3 -3
- package/docs/knowledge-base/what-happens-when-a-payment-fails.md +6 -6
- package/docs/schemas.md +6 -4
- package/docs/webhooks.md +2 -0
- package/docs/webhooks.openapi.json +22 -4
- package/package.json +1 -1
|
@@ -48,9 +48,9 @@ Update an add-on's name, description, pricing, or the plans that sell it.
|
|
|
48
48
|
- `name` (`string`, optional)
|
|
49
49
|
- `description` (`string`, optional)
|
|
50
50
|
- `basePrice` (`number`, optional)
|
|
51
|
-
- `includedUnits` (`number`, optional)
|
|
52
|
-
- `overageRate` (`number`, optional)
|
|
53
|
-
- `planIds` (`Array<string>`, optional) — Plans that sell the add-on, replacing the current ones. Empty means every plan; omitted keeps them. Removing a plan is rejected with addon_has_activations while a subscription of that plan has the add-on active.
|
|
51
|
+
- `includedUnits` (`number`, optional) — Only on a metered add-on.
|
|
52
|
+
- `overageRate` (`number`, optional) — Only on a metered or balance add-on.
|
|
53
|
+
- `planIds` (`Array<string>`, optional) — Plans that sell the add-on, replacing the current ones. Empty means every plan; omitted keeps them. Removing a plan is rejected with addon_has_activations while a subscription of that plan has the add-on active. Each entry is a plan ID (`pln_…`) or a plan code.
|
|
54
54
|
|
|
55
55
|
### Request options
|
|
56
56
|
|
|
@@ -103,22 +103,15 @@ Create a new add-on linked to a feature. Each feature can only be assigned to on
|
|
|
103
103
|
|
|
104
104
|
### Parameters
|
|
105
105
|
|
|
106
|
+
- `consumptionModel` (`"boolean" | "metered" | "credits" | "balance"`, required)
|
|
106
107
|
- `name` (`string`, required)
|
|
107
108
|
- `description` (`string`, optional)
|
|
108
109
|
- `basePrice` (`number`, required)
|
|
109
110
|
- `featureId` (`string`, required)
|
|
110
|
-
- `planIds` (`Array<string>`, optional) — Plans that sell the add-on. Omitted or empty, every plan sells it. Plans created later sell it too.
|
|
111
|
-
- `
|
|
112
|
-
- `
|
|
113
|
-
- `
|
|
114
|
-
- `creditCost` (`number`, optional)
|
|
115
|
-
|
|
116
|
-
### Valid parameter combinations
|
|
117
|
-
|
|
118
|
-
- `name` + `basePrice` + `featureId` + `consumptionModel`
|
|
119
|
-
- `name` + `basePrice` + `featureId` + `consumptionModel` + `includedUnits` + `overageRate`
|
|
120
|
-
- `name` + `basePrice` + `featureId` + `consumptionModel` + `creditCost`
|
|
121
|
-
- `name` + `basePrice` + `featureId` + `consumptionModel` + `overageRate`
|
|
111
|
+
- `planIds` (`Array<string>`, optional) — Plans that sell the add-on. Omitted or empty, every plan sells it. Plans created later sell it too. Each entry is a plan ID (`pln_…`) or a plan code.
|
|
112
|
+
- `includedUnits` (`number`, optional) — Required when `consumptionModel` is `metered`. Only when `consumptionModel` is `metered`.
|
|
113
|
+
- `overageRate` (`number`, optional) — Required when `consumptionModel` is `metered` or `balance`. Only when `consumptionModel` is `metered` or `balance`.
|
|
114
|
+
- `creditCost` (`number`, optional) — Required when `consumptionModel` is `credits`. Only when `consumptionModel` is `credits`.
|
|
122
115
|
|
|
123
116
|
### Request options
|
|
124
117
|
|
|
@@ -47,7 +47,7 @@ Create a full-access or restricted API key. Provide permissions to restrict acce
|
|
|
47
47
|
|
|
48
48
|
- `name` (`string`, required)
|
|
49
49
|
- `expiresInDays` (`number`, optional)
|
|
50
|
-
- `permissions` (`{ customer?: Array<"read"
|
|
50
|
+
- `permissions` (`{ customer?: Array<"read" | "write">; subscription?: Array<"read" | "write">; invoice?: Array<"read" | "write">; usage?: Array<"read" | "write">; seat?: Array<"read" | "write">; plan?: Array<"read" | "write">; plan_group?: Array<"read" | "write">; feature?: Array<"read" | "write">; addon?: Array<"read" | "write">; credit_pack?: Array<"read" | "write">; offer?: Array<"read" | "write">; promo_code?: Array<"read" | "write">; market_group?: Array<"read" | "write">; payment?: Array<"read" | "write">; transaction?: Array<"read" | "write">; payout?: Array<"read" | "write">; test_clock?: Array<"read" | "write">; organization?: Array<"read" | "write">; api_key?: Array<"read" | "write"> }`, optional)
|
|
51
51
|
|
|
52
52
|
### Request options
|
|
53
53
|
|
|
@@ -18,7 +18,7 @@ Update a credit pack's name, description, credits, price, active status, or the
|
|
|
18
18
|
- `credits` (`number`, optional)
|
|
19
19
|
- `price` (`number`, optional)
|
|
20
20
|
- `isActive` (`boolean`, optional)
|
|
21
|
-
- `planIds` (`Array<string>`, optional) — Plans that sell the credit pack, replacing the current ones. Empty means every plan; omitted keeps them.
|
|
21
|
+
- `planIds` (`Array<string>`, optional) — Plans that sell the credit pack, replacing the current ones. Empty means every plan; omitted keeps them. Each entry is a plan ID (`pln_…`) or a plan code.
|
|
22
22
|
|
|
23
23
|
### Request options
|
|
24
24
|
|
|
@@ -71,7 +71,7 @@ Create a new credit pack.
|
|
|
71
71
|
- `credits` (`number`, required)
|
|
72
72
|
- `price` (`number`, required)
|
|
73
73
|
- `isActive` (`boolean`, optional)
|
|
74
|
-
- `planIds` (`Array<string>`, optional) — Plans that sell the credit pack. Omitted or empty, every plan sells it. Plans created later sell it too.
|
|
74
|
+
- `planIds` (`Array<string>`, optional) — Plans that sell the credit pack. Omitted or empty, every plan sells it. Plans created later sell it too. Each entry is a plan ID (`pln_…`) or a plan code.
|
|
75
75
|
|
|
76
76
|
### Request options
|
|
77
77
|
|
|
@@ -97,16 +97,10 @@ Keep the overlay for a number of the subscription's existing billing cycles, set
|
|
|
97
97
|
|
|
98
98
|
- `id` (`string`, required)
|
|
99
99
|
- `grantId` (`string`, required)
|
|
100
|
-
- `reason` (`string`, required)
|
|
101
100
|
- `duration` (`"cycles" | "until_date" | "until_revoked"`, required)
|
|
102
|
-
- `
|
|
103
|
-
- `
|
|
104
|
-
|
|
105
|
-
### Valid parameter combinations
|
|
106
|
-
|
|
107
|
-
- `reason` + `duration` + `durationCycles`
|
|
108
|
-
- `reason` + `duration` + `expiresAt`
|
|
109
|
-
- `reason` + `duration`
|
|
101
|
+
- `reason` (`string`, required)
|
|
102
|
+
- `durationCycles` (`number`, optional) — Required when `duration` is `cycles`. Ignored when `duration` is `until_date` or `until_revoked`.
|
|
103
|
+
- `expiresAt` (`string`, optional) — Required when `duration` is `until_date`. Ignored when `duration` is `cycles` or `until_revoked`.
|
|
110
104
|
|
|
111
105
|
### Request options
|
|
112
106
|
|
|
@@ -143,18 +137,12 @@ Temporarily expand an active subscription's feature access using a higher plan i
|
|
|
143
137
|
### Parameters
|
|
144
138
|
|
|
145
139
|
- `id` (`string`, required)
|
|
140
|
+
- `duration` (`"cycles" | "until_date" | "until_revoked"`, required)
|
|
146
141
|
- `subscriptionId` (`string`, required)
|
|
147
|
-
- `planId` (`string`, required)
|
|
142
|
+
- `planId` (`string`, required) — The plan's ID (`pln_…`) or its code.
|
|
148
143
|
- `reason` (`string`, required)
|
|
149
|
-
- `
|
|
150
|
-
- `
|
|
151
|
-
- `expiresAt` (`string`, optional)
|
|
152
|
-
|
|
153
|
-
### Valid parameter combinations
|
|
154
|
-
|
|
155
|
-
- `subscriptionId` + `planId` + `reason` + `duration` + `durationCycles`
|
|
156
|
-
- `subscriptionId` + `planId` + `reason` + `duration` + `expiresAt`
|
|
157
|
-
- `subscriptionId` + `planId` + `reason` + `duration`
|
|
144
|
+
- `durationCycles` (`number`, optional) — Required when `duration` is `cycles`. Ignored when `duration` is `until_date` or `until_revoked`.
|
|
145
|
+
- `expiresAt` (`string`, optional) — Required when `duration` is `until_date`. Ignored when `duration` is `cycles` or `until_revoked`.
|
|
158
146
|
|
|
159
147
|
### Request options
|
|
160
148
|
|
|
@@ -30,11 +30,13 @@ Replace reusable offer terms. Existing applications keep their immutable accepte
|
|
|
30
30
|
|
|
31
31
|
- `id` (`string`, required)
|
|
32
32
|
- `name` (`string`, required)
|
|
33
|
-
- `phases` (`Array<{ type: "percentage"
|
|
33
|
+
- `phases` (`Array<{ type: "percentage" | "amount_off" | "fixed_price"; durationCycles: number | null; durationInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; percentage?: number; amounts?: Array<{ currency: string; amount: number }>; prices?: Array<{ currency: string; amount: number }> }>`, required)
|
|
34
34
|
- `metadata` (`Record<string, unknown>`, optional)
|
|
35
35
|
- `startsAt` (`string | null`, optional)
|
|
36
|
-
- `endsAt` (`string | null`, optional)
|
|
36
|
+
- `endsAt` (`string | null`, optional) — After `startsAt`.
|
|
37
37
|
- `active` (`boolean`, optional)
|
|
38
|
+
- `planIds` (`Array<string>`, optional) — Plans the offer is limited to: it cannot be applied to a subscription on another plan, and an applied offer ends when the subscriber changes to one. An empty list removes the limit. Omit to keep the current limit. Each entry is a plan ID (`pln_…`) or a plan code.
|
|
39
|
+
- `billingInterval` (`"weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time" | null`, optional) — Billing interval the offer is limited to: it cannot be applied to a subscription on another interval, and an applied offer ends when the subscriber changes to one. Null removes the limit. Omit to keep the current limit.
|
|
38
40
|
|
|
39
41
|
### Request options
|
|
40
42
|
|
|
@@ -84,16 +86,18 @@ List reusable offer terms. Offers are independent from plans, prices, eligibilit
|
|
|
84
86
|
|
|
85
87
|
`POST /offers` · operation `create-offer`
|
|
86
88
|
|
|
87
|
-
Create reusable offer terms
|
|
89
|
+
Create reusable offer terms. An offer applies to any plan and billing interval unless `planIds` or `billingInterval` limit it.
|
|
88
90
|
|
|
89
91
|
### Parameters
|
|
90
92
|
|
|
91
93
|
- `name` (`string`, required)
|
|
92
|
-
- `phases` (`Array<{ type: "percentage"
|
|
94
|
+
- `phases` (`Array<{ type: "percentage" | "amount_off" | "fixed_price"; durationCycles: number | null; durationInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; percentage?: number; amounts?: Array<{ currency: string; amount: number }>; prices?: Array<{ currency: string; amount: number }> }>`, required)
|
|
93
95
|
- `metadata` (`Record<string, unknown>`, optional)
|
|
94
96
|
- `startsAt` (`string | null`, optional)
|
|
95
|
-
- `endsAt` (`string | null`, optional)
|
|
97
|
+
- `endsAt` (`string | null`, optional) — After `startsAt`.
|
|
96
98
|
- `active` (`boolean`, optional)
|
|
99
|
+
- `planIds` (`Array<string>`, optional) — Plans the offer is limited to: it cannot be applied to a subscription on another plan, and an applied offer ends when the subscriber changes to one. An empty list removes the limit. Omit to keep the current limit. Each entry is a plan ID (`pln_…`) or a plan code.
|
|
100
|
+
- `billingInterval` (`"weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time" | null`, optional) — Billing interval the offer is limited to: it cannot be applied to a subscription on another interval, and an applied offer ends when the subscriber changes to one. Null removes the limit. Omit to keep the current limit.
|
|
97
101
|
|
|
98
102
|
### Request options
|
|
99
103
|
|
|
@@ -90,7 +90,7 @@ Create a hosted payment link. Returns a url the customer opens to pay with any c
|
|
|
90
90
|
|
|
91
91
|
### Parameters
|
|
92
92
|
|
|
93
|
-
- `amount` (`number`, required)
|
|
93
|
+
- `amount` (`number`, required) — In the currency's minor unit, at least the currency's minimum charge.
|
|
94
94
|
- `currency` (`string`, required)
|
|
95
95
|
- `customerId` (`string`, optional)
|
|
96
96
|
- `description` (`string`, required)
|
|
@@ -30,7 +30,7 @@ Set the display order of plans within a group. All plan IDs in the group must be
|
|
|
30
30
|
### Parameters
|
|
31
31
|
|
|
32
32
|
- `id` (`string`, required)
|
|
33
|
-
- `planIds` (`Array<string>`, required)
|
|
33
|
+
- `planIds` (`Array<string>`, required) — Each entry is a plan ID (`pln_…`) or a plan code.
|
|
34
34
|
|
|
35
35
|
### Request options
|
|
36
36
|
|
|
@@ -51,7 +51,7 @@ Add an existing plan to a plan group with optional sort order.
|
|
|
51
51
|
### Parameters
|
|
52
52
|
|
|
53
53
|
- `id` (`string`, required)
|
|
54
|
-
- `planId` (`string`, required)
|
|
54
|
+
- `planId` (`string`, required) — The plan's ID (`pln_…`) or its code.
|
|
55
55
|
- `sortOrder` (`number`, optional)
|
|
56
56
|
|
|
57
57
|
### Request options
|
|
@@ -14,17 +14,11 @@ Publish a draft as the plan's current version, as a new experiment with its own
|
|
|
14
14
|
|
|
15
15
|
- `id` (`string`, required)
|
|
16
16
|
- `draftId` (`string`, required)
|
|
17
|
-
- `publishAs` (`"current" | "experiment" | "experiment_version"`, required) — current sells the draft to every new buyer.
|
|
18
|
-
- `move` (`"keep" | "period_end" | "now"`, optional) — What happens to subscribers of earlier versions: keep them, move them at their next renewal, or move them now (features and balance change today, the price at renewal). Nobody moves unless every one of them fits or has a change below.
|
|
19
|
-
- `changes` (`Array<{ subscriptionId: string; keepOnVersion?: true; billingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly"; seatLimit?: true; removeAddonIds?: Array<string>; currency?: string }>`, optional) — Per-subscriber changes that make each one fit, applied at its renewal.
|
|
17
|
+
- `publishAs` (`"current" | "experiment" | "experiment_version"`, required) — current sells the draft to every new buyer. experiment starts an experiment with experimentCode, sold with planCode plan:code. Starting an experiment moves nobody, so it takes no move or changes. experiment_version publishes the next version of the experiment the draft started from.
|
|
18
|
+
- `move` (`"keep" | "period_end" | "now"`, optional) — What happens to subscribers of earlier versions: keep them, move them at their next renewal, or move them now (features and balance change today, the price at renewal). Nobody moves unless every one of them fits or has a change below. Only when `publishAs` is `current` or `experiment_version`. Defaults to `keep` when `publishAs` is `current` or `experiment_version`.
|
|
19
|
+
- `changes` (`Array<{ subscriptionId: string; keepOnVersion?: true; billingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly"; seatLimit?: true; removeAddonIds?: Array<string>; currency?: string }>`, optional) — Per-subscriber changes that make each one fit, applied at its renewal. Only when `publishAs` is `current` or `experiment_version`. Defaults to `[]` when `publishAs` is `current` or `experiment_version`.
|
|
20
|
+
- `experimentCode` (`string`, optional) — The experiment's own code, after the plan's code. Required when `publishAs` is `experiment`. Ignored when `publishAs` is `current` or `experiment_version`.
|
|
20
21
|
- `preview` (`boolean`, optional) — Check everything without publishing.
|
|
21
|
-
- `experimentCode` (`string`, optional) — The experiment's own code, after the plan's code.
|
|
22
|
-
|
|
23
|
-
### Valid parameter combinations
|
|
24
|
-
|
|
25
|
-
- `publishAs`
|
|
26
|
-
- `publishAs` + `experimentCode`
|
|
27
|
-
- `publishAs`
|
|
28
22
|
|
|
29
23
|
### Request options
|
|
30
24
|
|
|
@@ -64,7 +58,7 @@ Change a draft's prices per interval, trials, the interval shown first, countrie
|
|
|
64
58
|
- `id` (`string`, required)
|
|
65
59
|
- `draftId` (`string`, required)
|
|
66
60
|
- `prices` (`Array<{ billingInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time"; price: number; includedCredits?: number | null; includedBalance?: number | null; trialDays?: number | null; trialRequiresPaymentMethod?: boolean; isDefault?: boolean }>`, optional) — Every interval the draft sells. An interval the draft sold and this list leaves out is removed from the draft.
|
|
67
|
-
- `countries` (`Array<{ country: string; currency: string; exchangeRate?: number | null; prices: Array<{ billingInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time"; price
|
|
61
|
+
- `countries` (`Array<{ country: string; currency: string; exchangeRate?: number | null; prices: Array<{ billingInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time"; price?: number; includedBalance?: number; followBase?: true }>; topUpMinimum?: number | null; maxPlanBalance?: number | null; planBalanceLimit?: number | null; addonPrices?: Array<{ addonId: string; price?: number; followBase?: true }>; creditPackPrices?: Array<{ creditPackId: string; price?: number; followBase?: true }> }>`, optional) — Every country with its own currency or prices. A country the draft sold and this list leaves out is removed. A country missing a price blocks publishing.
|
|
68
62
|
- `rules` (`{ freeIncludedCredits?: number | null; freeIncludedBalance?: number | null; unusedPlanCredits?: "expire" | "roll_over"; maxPlanCredits?: number | null; unlimitedPlanCredits?: boolean; planCreditLimit?: number | null; planCreditLimitInterval?: "day" | "week" | null; unusedPlanBalance?: "expire" | "roll_over"; maxPlanBalance?: number | null; unlimitedPlanBalance?: boolean; planBalanceLimit?: number | null; planBalanceLimitInterval?: "day" | "week" | null; blockOnExhaustion?: boolean; purchasesEnabled?: boolean; creditPurchaseUnitPrice?: number | null; creditPurchaseMinimum?: number | null; topUpMinimum?: number | null }`, optional) — Credit or balance rules; fields left out stay as they are.
|
|
69
63
|
- `undo` (`Array<string>`, optional) — Change keys to put back as the version the draft started from had them.
|
|
70
64
|
|
|
@@ -271,8 +265,8 @@ Update limits, overage, or enabled status of a feature on a plan.
|
|
|
271
265
|
- `id` (`string`, required)
|
|
272
266
|
- `featureId` (`string`, required)
|
|
273
267
|
- `enabled` (`boolean`, optional)
|
|
274
|
-
- `includedAmount` (`number`, optional)
|
|
275
|
-
- `unlimited` (`boolean`, optional)
|
|
268
|
+
- `includedAmount` (`number`, optional) — Must be 0 when `unlimited` is true, sent or already set on the plan feature.
|
|
269
|
+
- `unlimited` (`boolean`, optional) — When true, `includedAmount` must be 0, sent or already set on the plan feature.
|
|
276
270
|
- `overage` (`{ enabled?: boolean; unitPrice?: number }`, optional)
|
|
277
271
|
- `creditsPerUnit` (`number | null`, optional)
|
|
278
272
|
|
|
@@ -312,14 +306,14 @@ Attach a feature to a plan with limits, overage, and credits configuration.
|
|
|
312
306
|
### Parameters
|
|
313
307
|
|
|
314
308
|
- `id` (`string`, required)
|
|
315
|
-
- `featureId` (`string`, required)
|
|
309
|
+
- `featureId` (`string`, required) — The feature's ID (`ftr_…`) or its code.
|
|
316
310
|
- `enabled` (`boolean`, optional)
|
|
317
|
-
- `includedAmount` (`number`, optional)
|
|
318
|
-
- `unlimited` (`boolean`, optional)
|
|
311
|
+
- `includedAmount` (`number`, optional) — Must be 0 when `unlimited` is true.
|
|
312
|
+
- `unlimited` (`boolean`, optional) — When true, `includedAmount` must be 0.
|
|
319
313
|
- `overage` (`{ enabled?: boolean; unitPrice?: number }`, optional)
|
|
320
|
-
- `creditsPerUnit` (`number | null`, optional)
|
|
314
|
+
- `creditsPerUnit` (`number | null`, optional) — Above 0 only on a credits plan.
|
|
321
315
|
- `pricingMode` (`"fixed" | "ai_model"`, optional)
|
|
322
|
-
- `margin` (`number | null`, optional)
|
|
316
|
+
- `margin` (`number | null`, optional) — Required when `overage.enabled` is true, `pricingMode` is `ai_model` and the plan is metered or balance.
|
|
323
317
|
|
|
324
318
|
### Request options
|
|
325
319
|
|
|
@@ -416,17 +410,12 @@ Move a list of subscriptions, or every subscription of another version, to a new
|
|
|
416
410
|
### Parameters
|
|
417
411
|
|
|
418
412
|
- `id` (`string`, required)
|
|
419
|
-
- `subscriptionIds` (`Array<string>`, optional) — Public IDs of the subscriptions to move.
|
|
413
|
+
- `subscriptionIds` (`Array<string>`, optional) — Public IDs of the subscriptions to move. Required unless `fromVersionId` is sent. Cannot be combined with `fromVersionId`.
|
|
414
|
+
- `fromVersionId` (`string`, optional) — Move every active, trialing and past due subscription on this version of the plan. Another version than `toVersionId`. Required unless `subscriptionIds` is sent. Cannot be combined with `subscriptionIds`.
|
|
420
415
|
- `toVersionId` (`string`, required) — The version subscribers move to.
|
|
421
416
|
- `effective` (`"now" | "period_end"`, required) — now changes features and the included amount today and the price at renewal; period_end moves each subscriber at its next renewal.
|
|
422
417
|
- `changes` (`Array<{ subscriptionId: string; keepOnVersion?: true; billingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly"; seatLimit?: true; removeAddonIds?: Array<string>; currency?: string }>`, optional) — Per-subscriber changes that make each one fit, applied at its renewal.
|
|
423
418
|
- `preview` (`boolean`, optional) — Check every subscriber without moving anyone.
|
|
424
|
-
- `fromVersionId` (`string`, optional) — Move every active, trialing and past due subscription on this version of the plan.
|
|
425
|
-
|
|
426
|
-
### Valid parameter combinations
|
|
427
|
-
|
|
428
|
-
- `subscriptionIds` + `toVersionId` + `effective`
|
|
429
|
-
- `fromVersionId` + `toVersionId` + `effective`
|
|
430
419
|
|
|
431
420
|
### Request options
|
|
432
421
|
|
|
@@ -592,19 +581,14 @@ Add a base price or a selectable market price variant. Variants inherit their ba
|
|
|
592
581
|
- `id` (`string`, required)
|
|
593
582
|
- `billingInterval` (`"weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time"`, required)
|
|
594
583
|
- `metadata` (`Record<string, unknown>`, optional)
|
|
595
|
-
- `price` (`number`, optional)
|
|
596
|
-
- `trialDays` (`number`, optional)
|
|
597
|
-
- `trialRequiresPaymentMethod` (`boolean`, optional) — Set to false so the price's free trial starts without a payment method. Requires trialDays on the price.
|
|
598
|
-
- `isDefault` (`boolean`, optional)
|
|
599
|
-
- `includedBalance` (`number | null`, optional)
|
|
600
|
-
- `includedCredits` (`number | null`, optional)
|
|
601
|
-
- `marketPrices` (`Array<{ marketGroupId: string; currency: "usd" | "ars" | "brl" | "clp" | "cop" | "pen" | "uyu" | "pyg" | "bob" | "mxn" | "cad" | "eur" | "gbp" | "jpy" | "cny" | "krw" | "hkd" | "sgd" | "twd" | "inr" | "thb"; price: number }>`, optional)
|
|
602
|
-
- `inheritsFromPriceId` (`string`, optional)
|
|
603
|
-
|
|
604
|
-
### Valid parameter combinations
|
|
605
|
-
|
|
606
|
-
- `billingInterval` + `price`
|
|
607
|
-
- `billingInterval` + `inheritsFromPriceId` + `marketPrices`
|
|
584
|
+
- `price` (`number`, optional) — The base price, in the currency's minor unit. Required unless `inheritsFromPriceId` is sent. Cannot be combined with `inheritsFromPriceId`.
|
|
585
|
+
- `trialDays` (`number`, optional) — Cannot be combined with `inheritsFromPriceId`.
|
|
586
|
+
- `trialRequiresPaymentMethod` (`boolean`, optional) — Set to false so the price's free trial starts without a payment method. Requires trialDays on the price. Cannot be combined with `inheritsFromPriceId`.
|
|
587
|
+
- `isDefault` (`boolean`, optional) — Cannot be combined with `inheritsFromPriceId`.
|
|
588
|
+
- `includedBalance` (`number | null`, optional) — Only on a balance plan. Cannot be combined with `inheritsFromPriceId`.
|
|
589
|
+
- `includedCredits` (`number | null`, optional) — Only on a credits plan. Cannot be combined with `inheritsFromPriceId`.
|
|
590
|
+
- `marketPrices` (`Array<{ marketGroupId: string; currency: "usd" | "ars" | "brl" | "clp" | "cop" | "pen" | "uyu" | "pyg" | "bob" | "mxn" | "cad" | "eur" | "gbp" | "jpy" | "cny" | "krw" | "hkd" | "sgd" | "twd" | "inr" | "thb"; price: number }>`, optional) — Market price overrides. Optional on a base price, where currency pricing remains the fallback elsewhere. Required when `inheritsFromPriceId` is sent.
|
|
591
|
+
- `inheritsFromPriceId` (`string`, optional) — Makes the price a selectable market price variant of this base price. It inherits the base terms and must override at least one market already configured on the base price. Required unless `price` is sent. Cannot be combined with `price`. Cannot be combined with `trialDays`. Cannot be combined with `trialRequiresPaymentMethod`. Cannot be combined with `isDefault`. Cannot be combined with `includedBalance`. Cannot be combined with `includedCredits`.
|
|
608
592
|
|
|
609
593
|
### Request options
|
|
610
594
|
|
|
@@ -669,14 +653,14 @@ Update a plan's name, description, visibility, default status, metadata, overage
|
|
|
669
653
|
- `description` (`string | null`, optional)
|
|
670
654
|
- `metadata` (`Record<string, unknown>`, optional)
|
|
671
655
|
- `isPublic` (`boolean`, optional)
|
|
672
|
-
- `unusedPlanCredits` (`{ type: "expire"
|
|
656
|
+
- `unusedPlanCredits` (`{ type: "expire" | "roll_over"; maxPlanCredits?: number | null }`, optional) — Credits plans only. What happens to unused plan credits at each reset. Changing it publishes a new version of the plan; each subscription stays on its version until moved.
|
|
673
657
|
- `unlimitedPlanCredits` (`boolean`, optional) — Credits plans only. true makes the plan credits unlimited: usage never spends them, only planCreditLimit caps it, and every price includes 0 credits. Changing it publishes a new version of the plan; each subscription stays on its version until moved.
|
|
674
658
|
- `planCreditLimit` (`{ credits: number; interval: "day" | "week" } | null`, optional) — Credits plans only. The most plan credits a subscription spends per day or per week; null removes the limit. Changing it publishes a new version of the plan; each subscription stays on its version until moved.
|
|
675
|
-
- `unusedPlanBalance` (`{ type: "expire"
|
|
659
|
+
- `unusedPlanBalance` (`{ type: "expire" | "roll_over"; maxPlanBalance?: number | null }`, optional) — Balance plans only. What happens to unused plan balance at each reset. Changing it publishes a new version of the plan; each subscription stays on its version until moved.
|
|
676
660
|
- `unlimitedPlanBalance` (`boolean`, optional) — Balance plans only. true makes the plan balance unlimited: usage never spends it, only planBalanceLimit caps it, and every price and country includes no balance. Changing it publishes a new version of the plan; each subscription stays on its version until moved.
|
|
677
661
|
- `planBalanceLimit` (`{ amount: number; interval: "day" | "week" } | null`, optional) — Balance plans only. The most plan balance a subscription spends per day or per week, in USD cents; null removes the limit. Changing it publishes a new version of the plan; each subscription stays on its version until moved.
|
|
678
662
|
- `blockOnExhaustion` (`boolean`, optional) — Credits and balance plans only. false lets usage continue past the plan and purchased amounts and bills the missing amount as overage at the next renewal; a credits plan bills it at the price per credit and needs one. Trials and free plans always stop, so free plans accept only true. Changing it publishes a new version of the plan; each subscription stays on its version until moved.
|
|
679
|
-
- `isDefault` (`boolean`, optional) — Make this plan the default plan of its plan group: customers created with that planGroupId start on it, and a paid plan of the group that ends from the customer portal, a
|
|
663
|
+
- `isDefault` (`boolean`, optional) — Make this plan the default plan of its plan group: customers created with that planGroupId start on it, and a paid plan of the group that ends (a cancellation from the API, dashboard or customer portal, a lost dispute, exhausted dunning or a card-less trial end) moves to it instead of canceling. Requires a free plan in a plan group; replaces the group's previous default plan. false unmarks it.
|
|
680
664
|
|
|
681
665
|
### Request options
|
|
682
666
|
|
|
@@ -833,14 +817,14 @@ Create a new plan with optional consumption model, visibility, plan group assign
|
|
|
833
817
|
- `isPublic` (`boolean`, optional)
|
|
834
818
|
- `isFree` (`boolean`, optional)
|
|
835
819
|
- `blockOnExhaustion` (`boolean`, optional) — Credits and balance plans. Omitted, credits plans and free plans stop usage when the plan and purchased amounts run out, and paid balance plans bill the missing balance as overage. A new credits plan always stops usage: it allows overage only with a price per credit, which is set after creation, and then `PATCH /v1/plans/{id}` turns overage on.
|
|
836
|
-
- `unusedPlanCredits` (`{ type: "expire"
|
|
820
|
+
- `unusedPlanCredits` (`{ type: "expire" | "roll_over"; maxPlanCredits?: number | null }`, optional) — Credits plans only. What happens to unused plan credits at each reset; omitted means they expire.
|
|
837
821
|
- `unlimitedPlanCredits` (`boolean`, optional) — Credits plans only. true makes the plan credits unlimited: usage never spends them, only planCreditLimit caps it, and every price includes 0 credits. Omitted means false.
|
|
838
822
|
- `planCreditLimit` (`{ credits: number; interval: "day" | "week" } | null`, optional) — Credits plans only. The most plan credits a subscription spends per day or per week; omitted or null means no limit.
|
|
839
|
-
- `unusedPlanBalance` (`{ type: "expire"
|
|
823
|
+
- `unusedPlanBalance` (`{ type: "expire" | "roll_over"; maxPlanBalance?: number | null }`, optional) — Balance plans only. What happens to unused plan balance at each reset; omitted means it expires.
|
|
840
824
|
- `unlimitedPlanBalance` (`boolean`, optional) — Balance plans only. true makes the plan balance unlimited: usage never spends it, only planBalanceLimit caps it, and every price and country includes no balance. Omitted means false.
|
|
841
825
|
- `planBalanceLimit` (`{ amount: number; interval: "day" | "week" } | null`, optional) — Balance plans only. The most plan balance a subscription spends per day or per week, in USD cents; omitted or null means no limit.
|
|
842
826
|
- `planGroupId` (`string`, optional)
|
|
843
|
-
- `isDefault` (`boolean`, optional) — Make this plan the default plan of its plan group: customers created with that planGroupId start on it, and a paid plan of the group that ends from the customer portal, a
|
|
827
|
+
- `isDefault` (`boolean`, optional) — Make this plan the default plan of its plan group: customers created with that planGroupId start on it, and a paid plan of the group that ends (a cancellation from the API, dashboard or customer portal, a lost dispute, exhausted dunning or a card-less trial end) moves to it instead of canceling. Requires a free plan with a planGroupId; replaces the group's previous default plan.
|
|
844
828
|
- `metadata` (`Record<string, unknown>`, optional)
|
|
845
829
|
|
|
846
830
|
### Request options
|
|
@@ -4,7 +4,7 @@ API version: `2026-08-27`
|
|
|
4
4
|
|
|
5
5
|
## getUrl
|
|
6
6
|
|
|
7
|
-
`commet.portal.getUrl(params
|
|
7
|
+
`commet.portal.getUrl(params?, options?)`
|
|
8
8
|
|
|
9
9
|
`POST /portal/sessions` · operation `request-portal-access`
|
|
10
10
|
|
|
@@ -12,14 +12,9 @@ Generate a customer portal URL. Exactly one identifier (email or customerId) is
|
|
|
12
12
|
|
|
13
13
|
### Parameters
|
|
14
14
|
|
|
15
|
-
- `email` (`string`, optional)
|
|
15
|
+
- `email` (`string`, optional) — Required unless `customerId` is sent. Cannot be combined with `customerId`.
|
|
16
|
+
- `customerId` (`string`, optional) — Required unless `email` is sent. Cannot be combined with `email`.
|
|
16
17
|
- `returnUrl` (`string`, optional)
|
|
17
|
-
- `customerId` (`string`, optional)
|
|
18
|
-
|
|
19
|
-
### Valid parameter combinations
|
|
20
|
-
|
|
21
|
-
- `email`
|
|
22
|
-
- `customerId`
|
|
23
18
|
|
|
24
19
|
### Request options
|
|
25
20
|
|
|
@@ -8,7 +8,7 @@ API version: `2026-08-27`
|
|
|
8
8
|
|
|
9
9
|
`GET /promo-codes/{id}` · operation `get-promo-code`
|
|
10
10
|
|
|
11
|
-
Retrieve a promo code by its public ID.
|
|
11
|
+
Retrieve a promo code by its public ID or by the code customers enter, in any letter case.
|
|
12
12
|
|
|
13
13
|
### Parameters
|
|
14
14
|
|
|
@@ -33,7 +33,7 @@ Update a promo code's billing interval, redemption limits, expiration, active st
|
|
|
33
33
|
- `maxRedemptions` (`number | null`, optional)
|
|
34
34
|
- `expiresAt` (`string | null`, optional)
|
|
35
35
|
- `active` (`boolean`, optional)
|
|
36
|
-
- `planIds` (`Array<string>`, optional)
|
|
36
|
+
- `planIds` (`Array<string>`, optional) — Each entry is a plan ID (`pln_…`) or a plan code.
|
|
37
37
|
- `firstPurchaseOnly` (`boolean`, optional) — Whether the code only applies to a customer's first purchase: one with no paid invoice above zero and no paid subscription.
|
|
38
38
|
|
|
39
39
|
### Request options
|
|
@@ -76,7 +76,7 @@ Create a distribution code for an existing Offer with one or more sequential dis
|
|
|
76
76
|
- `billingInterval` (`"weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time" | null`, optional)
|
|
77
77
|
- `maxRedemptions` (`number`, optional)
|
|
78
78
|
- `expiresAt` (`string`, optional)
|
|
79
|
-
- `planIds` (`Array<string>`, optional)
|
|
79
|
+
- `planIds` (`Array<string>`, optional) — Each entry is a plan ID (`pln_…`) or a plan code.
|
|
80
80
|
- `firstPurchaseOnly` (`boolean`, optional) — Whether the code only applies to a customer's first purchase: one with no paid invoice above zero and no paid subscription. Defaults to false.
|
|
81
81
|
|
|
82
82
|
### Request options
|
|
@@ -30,13 +30,8 @@ Remove from a customer's quota allowance for a feature. Defaults to 1 if count i
|
|
|
30
30
|
|
|
31
31
|
- `featureCode` (`string`, required)
|
|
32
32
|
- `count` (`number`, optional)
|
|
33
|
-
- `customerId` (`string`, optional)
|
|
34
|
-
- `externalId` (`string`, optional)
|
|
35
|
-
|
|
36
|
-
### Valid parameter combinations
|
|
37
|
-
|
|
38
|
-
- `featureCode` + `customerId`
|
|
39
|
-
- `featureCode` + `externalId`
|
|
33
|
+
- `customerId` (`string`, optional) — Required unless `externalId` is sent. Cannot be combined with `externalId`.
|
|
34
|
+
- `externalId` (`string`, optional) — Required unless `customerId` is sent. Cannot be combined with `customerId`.
|
|
40
35
|
|
|
41
36
|
### Request options
|
|
42
37
|
|
|
@@ -75,13 +70,8 @@ Add to a customer's quota allowance for a feature. Defaults to 1 if count is omi
|
|
|
75
70
|
|
|
76
71
|
- `featureCode` (`string`, required)
|
|
77
72
|
- `count` (`number`, optional)
|
|
78
|
-
- `customerId` (`string`, optional)
|
|
79
|
-
- `externalId` (`string`, optional)
|
|
80
|
-
|
|
81
|
-
### Valid parameter combinations
|
|
82
|
-
|
|
83
|
-
- `featureCode` + `customerId`
|
|
84
|
-
- `featureCode` + `externalId`
|
|
73
|
+
- `customerId` (`string`, optional) — Required unless `externalId` is sent. Cannot be combined with `externalId`.
|
|
74
|
+
- `externalId` (`string`, optional) — Required unless `customerId` is sent. Cannot be combined with `customerId`.
|
|
85
75
|
|
|
86
76
|
### Request options
|
|
87
77
|
|
|
@@ -103,13 +93,8 @@ Set a customer's quota allowance for a feature to an exact value.
|
|
|
103
93
|
|
|
104
94
|
- `featureCode` (`string`, required)
|
|
105
95
|
- `count` (`number`, required)
|
|
106
|
-
- `customerId` (`string`, optional)
|
|
107
|
-
- `externalId` (`string`, optional)
|
|
108
|
-
|
|
109
|
-
### Valid parameter combinations
|
|
110
|
-
|
|
111
|
-
- `featureCode` + `count` + `customerId`
|
|
112
|
-
- `featureCode` + `count` + `externalId`
|
|
96
|
+
- `customerId` (`string`, optional) — Required unless `externalId` is sent. Cannot be combined with `externalId`.
|
|
97
|
+
- `externalId` (`string`, optional) — Required unless `customerId` is sent. Cannot be combined with `customerId`.
|
|
113
98
|
|
|
114
99
|
### Request options
|
|
115
100
|
|