@commet/node 9.10.0 → 9.12.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 (39) hide show
  1. package/dist/index.d.mts +167 -73
  2. package/dist/index.d.ts +167 -73
  3. package/dist/index.js +16 -13
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +16 -13
  6. package/dist/index.mjs.map +1 -1
  7. package/docs/api-reference/customers.md +3 -3
  8. package/docs/api-reference/features.md +1 -1
  9. package/docs/api-reference/index.md +1 -1
  10. package/docs/api-reference/invoices.md +4 -3
  11. package/docs/api-reference/plans.md +8 -4
  12. package/docs/api-reference/subscriptions.md +10 -6
  13. package/docs/api-reference/transactions.md +2 -1
  14. package/docs/documentation/error-handling.md +11 -0
  15. package/docs/documentation/invoicing/manage-invoices.md +1 -1
  16. package/docs/documentation/plans/add-ons.md +4 -2
  17. package/docs/documentation/plans/balance-and-top-ups.md +3 -1
  18. package/docs/documentation/plans/consumption-models.md +29 -1
  19. package/docs/documentation/plans/credit-packs.md +28 -8
  20. package/docs/documentation/plans/plan-versions.md +9 -7
  21. package/docs/documentation/sales/promotional-offers.md +1 -1
  22. package/docs/documentation/sales/regional-prices.md +1 -1
  23. package/docs/documentation/subscriptions/manage-subscriptions.md +1 -1
  24. package/docs/documentation/subscriptions/plan-grants.md +22 -6
  25. package/docs/errors/currency_held_by_balance_plan.md +22 -0
  26. package/docs/errors/currency_held_by_customer_credit.md +22 -0
  27. package/docs/errors/currency_held_by_fixed_amount_discount.md +22 -0
  28. package/docs/errors/currency_held_by_payment_method.md +22 -0
  29. package/docs/errors/currency_held_by_prepaid_period.md +22 -0
  30. package/docs/errors/currency_held_by_scheduled_pause.md +22 -0
  31. package/docs/errors/index.md +7 -1
  32. package/docs/errors/missing_regional_price.md +3 -3
  33. package/docs/knowledge-base/how-do-discounts-work.md +19 -1
  34. package/docs/knowledge-base/what-happens-when-you-change-your-prices.md +1 -1
  35. package/docs/manifest.json +37 -1
  36. package/docs/schemas.md +30 -16
  37. package/docs/webhooks.md +18 -17
  38. package/docs/webhooks.openapi.json +63 -37
  39. package/package.json +1 -1
@@ -194,7 +194,7 @@ Update a customer's name, external ID, or metadata.
194
194
  - `email` (`string`, optional)
195
195
  - `fullName` (`string`, optional)
196
196
  - `taxDocument` (`string`, optional)
197
- - `businessTaxId` (`string | null`, optional) — Business tax ID, such as an EU VAT number or a Peruvian RUC, for the country of the customer's address. Accepted only where Commet collects tax; a valid ID replaces consumer tax with the business treatment. Send null to remove it.
197
+ - `businessTaxId` (`string | null`, optional) — Business tax ID, such as an EU VAT number, a Peruvian RUC or an Argentine CUIT, for the country of the customer's address; its type comes from that country. Where Commet collects tax and that ID exempts business buyers, a valid ID replaces consumer tax with the business treatment; elsewhere it is stored as sent and does not change any charge. Send null to remove it.
198
198
  - `externalId` (`string`, optional)
199
199
  - `timezone` (`Timezone`, optional)
200
200
  - `metadata` (`Record<string, unknown>`, optional)
@@ -218,7 +218,7 @@ Create up to 100 customers in a single request. With planGroupId, each customer
218
218
 
219
219
  ### Parameters
220
220
 
221
- - `customers` (`Array<{ email: string; id?: string; externalId?: string; fullName?: string; taxDocument?: string; timezone?: Timezone; metadata?: Record<string, unknown>; address?: { line1: string; line2?: string; city: string; state?: string; postalCode: string; country: string; region?: string } }>`, required)
221
+ - `customers` (`Array<{ email: string; id?: string; externalId?: string; fullName?: string; taxDocument?: string; businessTaxId?: string; timezone?: Timezone; metadata?: Record<string, unknown>; address?: { line1: string; line2?: string; city: string; state?: string; postalCode: string; country: string; region?: string } }>`, required)
222
222
  - `planGroupId` (`string`, optional) — Plan group whose starting plan the customer starts on when it has no open subscription: its signup trial, a trial without a payment method, when the group has one and the customer never had that plan, otherwise its default plan. A customer who already had the signup trial plan in a group without a default plan starts on none. Without it, no plan is assigned.
223
223
 
224
224
  ### Request options
@@ -261,7 +261,7 @@ Create a new customer. Idempotent when customerId is provided. With planGroupId,
261
261
  - `externalId` (`string`, optional)
262
262
  - `fullName` (`string`, optional)
263
263
  - `taxDocument` (`string`, optional)
264
- - `businessTaxId` (`string`, optional) — Business tax ID, such as an EU VAT number or a Peruvian RUC, for the country of the customer's address. Accepted only where Commet collects tax; a valid ID replaces consumer tax with the business treatment.
264
+ - `businessTaxId` (`string`, optional) — Business tax ID, such as an EU VAT number, a Peruvian RUC or an Argentine CUIT, for the country of the customer's address; its type comes from that country. Where Commet collects tax and that ID exempts business buyers, a valid ID replaces consumer tax with the business treatment; elsewhere it is stored as sent and does not change any charge.
265
265
  - `address` (`{ line1: string; line2?: string; city: string; state?: string; postalCode: string; country: string; region?: string }`, optional)
266
266
  - `addressId` (`string`, optional)
267
267
  - `email` (`string`, required)
@@ -47,7 +47,7 @@ Update a feature's name, description, or unit name. At least one field must be p
47
47
 
48
48
  `DELETE /features/{code}` · operation `delete-feature`
49
49
 
50
- Delete a feature. Fails if the feature is attached to active plans or has an active add-on.
50
+ Delete a feature. Fails while a plan's current version, a running experiment or a draft includes it, or while it has an active add-on. Subscribers whose plan version includes it keep it, and its code can be used by a new feature right away.
51
51
 
52
52
  ### Parameters
53
53
 
@@ -5,7 +5,7 @@ Generated from Commet API version `2026-08-27`.
5
5
  Use this reference for the exact resources, methods, parameters, and return types available in the installed SDK.
6
6
 
7
7
  - [Schemas](../schemas.md) — generated models and enums
8
- - [API errors](../errors/index.md) — 94 version-matched error references
8
+ - [API errors](../errors/index.md) — 100 version-matched error references
9
9
  - [Addons](./addons.md) — 6 operations
10
10
  - [Api Keys](./api-keys.md) — 3 operations
11
11
  - [Provisioning](./provisioning.md) — 1 operations
@@ -64,12 +64,13 @@ Send the invoice to the customer via email.
64
64
 
65
65
  `PATCH /invoices/{id}/status` · operation `update-invoice-status`
66
66
 
67
- Mark an outstanding invoice as "paid" or "void" and return the updated invoice. Cannot change the status of already paid or voided invoices.
67
+ Deprecated. No longer changes the invoice. An invoice is paid when its charge settles: to collect a past-due subscription, reactivate it or send the customer a recovery link.
68
+
69
+ Deprecated.
68
70
 
69
71
  ### Parameters
70
72
 
71
73
  - `id` (`string`, required)
72
- - `status` (`"paid" | "void"`, required)
73
74
 
74
75
  ### Request options
75
76
 
@@ -77,7 +78,7 @@ Mark an outstanding invoice as "paid" or "void" and return the updated invoice.
77
78
 
78
79
  ### Returns
79
80
 
80
- `Invoice`
81
+ `void`
81
82
 
82
83
  ## list
83
84
 
@@ -16,7 +16,7 @@ Publish a draft as the plan's current version, as a new experiment with its own
16
16
  - `draftId` (`string`, required)
17
17
  - `publishAs` (`"current" | "experiment" | "experiment_version"`, required) — current sells the draft to every new buyer.
18
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> }>`, optional) — Per-subscriber changes that make each one fit, applied at its renewal.
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.
20
20
  - `preview` (`boolean`, optional) — Check everything without publishing.
21
21
  - `experimentCode` (`string`, optional) — The experiment's own code, after the plan's code.
22
22
 
@@ -65,7 +65,7 @@ Change a draft's prices per interval, trials, the interval shown first, countrie
65
65
  - `draftId` (`string`, required)
66
66
  - `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
67
  - `countries` (`Array<{ country: string; currency: string; exchangeRate?: number | null; prices: Array<{ billingInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time"; price: number; includedBalance?: number } | { billingInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time"; followBase: true }>; topUpMinimum?: number | null; maxPlanBalance?: number | null; planBalanceLimit?: number | null; addonPrices?: Array<{ addonId: string; price: number } | { addonId: string; followBase: true }>; creditPackPrices?: Array<{ creditPackId: string; price: number } | { creditPackId: string; 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
- - `rules` (`{ freeIncludedCredits?: number | null; freeIncludedBalance?: number | null; unusedPlanCredits?: "expire" | "roll_over"; maxPlanCredits?: number | null; planCreditLimit?: number | null; planCreditLimitInterval?: "day" | "week" | null; unusedPlanBalance?: "expire" | "roll_over"; maxPlanBalance?: number | null; 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.
68
+ - `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
69
  - `undo` (`Array<string>`, optional) — Change keys to put back as the version the draft started from had them.
70
70
 
71
71
  ### Request options
@@ -143,7 +143,7 @@ Stop selling the experiment. Its code sells the plan's current version from then
143
143
  - `id` (`string`, required)
144
144
  - `code` (`string`, required)
145
145
  - `subscribers` (`"keep" | "period_end" | "now"`, optional) — What happens to the experiment's subscribers: keep them on its versions, move them to the plan's current version at their next renewal, or move them now. Nobody moves, and the experiment keeps running, unless every one of them fits or has a change.
146
- - `changes` (`Array<{ subscriptionId: string; keepOnVersion?: true; billingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly"; seatLimit?: true; removeAddonIds?: Array<string> }>`, optional) — Per-subscriber changes that make each one fit, applied at its renewal.
146
+ - `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.
147
147
  - `preview` (`boolean`, optional) — Check the archive and the move without changing anything.
148
148
 
149
149
  ### Request options
@@ -419,7 +419,7 @@ Move a list of subscriptions, or every subscription of another version, to a new
419
419
  - `subscriptionIds` (`Array<string>`, optional) — Public IDs of the subscriptions to move.
420
420
  - `toVersionId` (`string`, required) — The version subscribers move to.
421
421
  - `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
- - `changes` (`Array<{ subscriptionId: string; keepOnVersion?: true; billingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly"; seatLimit?: true; removeAddonIds?: Array<string> }>`, optional) — Per-subscriber changes that make each one fit, applied at its renewal.
422
+ - `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
423
  - `preview` (`boolean`, optional) — Check every subscriber without moving anyone.
424
424
  - `fromVersionId` (`string`, optional) — Move every active, trialing and past due subscription on this version of the plan.
425
425
 
@@ -670,8 +670,10 @@ Update a plan's name, description, visibility, default status, metadata, overage
670
670
  - `metadata` (`Record<string, unknown>`, optional)
671
671
  - `isPublic` (`boolean`, optional)
672
672
  - `unusedPlanCredits` (`{ type: "expire" } | { type: "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
+ - `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.
673
674
  - `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.
674
675
  - `unusedPlanBalance` (`{ type: "expire" } | { type: "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
+ - `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.
675
677
  - `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.
676
678
  - `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.
677
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 revoked payment authorization or exhausted dunning moves to it instead of canceling. Requires a free plan in a plan group; replaces the group's previous default plan. false unmarks it.
@@ -832,8 +834,10 @@ Create a new plan with optional consumption model, visibility, plan group assign
832
834
  - `isFree` (`boolean`, optional)
833
835
  - `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.
834
836
  - `unusedPlanCredits` (`{ type: "expire" } | { type: "roll_over"; maxPlanCredits: number | null }`, optional) — Credits plans only. What happens to unused plan credits at each reset; omitted means they expire.
837
+ - `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.
835
838
  - `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.
836
839
  - `unusedPlanBalance` (`{ type: "expire" } | { type: "roll_over"; maxPlanBalance: number | null }`, optional) — Balance plans only. What happens to unused plan balance at each reset; omitted means it expires.
840
+ - `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.
837
841
  - `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.
838
842
  - `planGroupId` (`string`, optional)
839
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 revoked payment authorization or exhausted dunning moves to it instead of canceling. Requires a free plan with a planGroupId; replaces the group's previous default plan.
@@ -25,12 +25,13 @@ 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. An add-on that the subscription's plan version does not sell is rejected with addon_unavailable.
28
+ Activate an add-on on a subscription. Creates the activation invoice and charges a prorated amount for the current billing period; the add-on is active once the payment is confirmed. Without a saved payment method, send successUrl to receive a checkout that charges the activation and saves the method. Rejected with 409 while the add-on is active or an activation of it is still processing. An add-on that the subscription's plan version does not sell is rejected with addon_unavailable.
29
29
 
30
30
  ### Parameters
31
31
 
32
32
  - `id` (`string`, required)
33
33
  - `addonId` (`string`, required)
34
+ - `successUrl` (`string`, optional) — Where the customer returns after paying. When it is set and the subscription has no saved payment method, the response has status `requires_checkout` and a `checkoutUrl` where the customer pays this purchase and saves the method in one step. Without it, the request is rejected when there is no saved payment method. A saved method is always charged directly, and a declined charge is rejected either way.
34
35
 
35
36
  ### Request options
36
37
 
@@ -110,12 +111,13 @@ Adjust a subscription's balance or credits by a signed amount. Positive adds, ne
110
111
 
111
112
  `POST /subscriptions/{id}/balance/topup` · operation `topup-balance`
112
113
 
113
- Top up a balance subscription. Charges the customer's payment method for the amount plus tax, adds it to the subscription's purchased balance (after paying back any overage owed on the plan balance), creates its invoice and emits `balance.topped_up`. Purchased balance is spent after the plan balance and is kept until the subscription ends. Rejected with 400 when the subscription is not on a balance plan, its plan has top-ups turned off, or the amount is below the effective minimum: the plan's minimum top-up in the subscription currency, raised to the currency's minimum charge.
114
+ Top up a balance subscription. Creates the top-up invoice and charges the customer's payment method for the amount plus tax. Once the payment is confirmed, adds the amount to the subscription's purchased balance (after paying back any overage owed on the plan balance), marks the invoice paid and emits `balance.topped_up`. Purchased balance is spent after the plan balance and is kept until the subscription ends. Without a saved payment method, send successUrl to receive a checkout that charges the top-up and saves the method. Rejected with 400 when the subscription is not on a balance plan, its plan has top-ups turned off, or the amount is below the effective minimum: the plan's minimum top-up in the subscription currency, raised to the currency's minimum charge.
114
115
 
115
116
  ### Parameters
116
117
 
117
118
  - `id` (`string`, required)
118
119
  - `amount` (`number`, required) — The amount to add, in minor units of the subscription currency (cents; whole units for zero-decimal currencies).
120
+ - `successUrl` (`string`, optional) — Where the customer returns after paying. When it is set and the subscription has no saved payment method, the response has status `requires_checkout` and a `checkoutUrl` where the customer pays this purchase and saves the method in one step. Without it, the request is rejected when there is no saved payment method. A saved method is always charged directly, and a declined charge is rejected either way.
119
121
 
120
122
  ### Request options
121
123
 
@@ -182,13 +184,14 @@ Upgrade or change billing interval immediately, optionally applying an Offer by
182
184
 
183
185
  `POST /subscriptions/{id}/change-version` · operation `change-subscription-version`
184
186
 
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.
187
+ 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 unless currency asks to charge it in USD from its renewal, 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
188
 
187
189
  ### Parameters
188
190
 
189
191
  - `id` (`string`, required)
190
192
  - `planVersionId` (`string`, required) — A published version of the subscription's plan.
191
193
  - `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.
194
+ - `currency` (`string`, optional) — usd to charge the subscription in USD from its next renewal when the version does not sell the currency it pays, or the USD price of its country: it pays the version's USD price for its country, or the USD base price. The whole move then happens at that renewal, even with effective now. Rejected with missing_regional_price when the version still sells what the subscription pays or for another currency, and with a currency_held_by code naming what keeps it in its currency: currency_held_by_payment_method (it pays through dLocal), currency_held_by_customer_credit, currency_held_by_balance_plan, currency_held_by_fixed_amount_discount, currency_held_by_prepaid_period or currency_held_by_scheduled_pause.
192
195
 
193
196
  ### Request options
194
197
 
@@ -204,13 +207,14 @@ Move a subscription to a newer published version of its plan, now or at the end
204
207
 
205
208
  `POST /subscriptions/{id}/credits` · operation `purchase-credits`
206
209
 
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.
210
+ Purchase a fixed credit pack or choose a whole credit quantity at the subscription plan price and minimum. Creates the purchase invoice, charges the saved payment method and adds the purchased credits once the payment is confirmed. Without a saved payment method, send successUrl to receive a checkout that charges the purchase and saves the method. A credit pack that the subscription's plan version does not sell is rejected with credit_pack_unavailable.
208
211
 
209
212
  ### Parameters
210
213
 
211
214
  - `id` (`string`, required)
212
215
  - `creditPackId` (`string`, optional)
213
216
  - `quantity` (`number`, optional)
217
+ - `successUrl` (`string`, optional) — Where the customer returns after paying. When it is set and the subscription has no saved payment method, the response has status `requires_checkout` and a `checkoutUrl` where the customer pays this purchase and saves the method in one step. Without it, the request is rejected when there is no saved payment method. A saved method is always charged directly, and a declined charge is rejected either way.
214
218
 
215
219
  ### Valid parameter combinations
216
220
 
@@ -401,7 +405,7 @@ Preview proration details for an immediate plan change without applying it. Free
401
405
 
402
406
  `POST /subscriptions/{id}/reactivate` · operation `reactivate-subscription`
403
407
 
404
- Reactivates a subscription. A past_due subscription retries its outstanding renewal charge (recovering to active on success). A canceled subscription generates a fresh invoice, charges the saved card, and resets the billing period. On a successful charge the subscription becomes active; a declined charge returns an error with a recoveryUrl in the error details that can be sent to the customer to update their card. A canceled subscription may apply an Offer by offerId; past-due recovery cannot.
408
+ Reactivates a subscription. A past_due subscription retries its outstanding renewal charge (recovering to active on success). A canceled subscription generates a fresh invoice, charges the saved card, and resets the billing period; when that invoice totals zero, for example under an Offer, it is marked paid without a charge and the subscription becomes active at once, still requiring a saved payment method. On a successful charge the subscription becomes active; a declined charge returns an error with a recoveryUrl in the error details that can be sent to the customer to update their card. A canceled subscription may apply an Offer by offerId; past-due recovery cannot.
405
409
 
406
410
  ### Parameters
407
411
 
@@ -573,7 +577,7 @@ Create a subscription for a customer. Commet selects the default price when pric
573
577
  - `priceId` (`string`, optional) — Public price ID. When omitted, Commet selects the default price for the billing interval and still applies its market pricing.
574
578
  - `initialSeats` (`Record<string, number>`, optional)
575
579
  - `provider` (`"stripe" | "commet" | "dlocal" | string`, optional) — Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present.
576
- - `paymentMethodTypes` (`Array<"card" | "oxxo" | "mercado_pago" | "google_pay" | "smartpix">`, optional) — Payment methods the initial checkout may offer. Restricts what the checkout already offers for the buyer's country, currency and payment connection; it never enables a method the connection does not have and never changes routing. When none of them is available to the buyer, the checkout shows that it cannot accept payments.
580
+ - `paymentMethodTypes` (`Array<"card" | "mercado_pago" | "oxxo" | "google_pay" | "smartpix" | "apple_pay" | "link">`, optional) — Payment methods the initial checkout may offer. Restricts what the checkout already offers for the buyer's country, currency and payment connection; it never enables a method the connection does not have and never changes routing. When none of them is available to the buyer, the checkout shows that it cannot accept payments.
577
581
  - `name` (`string`, optional)
578
582
  - `startDate` (`string`, optional)
579
583
  - `successUrl` (`string`, optional)
@@ -8,11 +8,12 @@ API version: `2026-08-27`
8
8
 
9
9
  `POST /transactions/{id}/refund` · operation `refund-transaction`
10
10
 
11
- Issue a full refund and return the provider-neutral refund resource with its actual status.
11
+ Refund a positive amount in the payment currency’s smallest unit, or omit amount to refund the remaining amount. Returns the refund resource with its actual status.
12
12
 
13
13
  ### Parameters
14
14
 
15
15
  - `id` (`string`, required)
16
+ - `amount` (`number`, optional) — Amount returned to the customer, including tax, in the payment currency’s smallest unit. Omit to refund the remainder.
16
17
 
17
18
  ### Request options
18
19
 
@@ -109,6 +109,17 @@ Every current API error includes a stable `code` and a version-matched `doc_url`
109
109
 
110
110
  Keep the `x-request-id` response header when logging or reporting an error. Commet records the same identifier in Platform, allowing the request to be correlated without including credentials or customer data.
111
111
 
112
+ ## Rate Limits
113
+
114
+ Each API key, and each person connected through OAuth, has two limits over a sliding 10-second window. Every request counts toward exactly one of them, so a burst of usage checks never uses up the room your other calls need.
115
+
116
+ | Limit | Routes |
117
+ | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
118
+ | 1,000 requests per 10 seconds | `POST /v1/usage/events`, `POST /v1/usage/check`, `GET /v1/feature-access`, `GET /v1/feature-access/{code}`, `GET /v1/features/{code}`, `GET /v1/active-addons`, `GET /v1/addons/active`, `GET /v1/seats/balance`, `GET /v1/seats/balances`, `GET /v1/subscriptions/active`, `GET /v1/subscriptions/{id}` |
119
+ | 300 requests per 10 seconds | Every other route |
120
+
121
+ Every authenticated response carries `RateLimit-Limit`, the limit of the route you called, and `RateLimit-Remaining`. Above the limit the API answers `429` with the code [`rate_limited`](/docs/api-reference/errors/rate_limited.md), plus `RateLimit-Reset` and `Retry-After` in seconds.
122
+
112
123
  ## Automatic Retries
113
124
 
114
125
  Failed requests retry with exponential backoff (1s → 2s → 4s, max 8s).
@@ -215,7 +215,7 @@ $invoice = $commet->invoices->updateStatus(
215
215
  );
216
216
  ```
217
217
 
218
- Only outstanding invoices can be marked `paid` or `void`. This records an external settlement or a deliberate write-off; it does not create a provider transaction.
218
+ Only outstanding invoices can be marked `paid` or `void`. This records an external settlement or a deliberate write-off; it does not create a provider transaction. A credit purchase, top-up or add-on invoice still awaiting payment confirmation can't be marked `paid` by hand: it is paid when the payment provider confirms the payment. Marking it `void` cancels the purchase; if the payment is confirmed later, it is refunded.
219
219
 
220
220
  ## Send or download
221
221
 
@@ -69,7 +69,7 @@ Add-ons are managed through the dashboard, the customer portal, or the API.
69
69
  | **Activate / deactivate** | Dashboard (subscription detail), Customer Portal, or the API |
70
70
  | **List active add-ons** | API, Dashboard, or Customer Portal |
71
71
 
72
- Activate or deactivate an add-on on a subscription via the SDK. Activation charges the prorated amount for the current period; deactivation stops the feature immediately with no refund.
72
+ Activate or deactivate an add-on on a subscription via the SDK. Activation charges the prorated amount for the current period and the add-on is active once the payment is confirmed: the response's `status` is `active`, or `processing` when the payment method confirms later, such as Pix. Activating it again while that payment is processing returns `409`. Deactivation stops the feature immediately with no refund.
73
73
 
74
74
  ```typescript
75
75
  await commet.subscriptions.activateAddon({
@@ -83,6 +83,8 @@ await commet.subscriptions.deactivateAddon({
83
83
  })
84
84
  ```
85
85
 
86
+ Without a saved payment method, activation returns `400`. Send `successUrl` to receive a `status` of `requires_checkout` and a `checkoutUrl` instead: the customer pays the activation there and saves the payment method in one step, and the add-on is active when the payment is confirmed. An activation with nothing to charge opens no checkout.
87
+
86
88
  REST equivalents: `POST /api/v1/subscriptions/{id}/addons` and `DELETE /api/v1/subscriptions/{id}/addons/{addonId}`. Add-ons themselves support full CRUD through the `addons` resource: `commet.addons.list`, `get`, `create`, `update`, and `delete`.
87
89
 
88
90
  ## Feature access
@@ -219,7 +221,7 @@ When a customer activates a $50/month add-on on day 11 of a 31-day period (20 da
219
221
  | **Prorated** | $50 × (20/31) = **$32.26** |
220
222
  | **Invoice type** | `addon_activation` |
221
223
 
222
- The charge goes through the subscription's payment provider immediately with its own invoice.
224
+ The charge goes through the subscription's payment provider immediately with its own invoice. The add-on activates when the payment is confirmed; a declined payment voids the invoice and leaves the add-on inactive.
223
225
 
224
226
  ### Recurring invoices
225
227
 
@@ -159,7 +159,9 @@ $balanceTopup = $commet->subscriptions->topupBalance(
159
159
  );
160
160
  ```
161
161
 
162
- A top-up charges the payment method attached to the subscription. Customers can also buy balance from the [Customer Portal](/docs/customer-portal).
162
+ A top-up creates its invoice and charges the payment method attached to the subscription. The balance is added once the payment is confirmed: the response's `status` is `succeeded`, or `processing` when the payment method confirms later, such as Pix. A declined payment adds nothing and voids the invoice. Customers can also buy balance from the [Customer Portal](/docs/customer-portal).
163
+
164
+ Without a saved payment method, the request returns `402`. Send `successUrl` to receive a `status` of `requires_checkout` and a `checkoutUrl` instead: the customer pays the top-up there and saves the payment method in one step, and the balance is added when the payment is confirmed. Don't send the top-up again after the customer returns.
163
165
 
164
166
  ## Enforce before spending
165
167
 
@@ -55,7 +55,15 @@ 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. 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.
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.
59
+
60
+ A plan change applies the new plan's setting to the credits the customer holds. An immediate change cuts the current period short, so the credits the previous plan gave for that period do not pass: only what the customer holds above that allocation carries over, and the new plan adds its own. A change applied at the end of the period carries every unused plan credit.
61
+
62
+ ```
63
+ Pro grants 240 credits per month. The customer holds 400 and upgrades today to Studio, which grants 1,000 and rolls over.
64
+
65
+ 400 − 240 = 160 carried → 160 + 1,000 = 1,160
66
+ ```
59
67
 
60
68
  ### Limit plan credit spending
61
69
 
@@ -72,6 +80,26 @@ An event past the limit uses purchased credits. Without enough, [Track Usage](/d
72
80
 
73
81
  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
82
 
83
+ ### Make plan credits unlimited
84
+
85
+ ```bash
86
+ curl -X PATCH https://commet.co/api/v1/plans/pln_xxx \
87
+ -H "x-api-key: $COMMET_API_KEY" \
88
+ -H "Content-Type: application/json" \
89
+ -d '{
90
+ "unlimitedPlanCredits": true,
91
+ "planCreditLimit": { "credits": 300, "interval": "day" }
92
+ }'
93
+ ```
94
+
95
+ With `unlimitedPlanCredits`, usage never spends plan credits: every event is accepted and still recorded per feature, so you see what each customer consumed. An unlimited plan includes no set amount, so every price includes `0` credits and unused credits can't roll over.
96
+
97
+ `planCreditLimit` still applies. Past the limit, purchased credits are spent, then usage is rejected with `402 plan_credit_limit_reached` until the next window. Without a limit, purchased credits are never spent, so the plan sells no credits or packs. Automatic top-ups don't run while plan credits are unlimited.
98
+
99
+ Usage checks, usage events, feature access and the subscription's `credits` report `unlimited: true` and leave out the plan credit numbers. The same field is `unlimitedPlanBalance` on a balance plan. Changing it publishes a new plan version; moving a subscription to an unlimited version at once expires its unused plan credits.
100
+
101
+ In the dashboard, open **Plans**, select a credits plan, and choose **Unlimited** in **Plan credits** under **What's included**. The change goes into a draft until you publish it.
102
+
75
103
  ## Balance
76
104
 
77
105
  Customers pay a base price that becomes their spending balance. Feature usage costs real money deducted from the balance. Overage is charged at period end.
@@ -100,14 +100,32 @@ await commet.subscriptions.purchaseCredits({
100
100
  })
101
101
  ```
102
102
 
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).
103
+ Commet creates the purchase invoice, charges the saved payment method at the price per credit of the subscription's plan version and adds the purchased credits once the payment is confirmed. Send `creditPackId` instead of `quantity` to buy a pack. The response's `status` is `succeeded` when the credits were added, or `processing` when the payment method confirms later, such as Pix: the credits are added and [`credits.purchased`](/docs/webhooks/credits-purchased) fires when the payment is confirmed. A declined payment adds nothing and voids the invoice.
104
104
 
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 |
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, and the request has no `successUrl` |
109
+ | `402 payment_failed` | The charge was declined |
110
+ | `409 credit_pack_unavailable` | The subscription's plan version doesn't sell the pack |
111
+
112
+ ### Customers without a saved payment method
113
+
114
+ Send `successUrl` to let a customer without a saved payment method buy a quantity or a pack. The response's `status` is `requires_checkout`, with a `checkoutUrl` where the customer pays the purchase and saves the payment method in one step:
115
+
116
+ ```typescript
117
+ const purchase = await commet.subscriptions.purchaseCredits({
118
+ id: 'sub_xxx',
119
+ quantity: 500,
120
+ successUrl: 'https://your-app.com/credits',
121
+ })
122
+
123
+ if (purchase.status === 'requires_checkout') {
124
+ redirect(purchase.checkoutUrl)
125
+ }
126
+ ```
127
+
128
+ Nothing is charged until the customer pays. The credits are added and [`credits.purchased`](/docs/webhooks/credits-purchased) fires when the payment is confirmed, so don't send the purchase again after the customer returns. An unpaid checkout expires after 24 hours and leaves nothing owed. A subscription with a saved payment method is charged directly, and a declined charge returns `402` with or without `successUrl`.
111
129
 
112
130
  The effective minimum is the larger of the configured minimum and the smallest quantity that reaches the currency's minimum charge.
113
131
 
@@ -134,6 +152,8 @@ await commet.subscriptions.updateAutoTopUp({
134
152
 
135
153
  Send only the fields that change. Enabling requires a plan with a price per credit. Read the current settings, `status`, `topUpsThisPeriod`, and `lastFailure` with `getAutoTopUp`.
136
154
 
137
- Auto top-up pauses after 3 consecutive failed top-ups, or after one whose charge couldn't be refunded. It resumes when the payment method changes, a credit purchase succeeds, or you save it enabled again.
155
+ While a credit purchase is still processing, auto top-up does not buy again. A top-up confirmed later counts in the period it was triggered; one declined later counts as a failed top-up.
156
+
157
+ Auto top-up pauses after 3 consecutive failed top-ups, or after one whose charge couldn't be refunded. It resumes when the payment method changes, a credit purchase is paid, or you save it enabled again.
138
158
 
139
159
  Customers turn it on and edit it in the [Customer Portal](/docs/customer-portal) under **Auto top-up**. In the dashboard, it appears on the subscription detail.
@@ -124,7 +124,8 @@ A move never prorates or refunds. With `now`, a larger included amount first pay
124
124
 
125
125
  ### What a move keeps
126
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`.
127
+ - **Currency, country, interval, and price.** A move keeps a subscription's currency unless you ask to charge it in USD. 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
+ - **Charge in USD.** When the version doesn't sell the currency a subscriber pays in its country, or the USD price of its country, send `currency: "usd"` with the move: from its next renewal it pays the version's USD price for its country, or the USD base price. The currency changes only at a renewal, even for a move made now, and the usage of the period that closes is charged at the USD base rates of the version it leaves. Nothing is converted: when something keeps the subscription in its currency, the move is refused with a code that names it: `currency_held_by_payment_method` (it pays through dLocal), `currency_held_by_customer_credit`, `currency_held_by_balance_plan`, `currency_held_by_fixed_amount_discount`, `currency_held_by_prepaid_period` or `currency_held_by_scheduled_pause`. The same is checked again at the renewal; if it no longer fits, the move is canceled with that code as the `reason` of `subscription.version_change_canceled`.
128
129
  - **Market prices.** A subscription that pays a Market price keeps paying it.
129
130
  - **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
 
@@ -139,12 +140,13 @@ A move never prorates or refunds. With `now`, a larger included amount first pay
139
140
 
140
141
  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
 
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 |
143
+ | Change | Effect at the subscriber's renewal |
144
+ | --------------------- | --------------------------------------------------------------------------------------------- |
145
+ | `billingInterval` | Moves it to another interval the version sells |
146
+ | `seatLimit: true` | Lowers its seats to the version's limit |
147
+ | `removeAddonIds` | Stops charging the listed add-ons |
148
+ | `currency: "usd"` | Charges it in USD when the version doesn't sell its currency, or the USD price of its country |
149
+ | `keepOnVersion: true` | Leaves it on its version |
148
150
 
149
151
  ```json
150
152
  {
@@ -55,7 +55,7 @@ await commet.subscriptions.applyOffer({
55
55
 
56
56
  Only one Offer applies at a time: while an accepted Offer still has active or upcoming discount phases, a new application is rejected. Once its phases are exhausted, the subscription accepts a new Offer. The discount applies to the plan base price only.
57
57
 
58
- The applied Offer belongs to that subscription and plan: it ends with a cancellation and a plan change removes it.
58
+ The applied Offer belongs to that subscription: it ends with a cancellation, and it [keeps going through a plan change](/docs/how-do-discounts-work#plan-changes) with the cycles it had left.
59
59
 
60
60
  The same operation on a subscription with a pending checkout quotes or replaces the checkout discount instead; there it accepts an optional `expiresAt` for the quote. When the price has a trial, the discount starts after it.
61
61
 
@@ -39,7 +39,7 @@ In the dashboard, the plan's **Regional prices** tab sets prices country by coun
39
39
 
40
40
  Publishing the draft publishes every country together in one plan version. A country missing a price blocks publishing. Through the API, the `countries` block of `PATCH /plans/{id}/drafts/{draftId}` sets the same terms.
41
41
 
42
- A subscriber pays the prices of its own country in its version; a buyer from a country the version doesn't list pays the USD base price. A move to another version never changes a subscription's currency, and a version that doesn't sell it can't receive the subscription. The same applies when a canceled subscription is reactivated on the latest version of what was bought: if that version doesn't sell its currency, reactivation returns `422 missing_regional_price`.
42
+ A subscriber pays the prices of its own country in its version; a buyer from a country the version doesn't list pays the USD base price. A move to another version keeps a subscription's currency, and a version that doesn't sell it can't receive the subscription unless the move charges it in USD from its next renewal (see [Move subscribers](/docs/plan-versions#move-subscribers)). The same applies when a canceled subscription is reactivated on the latest version of what was bought: if that version doesn't sell its currency, reactivation returns `422 missing_regional_price`.
43
43
 
44
44
  ## Create a Market
45
45
 
@@ -549,7 +549,7 @@ curl -X POST https://commet.co/api/v1/subscriptions/sub_xxx/change-version \
549
549
  -d '{"planVersionId":"plr_xxx","effective":"period_end"}'
550
550
  ```
551
551
 
552
- `period_end` changes everything at the next renewal and nothing before it. `now` changes features, limits, and included credits or balance today and the price from the next renewal. A version change never prorates, never changes the subscription's currency, and keeps a free subscription on a free version and a paid one on a paid version. The response is the subscription: after a move made now, `planVersion` shows the new version; after a move at renewal, `scheduledVersionChange` shows the pending one.
552
+ `period_end` changes everything at the next renewal and nothing before it. `now` changes features, limits, and included credits or balance today and the price from the next renewal. A version change never prorates, keeps the subscription's currency unless `currency: "usd"` charges it in USD from its next renewal (then the whole move happens at that renewal, even with `now`), and keeps a free subscription on a free version and a paid one on a paid version. The response is the subscription: after a move made now, `planVersion` shows the new version; after a move at renewal, `scheduledVersionChange` shows the pending one.
553
553
 
554
554
  A trialing subscription moves when its trial ends, so its first charge is on the new version. A past-due one, once it pays, moves at the end of the period it's paying for. `scheduledVersionChange.effectiveAt` shows that date. If the subscription ends or changes to another plan first, it never moves and no version webhook is sent. A one-time subscription never renews, so `period_end` returns `409 invalid_subscription_status`; move it with `now`.
555
555
 
@@ -18,18 +18,30 @@ The subscription keeps its immutable base-plan contract. The grant pins an immut
18
18
 
19
19
  When the grant ends, Commet immediately evaluates access against the base subscription again. Existing seats and recorded usage are not deleted. If the customer is already above a base-plan hard limit, further use is blocked until usage resets, capacity falls below the limit, or the subscription is upgraded normally.
20
20
 
21
+ ## Credits and Balance plans
22
+
23
+ On a Credits or Balance plan, the target plan's terms for plan credits or plan balance apply while the grant lasts: the amount included each period, unused credits or balance carried over and their cap, the daily or weekly limit, and unlimited plan credits or balance. What each unit consumes stays the base plan's: credits per unit, the balance price per unit and AI model margins. A feature only the target plan has uses the target plan's.
24
+
25
+ - When the grant starts, the plan credits or plan balance grow at once by the difference between both included amounts. A Free subscription with 50 of its 93 monthly credits left that is granted Pro, which includes 240, holds 197.
26
+ - Each renewal while the grant is active adds the target plan's included amount with the target plan's carry-over rules.
27
+ - When the grant is revoked or expires mid-period, the plan part goes down by the same difference, without going below zero or removing debt, and the base plan's limit applies again. The next renewal gives the base plan's amount. A grant that ends exactly at a renewal leaves that renewal on the base plan's amount.
28
+ - Purchased credits and balance top-ups keep being sold and charged by the base subscription's plan.
29
+
30
+ A subscription on a plan without a consumption model can be granted a Credits or Balance plan. It consumes the target plan's credits or balance while the grant lasts, and when the grant ends it can no longer use those features.
31
+
21
32
  ## Eligibility
22
33
 
23
34
  The base subscription must be active and recurring. The target plan must belong to the same Plan Group and have a higher `sortOrder` than the base plan.
24
35
 
25
- The initial release supports metered plans with boolean features and hard-capped usage, quota, or seat limits. Commet rejects a grant when either plan uses:
36
+ Grants work on Metered, Credits and Balance plans. Both plans must use the same consumption model, with two exceptions: a plan without a consumption model can be granted a plan of any model, and a Metered plan and a plan without a consumption model can be combined either way. Commet rejects a grant when:
26
37
 
27
- - Credits or Balance consumption;
28
- - paid overage;
29
- - AI model pricing; or
30
- - active subscription add-ons.
38
+ - the base and target plans use different consumption models other than those exceptions;
39
+ - either plan bills paid overage: Metered overage or AI model pricing on a Metered plan, or Credits or Balance that can go negative;
40
+ - the subscription has active add-ons;
41
+ - a Credits or Balance target plan does not sell the subscription's billing interval; or
42
+ - a Balance target plan does not sell the subscription's country and currency, or does not price in that country a usage feature the base plan lacks.
31
43
 
32
- The target plan may itself be free or paid. Its prices and billing intervals are irrelevant because the grant does not use them.
44
+ The target plan may itself be free or paid. It never charges anything: on a Credits or Balance plan, Commet only reads the amount included by its price for the subscription's billing interval.
33
45
 
34
46
  ## Choose a duration
35
47
 
@@ -93,6 +105,10 @@ curl -X POST https://commet.co/api/v1/customers/cus_xxx/plan-grants/grt_xxx/revo
93
105
 
94
106
  Revocation does not create a full-price obligation, re-anchor the subscription, or move it to `pending_payment`.
95
107
 
108
+ ## Change plan during a grant
109
+
110
+ A subscription with an active grant can change plan or billing interval. When the change applies, Commet revokes the grant with source `system` and sends `plan_grant.revoked`. On a Credits or Balance plan, the plan part first goes down by the grant's difference, as on any revocation, and then the change gives the new plan's amounts with its carry-over rules.
111
+
96
112
  ## Plan Grants, Offers, trials, and Invoice Credit
97
113
 
98
114
  | Need | Use |
@@ -0,0 +1,22 @@
1
+ # currency_held_by_balance_plan
2
+
3
+ The subscription is on a balance plan, and its balance is in the currency it pays, so a version move cannot charge it in USD.
4
+
5
+ - **Error type:** `billing_error`
6
+ - **`code`:** `currency_held_by_balance_plan`
7
+ - **API version:** `2026-08-27`
8
+
9
+
10
+ ## What to do
11
+
12
+ Keep the subscription on its version.
13
+
14
+ The response `message`, `param`, and `details` fields describe the condition observed by the specific operation.
15
+
16
+ ## Retry behavior
17
+
18
+ Retry with currency usd once the reason no longer applies; a scheduled move that meets it at renewal is canceled with this code as its reason.
19
+
20
+ ## Correlate the request
21
+
22
+ Keep the `x-request-id` response header when reporting or investigating this error. Platform records the same identifier in its request event, so Commet can locate the exact execution without customer data or credentials.
@@ -0,0 +1,22 @@
1
+ # currency_held_by_customer_credit
2
+
3
+ The customer holds credit in the currency the subscription pays, which applies only to invoices in that currency, so a version move cannot charge it in USD.
4
+
5
+ - **Error type:** `billing_error`
6
+ - **`code`:** `currency_held_by_customer_credit`
7
+ - **API version:** `2026-08-27`
8
+
9
+
10
+ ## What to do
11
+
12
+ Keep the subscription on its version, or move it once that credit is used or revoked.
13
+
14
+ The response `message`, `param`, and `details` fields describe the condition observed by the specific operation.
15
+
16
+ ## Retry behavior
17
+
18
+ Retry with currency usd once the reason no longer applies; a scheduled move that meets it at renewal is canceled with this code as its reason.
19
+
20
+ ## Correlate the request
21
+
22
+ Keep the `x-request-id` response header when reporting or investigating this error. Platform records the same identifier in its request event, so Commet can locate the exact execution without customer data or credentials.