@commet/node 9.1.0 → 9.1.1

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.
@@ -69,7 +69,7 @@ Grant monetary credit in one currency. Credit is applied FIFO before tax to elig
69
69
 
70
70
  `POST /customers/{id}/plan-grants/{grantId}/revoke` · operation `revoke-plan-grant`
71
71
 
72
- End complimentary access immediately. The next full-price period becomes pending payment and requires checkout; no past period is billed retroactively.
72
+ End expanded access immediately and restore the base plan's limits. The subscription, billing cycle, invoices, and payment state remain unchanged.
73
73
 
74
74
  ### Parameters
75
75
 
@@ -91,7 +91,7 @@ End complimentary access immediately. The next full-price period becomes pending
91
91
 
92
92
  `PATCH /customers/{id}/plan-grants/{grantId}` · operation `update-plan-grant`
93
93
 
94
- Give the grant a remaining number of billing cycles, set an exact deadline, or keep it active until revoked.
94
+ Keep the overlay for a number of the subscription's existing billing cycles, set an exact deadline, or leave it active until revoked. The billing anchor is never reset.
95
95
 
96
96
  ### Parameters
97
97
 
@@ -138,13 +138,13 @@ List the independent audit timeline for paid-plan access granted without checkou
138
138
 
139
139
  `POST /customers/{id}/plan-grants` · operation `create-plan-grant`
140
140
 
141
- Move an active free subscription to an eligible paid plan immediately without checkout, a card, or customer credit. The grant may last for exact billing cycles, until a date, or until revoked.
141
+ Temporarily expand an active subscription's feature access using a higher plan in the same plan group. Billing, prices, periods, invoices, and the base subscription remain unchanged.
142
142
 
143
143
  ### Parameters
144
144
 
145
145
  - `id` (`string`, required)
146
+ - `subscriptionId` (`string`, required)
146
147
  - `planId` (`string`, required)
147
- - `billingInterval` (`"weekly" | "monthly" | "quarterly" | "yearly"`, required)
148
148
  - `reason` (`string`, required)
149
149
  - `duration` (`"cycles" | "until_date" | "until_revoked"`, required)
150
150
  - `durationCycles` (`number`, optional)
@@ -152,9 +152,9 @@ Move an active free subscription to an eligible paid plan immediately without ch
152
152
 
153
153
  ### Valid parameter combinations
154
154
 
155
- - `planId` + `billingInterval` + `reason` + `duration` + `durationCycles`
156
- - `planId` + `billingInterval` + `reason` + `duration` + `expiresAt`
157
- - `planId` + `billingInterval` + `reason` + `duration`
155
+ - `subscriptionId` + `planId` + `reason` + `duration` + `durationCycles`
156
+ - `subscriptionId` + `planId` + `reason` + `duration` + `expiresAt`
157
+ - `subscriptionId` + `planId` + `reason` + `duration`
158
158
 
159
159
  ### Request options
160
160
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- lastModified: 2026-08-16
2
+ lastModified: 2026-08-17
3
3
  title: Choose a Billing Model
4
4
  description: Choose between a recurring plan, usage, credits, balance, seats, quota, and one-time payments.
5
5
  ---
@@ -26,7 +26,7 @@ Start with the value your customer buys, not with an API method. Commet can comb
26
26
  - Use an **add-on** for an optional recurring capability attached to a subscription.
27
27
  - Use a **credit pack** for customer-purchased credits that persist across resets.
28
28
  - Use an **Offer** or **Promo Code** to change the price or phases of a sale without cloning the plan.
29
- - Use a **plan grant** when you want to provide paid-plan access without checkout or invoices.
29
+ - Use a **plan grant** when you want to temporarily expand access without changing the subscription's billing.
30
30
  - Use a **customer credit** for a specific monetary adjustment, not as the plan's normal allowance.
31
31
 
32
32
  ## Model the smallest complete version
@@ -1,5 +1,5 @@
1
1
  ---
2
- lastModified: 2026-08-16
2
+ lastModified: 2026-08-17
3
3
  title: Manage Subscriptions
4
4
  description: Create, retrieve, cancel, uncancel, and reactivate subscriptions with SDK v9.
5
5
  ---
@@ -497,7 +497,7 @@ The selected price is not snapshotted. Future renewals use its current catalog v
497
497
 
498
498
  ## Related
499
499
 
500
- - [Grant Paid-Plan Access Without Checkout](/docs/plan-grants)
500
+ - [Grant Temporary Plan Access](/docs/plan-grants)
501
501
  - [Upgrade and Downgrade Plans](/docs/upgrade-and-downgrade-plans)
502
502
  - [Handle Failed Payments](/docs/handle-failed-payments)
503
503
  - [Regional and Market Pricing](/docs/regional-prices)
@@ -1,62 +1,75 @@
1
1
  ---
2
- lastModified: 2026-08-16
3
- title: Grant Paid-Plan Access Without Checkout
4
- description: Give selected customers paid-plan entitlements for a fixed number of cycles, until a date, or until you revoke access.
2
+ lastModified: 2026-08-17
3
+ title: Grant Temporary Plan Access
4
+ description: Temporarily expand a subscription's features and limits without changing its plan, price, invoice, or billing cycle.
5
5
  ---
6
6
 
7
- Plan Grants move a customer from an active Free subscription to a paid plan without checkout, card details, or Invoice Credit. Use them when you want a selected customer to evaluate the real paid plan rather than a separate promotional plan.
7
+ A Plan Grant temporarily expands an active subscription's access. It does not change the subscription's plan, price, currency, billing anchor, period, invoice, payment method, or status.
8
8
 
9
- The customer receives the target plan's features and limits. Commet keeps the grant and every duration change in a separate audit timeline.
9
+ Use a Plan Grant when a selected customer needs higher limits or additional features for an evaluation, migration, support exception, or negotiated access period without changing what they are billed.
10
10
 
11
- ## Before you create a grant
11
+ ## How access is resolved
12
12
 
13
- The customer must have an active Free subscription. The target must be a paid plan with a default recurring price for the selected billing interval.
13
+ The subscription keeps its immutable base-plan contract. The grant pins an immutable release of a higher plan and combines both contracts:
14
14
 
15
- The grant is eligible when:
15
+ - boolean features are enabled when either contract enables them;
16
+ - included usage, quota, and seat limits use the higher allowance;
17
+ - unlimited access applies when either contract is unlimited; and
18
+ - paid overage is never introduced by the grant.
16
19
 
17
- - the customer has no active add-ons;
18
- - paid non-seat feature overage is disabled;
19
- - a Balance plan blocks usage when its balance is exhausted; and
20
- - the customer's current seats do not already exceed the target plan's included allowance.
20
+ 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.
21
21
 
22
- One-time prices cannot receive Plan Grants.
22
+ ## Eligibility
23
+
24
+ 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.
25
+
26
+ 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:
27
+
28
+ - Credits or Balance consumption;
29
+ - paid overage;
30
+ - AI model pricing; or
31
+ - active subscription add-ons.
32
+
33
+ The target plan may itself be free or paid. Its prices and billing intervals are irrelevant because the grant does not use them.
23
34
 
24
35
  ## Choose a duration
25
36
 
26
- | Duration | Behavior |
27
- | --------------- | ------------------------------------------------------------------------------------------------------------------------- |
28
- | `cycles` | Grants an exact number of the target price's weekly, monthly, quarterly, or yearly billing cycles. |
29
- | `until_date` | Ends access at the exact ISO timestamp you provide. The Dashboard treats the selected date as the end of that day in UTC. |
30
- | `until_revoked` | Continues until you revoke it or replace it with a finite duration. |
37
+ | Duration | Behavior |
38
+ | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
39
+ | `cycles` | Ends on an existing subscription billing boundary. One cycle means the current `currentPeriodEnd`; additional cycles advance from the same billing anchor. |
40
+ | `until_date` | Ends at the exact ISO timestamp provided. The Dashboard treats the selected date as the end of that day in UTC. |
41
+ | `until_revoked` | Continues until it is revoked or changed to a finite duration. |
31
42
 
32
- You can change the duration of an active grant. For example, an unlimited evaluation can later become “one remaining month” by updating it to one monthly cycle.
43
+ Creating or updating a grant never restarts the billing cycle.
33
44
 
34
45
  ## Grant access
35
46
 
36
- Create the grant with the customer's public ID and the paid plan's public ID:
47
+ Create the grant with the customer, active subscription, and target plan public IDs:
37
48
 
38
49
  ```bash
39
50
  curl -X POST https://commet.co/api/v1/customers/cus_xxx/plan-grants \
40
51
  -H "x-api-key: $COMMET_API_KEY" \
52
+ -H "commet-version: 2026-07-31" \
41
53
  -H "Content-Type: application/json" \
42
54
  -d '{
43
- "planId": "pln_starter",
44
- "billingInterval": "monthly",
55
+ "subscriptionId": "sub_xxx",
56
+ "planId": "pln_pro",
45
57
  "duration": "cycles",
46
58
  "durationCycles": 2,
47
59
  "reason": "Selected customer evaluation"
48
60
  }'
49
61
  ```
50
62
 
51
- The subscription moves to the paid plan immediately. Commet creates the plan period without opening checkout or asking for payment credentials.
63
+ Access expands immediately. No checkout, invoice, charge, credit, or subscription plan change is created.
52
64
 
53
65
  ## Update the duration
54
66
 
55
- Use the grant's public ID to change its remaining duration:
67
+ Use the grant public ID to change its remaining duration:
56
68
 
57
69
  ```bash
58
70
  curl -X PATCH https://commet.co/api/v1/customers/cus_xxx/plan-grants/grt_xxx \
59
71
  -H "x-api-key: $COMMET_API_KEY" \
72
+ -H "commet-version: 2026-07-31" \
60
73
  -H "Content-Type: application/json" \
61
74
  -d '{
62
75
  "duration": "until_date",
@@ -65,68 +78,47 @@ curl -X PATCH https://commet.co/api/v1/customers/cus_xxx/plan-grants/grt_xxx \
65
78
  }'
66
79
  ```
67
80
 
68
- You can also send `until_revoked`, or a new `cycles` duration with `durationCycles`.
81
+ You can also send `until_revoked`, or `cycles` with a new `durationCycles` value. A new cycle count is resolved from the subscription's current period and original billing anchor.
69
82
 
70
83
  ## Revoke access
71
84
 
72
- Revocation ends the grant at the time of the request:
85
+ Revocation restores base-plan access immediately:
73
86
 
74
87
  ```bash
75
88
  curl -X POST https://commet.co/api/v1/customers/cus_xxx/plan-grants/grt_xxx/revoke \
76
89
  -H "x-api-key: $COMMET_API_KEY" \
90
+ -H "commet-version: 2026-07-31" \
77
91
  -H "Content-Type: application/json" \
78
92
  -d '{"reason":"Evaluation ended"}'
79
93
  ```
80
94
 
81
- ## Billing lifecycle
82
-
83
- While the grant is active, Commet produces normal plan periods and invoices the paid plan base at `0`. The grant does not consume Invoice Credit, and there is no retroactive charge for covered periods.
84
-
85
- At natural expiration or revocation:
86
-
87
- 1. complimentary access ends;
88
- 2. a new full-price period starts at that instant;
89
- 3. the subscription becomes `pending_payment`; and
90
- 4. Commet creates checkout for the new invoice.
91
-
92
- Commet does not automatically move the customer back to Free. Your integration decides whether to send the customer to checkout or start a Free subscription through the normal [subscription lifecycle](/docs/manage-subscriptions).
95
+ Revocation does not create a full-price obligation, re-anchor the subscription, or move it to `pending_payment`.
93
96
 
94
- If the customer pays, the subscription becomes active and its paid billing cycle remains anchored to the new invoice period. If your integration chooses Free, the customer receives the Free plan's entitlements instead.
97
+ ## Plan Grants, Offers, trials, and Invoice Credit
95
98
 
96
- ## Seats, add-ons, and usage
97
-
98
- The grant covers the paid plan's base price and included entitlements. Seats added after activation keep their independent payment flow.
99
-
100
- Active add-ons and paid non-seat feature overage are not supported during a Plan Grant. Remove those obligations before granting access. A Balance plan must block when its balance is exhausted so it cannot create an uncovered charge.
101
-
102
- ## Plan Grants, Offers, and Invoice Credit
103
-
104
- | Use | Choose |
105
- | -------------------------------------------------------------------------------- | -------------- |
106
- | Give selected customers paid-plan access without checkout or payment credentials | Plan Grant |
107
- | Define reusable commercial pricing or an introductory phase selected at checkout | Offer |
108
- | Reduce the monetary total of recurring invoices in one currency | Invoice Credit |
109
-
110
- These are separate resources: a Plan Grant changes access, an Offer changes pricing terms, and Invoice Credit pays invoice amounts.
99
+ | Need | Use |
100
+ | ---------------------------------------------------------------------- | -------------- |
101
+ | Temporarily expand features or limits without changing billing | Plan Grant |
102
+ | Temporarily change reusable commercial terms | Offer |
103
+ | Delay the first recurring charge as part of the subscription lifecycle | Trial |
104
+ | Reduce invoice totals in one currency | Invoice Credit |
111
105
 
112
106
  ## Keep access in sync
113
107
 
114
- Listen for [`customer.state_changed`](/docs/webhooks/customer-state-changed). `plan_access_granted` reports activation, while `plan_access_ended` reports expiration or revocation and the resulting current state.
115
-
116
- ## Audit grants
108
+ Listen for [`customer.state_changed`](/docs/webhooks/customer-state-changed). `plan_access_granted` reports activation, while `plan_access_ended` reports expiration or revocation.
117
109
 
118
- List the customer's grants to inspect the current status and the complete duration-change timeline:
110
+ List a customer's grants to inspect their status and duration-change timeline:
119
111
 
120
112
  ```bash
121
113
  curl https://commet.co/api/v1/customers/cus_xxx/plan-grants \
122
- -H "x-api-key: $COMMET_API_KEY"
114
+ -H "x-api-key: $COMMET_API_KEY" \
115
+ -H "commet-version: 2026-07-31"
123
116
  ```
124
117
 
125
- See the [Plan Grants API reference](/docs/api-reference/customers/list-plan-grants) for the exact request and response schemas.
118
+ See the [Plan Grants API reference](/docs/api-reference/customers/list-plan-grants) for exact request and response schemas.
126
119
 
127
120
  ## Related
128
121
 
129
122
  - [Manage Subscriptions](/docs/manage-subscriptions)
130
123
  - [Introductory Offers](/docs/introductory-offers)
131
124
  - [Customer State Changed](/docs/webhooks/customer-state-changed)
132
- - [Handle Failed Payments](/docs/handle-failed-payments)
@@ -1,5 +1,5 @@
1
1
  ---
2
- lastModified: 2026-03-28
2
+ lastModified: 2026-08-17
3
3
  title: Upgrade and Downgrade Plans
4
4
  description: How customers change plans through the Customer Portal and dashboard.
5
5
  ---
@@ -19,6 +19,8 @@ Both plans must be in the same [Plan Group](/docs/plan-groups) for customers to
19
19
 
20
20
  An immediate upgrade is rejected with a seat-limit error when the customer's current seats exceed the target plan's included seats for a seat feature that is not unlimited and has overage disabled. Reduce seats first, or pick a plan with enough included seats. Interval-only changes and scheduled downgrades are not affected.
21
21
 
22
+ If you need to expand features or limits temporarily without changing the subscription's plan, price, or billing cycle, use a [Plan Grant](/docs/plan-grants) instead.
23
+
22
24
  ## Dashboard
23
25
 
24
26
  From a customer's subscription detail page, click **Change Plan** and select the new plan. The same upgrade/downgrade rules apply.
@@ -1,5 +1,5 @@
1
1
  ---
2
- lastModified: 2026-08-16
2
+ lastModified: 2026-08-17
3
3
  title: Credits, Credit Packs, and Customer Credits
4
4
  description: Choose the correct credit mechanism based on what the customer receives and how it expires.
5
5
  ---
@@ -11,7 +11,7 @@ These mechanisms share a name but affect different ledgers.
11
11
  | **Plan credits** | Recurring product units included in a Credits plan | Reset with the plan allowance | Usage events |
12
12
  | **Credit pack** | Product units the customer buys | Persists across plan resets | Usage events after recurring credits |
13
13
  | **Customer credit** | Money that reduces eligible recurring invoices in one currency | Optional expiration; consumed FIFO | Invoice calculation before tax |
14
- | **Plan grant** | Access to a paid plan without billing | Ends when revoked or expired | Feature access, not a credit ledger |
14
+ | **Plan grant** | Temporary access beyond the subscribed plan | Ends when revoked or expired | Feature access, not a credit ledger |
15
15
 
16
16
  Use plan credits and packs when the customer thinks in actions such as generations or exports. Use customer credit when the adjustment is monetary, such as USD 25 after a service incident. Use a plan grant when no invoice should exist at all.
17
17
 
package/docs/schemas.md CHANGED
@@ -357,7 +357,7 @@ Variants:
357
357
  - `planName` (`string | null`, required)
358
358
  - `poNumber` (`string | null`, required)
359
359
  - `reference` (`string | null`, required)
360
- - `lineItems` (`Array<{ lineType: "plan_base" | "feature_overage" | "feature_seats" | "feature_quota" | "discount" | "promo_code_discount" | "plan_grant" | "credit" | "balance_overage" | "addon_base" | "one_time"; featureName: string | null; description: string; quantity: number; unitAmount: number; amount: number; includedAmount: number | null; usedAmount: number | null; overageAmount: number | null; discountType: string | null; discountValue: number | null; discountName: string | null; chargeType: "standard" | "advance" | "true_up" }>`, required)
360
+ - `lineItems` (`Array<{ lineType: "plan_base" | "feature_overage" | "feature_seats" | "feature_quota" | "discount" | "promo_code_discount" | "credit" | "balance_overage" | "addon_base" | "one_time"; featureName: string | null; description: string; quantity: number; unitAmount: number; amount: number; includedAmount: number | null; usedAmount: number | null; overageAmount: number | null; discountType: string | null; discountValue: number | null; discountName: string | null; chargeType: "standard" | "advance" | "true_up" }>`, required)
361
361
  - `object` (`"invoice"`, required)
362
362
  - `livemode` (`boolean`, required)
363
363
 
@@ -522,9 +522,9 @@ Variants:
522
522
  - `id` (`string`, required)
523
523
  - `customerId` (`string`, required)
524
524
  - `subscriptionId` (`string`, required)
525
+ - `basePlanId` (`string`, required)
525
526
  - `planId` (`string`, required)
526
- - `planPriceId` (`string`, required)
527
- - `billingInterval` (`"weekly" | "monthly" | "quarterly" | "yearly"`, required)
527
+ - `planReleaseId` (`string`, required)
528
528
  - `status` (`"active" | "expired" | "revoked"`, required)
529
529
  - `duration` (`"cycles" | "until_date" | "until_revoked"`, required)
530
530
  - `durationCycles` (`number | null`, required)
@@ -1,5 +1,5 @@
1
1
  ---
2
- lastModified: 2026-08-16
2
+ lastModified: 2026-08-17
3
3
  title: "customer.state_changed"
4
4
  description: "Aggregate entitlement event — what can this customer access right now."
5
5
  full: true
@@ -124,11 +124,11 @@ Instead of handling every lifecycle event (`subscription.activated`, `subscripti
124
124
  | `credits_depleted` | The subscription ran out of credits. |
125
125
  | `balance_depleted` | The subscription ran out of prepaid balance. |
126
126
  | `quota_exceeded` | Usage passed a feature's included quantity. |
127
- | `plan_access_granted` | A Plan Grant moved the customer from Free to a paid plan without checkout. |
127
+ | `plan_access_granted` | A Plan Grant temporarily expanded the customer's access without changing subscription billing. |
128
128
  | `plan_access_ended` | A Plan Grant expired or was revoked; the payload contains the resulting current state. |
129
129
 
130
130
  ## Handling the payload
131
131
 
132
132
  Use `status` as the access gate (`trialing` and `active` grant access), `features` for per-feature limits, and `credits`/`balance` for consumption headroom on credits/balance plans. The payload reflects the state at delivery time — if two transitions happen back to back, the later event always carries the final state, so processing events in `timestamp` order converges to the correct result.
133
133
 
134
- See [Plan Grants](/docs/plan-grants) for the checkout-free paid-access lifecycle.
134
+ See [Plan Grants](/docs/plan-grants) for the temporary access lifecycle.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commet/node",
3
- "version": "9.1.0",
3
+ "version": "9.1.1",
4
4
  "description": "Commet SDK for Node.js - Billing and usage tracking",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",