@commet/node 9.2.0 → 9.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -51,7 +51,7 @@ Grant monetary credit in one currency. Credit is applied FIFO before tax to elig
51
51
 
52
52
  - `id` (`string`, required)
53
53
  - `amount` (`number`, required) — Amount in the currency's smallest unit.
54
- - `currency` (`"usd" | "ars" | "brl" | "clp" | "cop" | "pen" | "uyu" | "pyg" | "bob" | "mxn" | "cad" | "eur" | "jpy" | "cny" | "krw" | "hkd" | "sgd" | "twd" | "inr" | "thb"`, required)
54
+ - `currency` (`"usd" | "ars" | "brl" | "clp" | "cop" | "pen" | "uyu" | "pyg" | "bob" | "mxn" | "cad" | "eur" | "gbp" | "jpy" | "cny" | "krw" | "hkd" | "sgd" | "twd" | "inr" | "thb"`, required)
55
55
  - `reason` (`string`, required)
56
56
  - `expiresAt` (`string | null`, optional)
57
57
 
@@ -151,7 +151,7 @@ Update a base price or market price variant. Removing a base market override is
151
151
  - `includedBalance` (`number | null`, optional)
152
152
  - `includedCredits` (`number | null`, optional)
153
153
  - `metadata` (`Record<string, unknown>`, optional) — Metadata keys to merge into the existing price metadata.
154
- - `marketPrices` (`Array<{ marketGroupId: string; currency: "usd" | "ars" | "brl" | "clp" | "cop" | "pen" | "uyu" | "pyg" | "bob" | "mxn" | "cad" | "eur" | "jpy" | "cny" | "krw" | "hkd" | "sgd" | "twd" | "inr" | "thb"; price: number }>`, optional)
154
+ - `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)
155
155
 
156
156
  ### Request options
157
157
 
@@ -196,7 +196,7 @@ Add a base price or a selectable market price variant. Variants inherit their ba
196
196
  - `isDefault` (`boolean`, optional)
197
197
  - `includedBalance` (`number | null`, optional)
198
198
  - `includedCredits` (`number | null`, optional)
199
- - `marketPrices` (`Array<{ marketGroupId: string; currency: "usd" | "ars" | "brl" | "clp" | "cop" | "pen" | "uyu" | "pyg" | "bob" | "mxn" | "cad" | "eur" | "jpy" | "cny" | "krw" | "hkd" | "sgd" | "twd" | "inr" | "thb"; price: number }>`, optional)
199
+ - `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)
200
200
  - `inheritsFromPriceId` (`string`, optional)
201
201
 
202
202
  ### Valid parameter combinations
@@ -223,7 +223,7 @@ Configure regional prices and feature overage values for one currency. Currency-
223
223
  ### Parameters
224
224
 
225
225
  - `id` (`string`, required)
226
- - `currency` (`"usd" | "ars" | "brl" | "clp" | "cop" | "pen" | "uyu" | "pyg" | "bob" | "mxn" | "cad" | "eur" | "jpy" | "cny" | "krw" | "hkd" | "sgd" | "twd" | "inr" | "thb"`, required)
226
+ - `currency` (`"usd" | "ars" | "brl" | "clp" | "cop" | "pen" | "uyu" | "pyg" | "bob" | "mxn" | "cad" | "eur" | "gbp" | "jpy" | "cny" | "krw" | "hkd" | "sgd" | "twd" | "inr" | "thb"`, required)
227
227
  - `exchangeRate` (`number`, required)
228
228
  - `prices` (`Array<{ priceId: string; price: number; includedBalance?: number }>`, optional)
229
229
  - `features` (`Array<{ featureId: string; overageUnitPrice: number }>`, optional)
@@ -157,7 +157,7 @@ Purchase a credit pack for a subscription. Charges the customer and adds credits
157
157
 
158
158
  `PUT /subscriptions/{id}/offer` · operation `apply-subscription-offer`
159
159
 
160
- Apply or replace a direct Offer on a subscription's pending payment checkout. The existing checkout URL remains unchanged. Offers whose first phase is a free trial cannot be applied after checkout creation.
160
+ Apply a direct Offer to a subscription. On a pending payment checkout it quotes or replaces the checkout discount and the existing checkout URL remains unchanged. On an active subscription it applies the Offer immediately with its discount phases starting at the next billing cycle; the call is rejected while another applied Offer still has active or upcoming discount phases. Offers with a free trial phase cannot be applied after checkout creation.
161
161
 
162
162
  ### Parameters
163
163
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- lastModified: 2026-07-31
2
+ lastModified: 2026-08-21
3
3
  title: Promotional Offers
4
4
  description: Apply any compatible Offer directly for campaigns, retention, and experiments.
5
5
  ---
@@ -44,6 +44,23 @@ An explicit `offerId` overrides automatic introductory selection. It cannot be c
44
44
 
45
45
  Immediate plan changes, plan-change previews, and supported reactivation flows also accept `offerId`. Scheduled plan changes do not accept an Offer.
46
46
 
47
+ ## Apply it to an active subscription
48
+
49
+ For retention, apply an Offer to a subscription that is already active. The discount phases start at the next billing cycle, so the current period stays untouched and the next invoice carries the discount:
50
+
51
+ ```typescript
52
+ await commet.subscriptions.applyOffer({
53
+ id: 'sub_123',
54
+ offerId: retentionOffer.id,
55
+ })
56
+ ```
57
+
58
+ 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. Offers with a free trial phase cannot be applied to an active subscription, and the discount applies to the plan base price only.
59
+
60
+ The applied Offer belongs to that subscription and plan: it ends with a cancellation and a plan change removes it.
61
+
62
+ The same operation on a subscription with a pending payment checkout quotes or replaces the checkout discount instead; there it accepts an optional `expiresAt` for the quote.
63
+
47
64
  ## Direct application or Promo Code?
48
65
 
49
66
  Use direct `offerId` when your application decides who receives the terms. Use a Promo Code when the customer should enter a code and the campaign needs redemption restrictions.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commet/node",
3
- "version": "9.2.0",
3
+ "version": "9.3.0",
4
4
  "description": "Commet SDK for Node.js - Billing and usage tracking",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",