@commet/node 9.1.0 → 9.2.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 +277 -14
- package/dist/index.d.ts +277 -14
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.map +1 -1
- package/docs/api-reference/customers.md +7 -7
- package/docs/api-reference/generated-webhooks.md +2 -2
- package/docs/documentation/choose-a-billing-model.md +2 -2
- package/docs/documentation/subscriptions/manage-subscriptions.md +2 -2
- package/docs/documentation/subscriptions/plan-grants.md +53 -61
- package/docs/documentation/subscriptions/upgrade-and-downgrade-plans.md +3 -1
- package/docs/knowledge-base/how-do-credits-credit-packs-and-customer-credits-differ.md +2 -2
- package/docs/manifest.json +9 -1
- package/docs/platform-documentation.md +4 -0
- package/docs/schemas.md +22 -8
- package/docs/webhooks/customer-state-changed.md +3 -3
- package/docs/webhooks/meta.json +5 -0
- package/docs/webhooks/plan-grant-created.md +74 -0
- package/docs/webhooks/plan-grant-expired.md +86 -0
- package/docs/webhooks/plan-grant-revoked.md +86 -0
- package/docs/webhooks/plan-grant-updated.md +86 -0
- package/docs/webhooks.md +96 -0
- package/package.json +1 -1
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
- `
|
|
156
|
-
- `
|
|
157
|
-
- `
|
|
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
|
|
|
@@ -30,7 +30,7 @@ Update a webhook endpoint. Only the provided fields change.
|
|
|
30
30
|
|
|
31
31
|
- `id` (`string`, required)
|
|
32
32
|
- `url` (`string`, optional)
|
|
33
|
-
- `events` (`Array<"subscription.created" | "subscription.activated" | "subscription.reactivated" | "subscription.canceled" | "subscription.updated" | "subscription.plan_changed" | "subscription.cancellation_scheduled" | "subscription.cancellation_revoked" | "subscription.plan_change_scheduled" | "subscription.plan_change_revoked" | "subscription.past_due" | "trial.started" | "trial.converted" | "trial.expired" | "trial.will_end" | "trial.checkout_ready" | "checkout.ready" | "payment.received" | "payment.failed" | "payment.recovered" | "payment.retry_failed" | "payment.refunded" | "payment.disputed" | "payment.dispute_resolved" | "payment_link.created" | "payment_link.completed" | "payment_link.failed" | "payment_link.canceled" | "invoice.created" | "invoice.voided" | "invoice.overdue" | "invoice.upcoming" | "payment_method.attached" | "payment_method.updated" | "customer.created" | "customer.updated" | "customer.state_changed" | "credits.granted" | "credits.purchased" | "credits.low" | "credits.depleted" | "credits.expired" | "balance.topped_up" | "balance.low" | "balance.depleted" | "quota.threshold_reached" | "quota.exceeded" | "seats.updated" | "seats.limit_reached" | "addon.activated" | "addon.deactivated" | "usage.recorded" | "payout.available" | "payout.created" | "payout.paid" | "payout.failed">`, optional)
|
|
33
|
+
- `events` (`Array<"subscription.created" | "subscription.activated" | "subscription.reactivated" | "subscription.canceled" | "subscription.updated" | "subscription.plan_changed" | "subscription.cancellation_scheduled" | "subscription.cancellation_revoked" | "subscription.plan_change_scheduled" | "subscription.plan_change_revoked" | "subscription.past_due" | "trial.started" | "trial.converted" | "trial.expired" | "trial.will_end" | "trial.checkout_ready" | "checkout.ready" | "payment.received" | "payment.failed" | "payment.recovered" | "payment.retry_failed" | "payment.refunded" | "payment.disputed" | "payment.dispute_resolved" | "payment_link.created" | "payment_link.completed" | "payment_link.failed" | "payment_link.canceled" | "invoice.created" | "invoice.voided" | "invoice.overdue" | "invoice.upcoming" | "payment_method.attached" | "payment_method.updated" | "customer.created" | "customer.updated" | "customer.state_changed" | "plan_grant.created" | "plan_grant.updated" | "plan_grant.expired" | "plan_grant.revoked" | "credits.granted" | "credits.purchased" | "credits.low" | "credits.depleted" | "credits.expired" | "balance.topped_up" | "balance.low" | "balance.depleted" | "quota.threshold_reached" | "quota.exceeded" | "seats.updated" | "seats.limit_reached" | "addon.activated" | "addon.deactivated" | "usage.recorded" | "payout.available" | "payout.created" | "payout.paid" | "payout.failed">`, optional)
|
|
34
34
|
- `description` (`string | null`, optional)
|
|
35
35
|
- `isActive` (`boolean`, optional)
|
|
36
36
|
- `apiVersion` (`string`, optional)
|
|
@@ -107,7 +107,7 @@ Create a new webhook endpoint. The response includes the signing secret which is
|
|
|
107
107
|
### Parameters
|
|
108
108
|
|
|
109
109
|
- `url` (`string`, required)
|
|
110
|
-
- `events` (`Array<"subscription.created" | "subscription.activated" | "subscription.reactivated" | "subscription.canceled" | "subscription.updated" | "subscription.plan_changed" | "subscription.cancellation_scheduled" | "subscription.cancellation_revoked" | "subscription.plan_change_scheduled" | "subscription.plan_change_revoked" | "subscription.past_due" | "trial.started" | "trial.converted" | "trial.expired" | "trial.will_end" | "trial.checkout_ready" | "checkout.ready" | "payment.received" | "payment.failed" | "payment.recovered" | "payment.retry_failed" | "payment.refunded" | "payment.disputed" | "payment.dispute_resolved" | "payment_link.created" | "payment_link.completed" | "payment_link.failed" | "payment_link.canceled" | "invoice.created" | "invoice.voided" | "invoice.overdue" | "invoice.upcoming" | "payment_method.attached" | "payment_method.updated" | "customer.created" | "customer.updated" | "customer.state_changed" | "credits.granted" | "credits.purchased" | "credits.low" | "credits.depleted" | "credits.expired" | "balance.topped_up" | "balance.low" | "balance.depleted" | "quota.threshold_reached" | "quota.exceeded" | "seats.updated" | "seats.limit_reached" | "addon.activated" | "addon.deactivated" | "usage.recorded" | "payout.available" | "payout.created" | "payout.paid" | "payout.failed">`, required)
|
|
110
|
+
- `events` (`Array<"subscription.created" | "subscription.activated" | "subscription.reactivated" | "subscription.canceled" | "subscription.updated" | "subscription.plan_changed" | "subscription.cancellation_scheduled" | "subscription.cancellation_revoked" | "subscription.plan_change_scheduled" | "subscription.plan_change_revoked" | "subscription.past_due" | "trial.started" | "trial.converted" | "trial.expired" | "trial.will_end" | "trial.checkout_ready" | "checkout.ready" | "payment.received" | "payment.failed" | "payment.recovered" | "payment.retry_failed" | "payment.refunded" | "payment.disputed" | "payment.dispute_resolved" | "payment_link.created" | "payment_link.completed" | "payment_link.failed" | "payment_link.canceled" | "invoice.created" | "invoice.voided" | "invoice.overdue" | "invoice.upcoming" | "payment_method.attached" | "payment_method.updated" | "customer.created" | "customer.updated" | "customer.state_changed" | "plan_grant.created" | "plan_grant.updated" | "plan_grant.expired" | "plan_grant.revoked" | "credits.granted" | "credits.purchased" | "credits.low" | "credits.depleted" | "credits.expired" | "balance.topped_up" | "balance.low" | "balance.depleted" | "quota.threshold_reached" | "quota.exceeded" | "seats.updated" | "seats.limit_reached" | "addon.activated" | "addon.deactivated" | "usage.recorded" | "payout.available" | "payout.created" | "payout.paid" | "payout.failed">`, required)
|
|
111
111
|
- `description` (`string`, optional)
|
|
112
112
|
- `apiVersion` (`string`, optional)
|
|
113
113
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-08-
|
|
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
|
|
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-
|
|
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
|
|
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-
|
|
3
|
-
title: Grant
|
|
4
|
-
description:
|
|
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
|
|
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
|
-
|
|
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
|
-
##
|
|
11
|
+
## How access is resolved
|
|
12
12
|
|
|
13
|
-
The
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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` |
|
|
29
|
-
| `until_date` | Ends
|
|
30
|
-
| `until_revoked` | Continues until
|
|
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
|
-
|
|
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
|
|
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
|
-
"
|
|
44
|
-
"
|
|
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
|
-
|
|
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
|
|
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 `
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
97
|
+
## Plan Grants, Offers, trials, and Invoice Credit
|
|
95
98
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
|
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
|
|
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
|
|
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-
|
|
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-
|
|
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** |
|
|
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/manifest.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"platformDocumentation": {
|
|
12
12
|
"source": "apps/web/content/docs/en",
|
|
13
13
|
"index": "platform-documentation.md",
|
|
14
|
-
"count":
|
|
14
|
+
"count": 175,
|
|
15
15
|
"entries": [
|
|
16
16
|
"ai-onboarding/ai-onboarding.md",
|
|
17
17
|
"ai-onboarding/billing-best-practices-skill.md",
|
|
@@ -163,6 +163,10 @@
|
|
|
163
163
|
"webhooks/payout-created.md",
|
|
164
164
|
"webhooks/payout-failed.md",
|
|
165
165
|
"webhooks/payout-paid.md",
|
|
166
|
+
"webhooks/plan-grant-created.md",
|
|
167
|
+
"webhooks/plan-grant-expired.md",
|
|
168
|
+
"webhooks/plan-grant-revoked.md",
|
|
169
|
+
"webhooks/plan-grant-updated.md",
|
|
166
170
|
"webhooks/quota-exceeded.md",
|
|
167
171
|
"webhooks/quota-threshold-reached.md",
|
|
168
172
|
"webhooks/seats-limit-reached.md",
|
|
@@ -1654,6 +1658,10 @@
|
|
|
1654
1658
|
"customer.created",
|
|
1655
1659
|
"customer.updated",
|
|
1656
1660
|
"customer.state_changed",
|
|
1661
|
+
"plan_grant.created",
|
|
1662
|
+
"plan_grant.updated",
|
|
1663
|
+
"plan_grant.expired",
|
|
1664
|
+
"plan_grant.revoked",
|
|
1657
1665
|
"credits.granted",
|
|
1658
1666
|
"credits.purchased",
|
|
1659
1667
|
"credits.low",
|
|
@@ -152,6 +152,10 @@ This documentation snapshot is serialized from the same Platform source used by
|
|
|
152
152
|
- [webhooks/payout-created.md](./webhooks/payout-created.md)
|
|
153
153
|
- [webhooks/payout-failed.md](./webhooks/payout-failed.md)
|
|
154
154
|
- [webhooks/payout-paid.md](./webhooks/payout-paid.md)
|
|
155
|
+
- [webhooks/plan-grant-created.md](./webhooks/plan-grant-created.md)
|
|
156
|
+
- [webhooks/plan-grant-expired.md](./webhooks/plan-grant-expired.md)
|
|
157
|
+
- [webhooks/plan-grant-revoked.md](./webhooks/plan-grant-revoked.md)
|
|
158
|
+
- [webhooks/plan-grant-updated.md](./webhooks/plan-grant-updated.md)
|
|
155
159
|
- [webhooks/quota-exceeded.md](./webhooks/quota-exceeded.md)
|
|
156
160
|
- [webhooks/quota-threshold-reached.md](./webhooks/quota-threshold-reached.md)
|
|
157
161
|
- [webhooks/seats-limit-reached.md](./webhooks/seats-limit-reached.md)
|
package/docs/schemas.md
CHANGED
|
@@ -327,10 +327,10 @@ Generated from Commet API version `2026-07-31`.
|
|
|
327
327
|
|
|
328
328
|
Variants:
|
|
329
329
|
|
|
330
|
-
- `{ code: string; name: string; unitName: string | null; allowed: boolean; type: "boolean"; enabled: boolean; object: "feature_access"; livemode: boolean }`
|
|
331
|
-
- `{ code: string; name: string; unitName: string | null; allowed: boolean; type: "usage"; consumption: { model: "metered"; period: { start: string; end: string }; unitsUsed: number; includedUnits: number; remainingUnits?: number; unlimited: boolean; overage: { enabled: boolean; units: number; unitPrice?: { amount: number; currency: string; scale: 10000 } } } | { model: "credits"; period: { start: string; end: string }; unitsUsed: number; creditsPerUnit: number; creditsConsumed: number; availableUnits: number } | { model: "balance"; period: { start: string; end: string }; unitsUsed: number; spent: { amount: number; currency: string }; availableUnits?: number; unitPrice?: { amount: number; currency: string; scale: 10000 } }; object: "feature_access"; livemode: boolean }`
|
|
332
|
-
- `{ code: string; name: string; unitName: string | null; allowed: boolean; type: "seats"; usage: { period: { start: string; end: string }; unitsUsed: number; includedUnits: number; remainingUnits?: number; unlimited: boolean; overage: { enabled: boolean; units: number; unitPrice?: { amount: number; currency: string; scale: 10000 } } }; object: "feature_access"; livemode: boolean }`
|
|
333
|
-
- `{ code: string; name: string; unitName: string | null; allowed: boolean; type: "quota"; usage: { period: { start: string; end: string }; unitsUsed: number; includedUnits: number; remainingUnits?: number; unlimited: boolean; overage: { enabled: boolean; units: number; unitPrice?: { amount: number; currency: string; scale: 10000 } }; billedUnits: number }; object: "feature_access"; livemode: boolean }`
|
|
330
|
+
- `{ code: string; name: string; unitName: string | null; allowed: boolean; type: "boolean"; enabled: boolean; baseAccess?: { enabled: boolean } | null; object: "feature_access"; livemode: boolean }`
|
|
331
|
+
- `{ code: string; name: string; unitName: string | null; allowed: boolean; type: "usage"; consumption: { model: "metered"; period: { start: string; end: string }; unitsUsed: number; includedUnits: number; remainingUnits?: number; unlimited: boolean; overage: { enabled: boolean; units: number; unitPrice?: { amount: number; currency: string; scale: 10000 } } } | { model: "credits"; period: { start: string; end: string }; unitsUsed: number; creditsPerUnit: number; creditsConsumed: number; availableUnits: number } | { model: "balance"; period: { start: string; end: string }; unitsUsed: number; spent: { amount: number; currency: string }; availableUnits?: number; unitPrice?: { amount: number; currency: string; scale: 10000 } }; baseAccess?: { includedUnits: number; unlimited: boolean } | null; object: "feature_access"; livemode: boolean }`
|
|
332
|
+
- `{ code: string; name: string; unitName: string | null; allowed: boolean; type: "seats"; usage: { period: { start: string; end: string }; unitsUsed: number; includedUnits: number; remainingUnits?: number; unlimited: boolean; overage: { enabled: boolean; units: number; unitPrice?: { amount: number; currency: string; scale: 10000 } } }; baseAccess?: { includedUnits: number; unlimited: boolean } | null; object: "feature_access"; livemode: boolean }`
|
|
333
|
+
- `{ code: string; name: string; unitName: string | null; allowed: boolean; type: "quota"; usage: { period: { start: string; end: string }; unitsUsed: number; includedUnits: number; remainingUnits?: number; unlimited: boolean; overage: { enabled: boolean; units: number; unitPrice?: { amount: number; currency: string; scale: 10000 } }; billedUnits: number }; baseAccess?: { includedUnits: number; unlimited: boolean } | null; object: "feature_access"; livemode: boolean }`
|
|
334
334
|
|
|
335
335
|
### Invoice
|
|
336
336
|
|
|
@@ -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" | "
|
|
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
|
-
- `
|
|
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)
|
|
@@ -735,8 +735,9 @@ Variants:
|
|
|
735
735
|
- `createdAt` (`string`, required)
|
|
736
736
|
- `updatedAt` (`string`, required)
|
|
737
737
|
- `offerApplications` (`Array<SubscriptionOfferApplication>`, required)
|
|
738
|
+
- `planGrant` (`{ id: string; plan: { id: string; name: string }; expiresAt: string | null }`, optional)
|
|
738
739
|
- `consumptionModel` (`ConsumptionModel | null`, required)
|
|
739
|
-
- `features` (`Array<{ code: string; name: string; type: "boolean"; enabled: boolean } | { code: string; name: string; type: "usage"; usage?: { current: number; included: number; overageQuantity: number; overageUnitPrice?: number } } | { code: string; name: string; type: "seats"; usage: { current: number; included: number; overageQuantity: number; overageUnitPrice?: number } } | { code: string; name: string; type: "quota" }>`, required)
|
|
740
|
+
- `features` (`Array<{ code: string; name: string; type: "boolean"; enabled: boolean; baseAccess?: { enabled: boolean } | null } | { code: string; name: string; type: "usage"; usage?: { current: number; included: number; overageQuantity: number; overageUnitPrice?: number; unlimited?: boolean }; baseAccess?: { included: number; unlimited: boolean } | null } | { code: string; name: string; type: "seats"; usage: { current: number; included: number; overageQuantity: number; overageUnitPrice?: number; unlimited?: boolean }; baseAccess?: { included: number; unlimited: boolean } | null } | { code: string; name: string; type: "quota"; usage?: { current: number; included: number; overageQuantity: number; overageUnitPrice?: number; unlimited?: boolean }; baseAccess?: { included: number; unlimited: boolean } | null }>`, required)
|
|
740
741
|
- `credits` (`{ remaining: number; included: number; purchased: number } | null`, required)
|
|
741
742
|
- `balance` (`{ remaining: number; included: number; currency: string } | null`, required)
|
|
742
743
|
- `priceId` (`string | null`, required)
|
|
@@ -973,6 +974,19 @@ Variants:
|
|
|
973
974
|
- `purchasedCredits` (`number`, required)
|
|
974
975
|
- `totalCredits` (`number`, required)
|
|
975
976
|
|
|
977
|
+
### WebhookPlanGrantTimelineEvent
|
|
978
|
+
|
|
979
|
+
- `id` (`string`, required) — The public ID of this plan grant event.
|
|
980
|
+
- `type` (`"created" | "updated" | "expired" | "revoked"`, required) — The durable lifecycle transition recorded by this event.
|
|
981
|
+
- `reason` (`string`, required) — The reason recorded for this transition.
|
|
982
|
+
- `source` (`"dashboard" | "api" | "system"`, required) — Where this transition originated.
|
|
983
|
+
- `previousExpiresAt` (`string | null`, required) — The prior expiration deadline for an update, otherwise null.
|
|
984
|
+
- `expiresAt` (`string | null`, required) — The expiration deadline after this transition, if any.
|
|
985
|
+
- `duration` (`"cycles" | "until_date" | "until_revoked" | null`, required) — The duration selected by a create or update event.
|
|
986
|
+
- `durationCycles` (`number | null`, required) — The selected cycle count when duration is cycles.
|
|
987
|
+
- `requestedExpiresAt` (`string | null`, required) — The requested deadline when duration is until_date.
|
|
988
|
+
- `createdAt` (`string`, required) — When this transition occurred.
|
|
989
|
+
|
|
976
990
|
### WebhookPlanRef
|
|
977
991
|
|
|
978
992
|
- `id` (`string`, required)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-08-
|
|
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
|
|
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
|
|
134
|
+
See [Plan Grants](/docs/plan-grants) for the temporary access lifecycle.
|
package/docs/webhooks/meta.json
CHANGED
|
@@ -50,6 +50,11 @@
|
|
|
50
50
|
"customer-created",
|
|
51
51
|
"customer-updated",
|
|
52
52
|
"customer-state-changed",
|
|
53
|
+
"---Plan Grant Events---",
|
|
54
|
+
"plan-grant-created",
|
|
55
|
+
"plan-grant-updated",
|
|
56
|
+
"plan-grant-expired",
|
|
57
|
+
"plan-grant-revoked",
|
|
53
58
|
"---Credits & Balance Events---",
|
|
54
59
|
"credits-granted",
|
|
55
60
|
"credits-purchased",
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastModified: 2026-08-18
|
|
3
|
+
title: "plan_grant.created"
|
|
4
|
+
description: "A plan grant was created."
|
|
5
|
+
full: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
All webhook payloads follow a consistent top-level structure with event-specific data nested within the `data` object.
|
|
9
|
+
|
|
10
|
+
- `id` (string) — The public plan grant ID.
|
|
11
|
+
- `customerId` (string) — The public customer ID.
|
|
12
|
+
- `subscriptionId` (string) — The public subscription ID.
|
|
13
|
+
- `basePlanId` (string) — The public ID of the subscribed base plan.
|
|
14
|
+
- `targetPlanId` (string) — The public ID of the plan whose access was granted.
|
|
15
|
+
- `targetPlanReleaseId` (string) — The public ID of the immutable target plan release.
|
|
16
|
+
- `status` ("active" | "expired" | "revoked") — The plan grant status at this transition.
|
|
17
|
+
- `duration` ("cycles" | "until\_date" | "until\_revoked") — How the plan grant duration is defined at this transition.
|
|
18
|
+
- `durationCycles` (integer | null) — The cycle count when duration is cycles.
|
|
19
|
+
- `startsAt` (string) — When the plan grant started.
|
|
20
|
+
- `expiresAt` (string | null) — The effective expiration deadline, if any.
|
|
21
|
+
- `reason` (string) — The reason recorded for this transition.
|
|
22
|
+
- `source` ("dashboard" | "api" | "system") — Where this transition originated.
|
|
23
|
+
- `revokedAt` (string | null) — When the plan grant was revoked, otherwise null.
|
|
24
|
+
- `createdAt` (string) — When the plan grant was created.
|
|
25
|
+
- `updatedAt` (string) — When the represented transition occurred.
|
|
26
|
+
- `events` (WebhookPlanGrantTimelineEvent\[]) — The grant timeline through the represented transition.
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"event": "plan_grant.created",
|
|
31
|
+
"timestamp": "2026-06-23T14:30:00.000Z",
|
|
32
|
+
"organizationId": "8f14e45f-ceea-4e7a-9c3d-1c2b3a4d5e6f",
|
|
33
|
+
"mode": "live",
|
|
34
|
+
"apiVersion": "2026-07-31",
|
|
35
|
+
"data": {
|
|
36
|
+
"id": "pgr_1a2b3c4d",
|
|
37
|
+
"customerId": "user_123",
|
|
38
|
+
"subscriptionId": "sub_1a2b3c4d",
|
|
39
|
+
"basePlanId": "pln_starter",
|
|
40
|
+
"targetPlanId": "pln_pro",
|
|
41
|
+
"targetPlanReleaseId": "plr_1a2b3c4d",
|
|
42
|
+
"status": "active",
|
|
43
|
+
"duration": "cycles",
|
|
44
|
+
"durationCycles": 2,
|
|
45
|
+
"startsAt": "2026-08-01T00:00:00.000Z",
|
|
46
|
+
"expiresAt": "2026-10-01T00:00:00.000Z",
|
|
47
|
+
"reason": "Two-month product evaluation",
|
|
48
|
+
"source": "api",
|
|
49
|
+
"revokedAt": null,
|
|
50
|
+
"createdAt": "2026-08-01T00:00:00.000Z",
|
|
51
|
+
"updatedAt": "2026-08-01T00:00:00.000Z",
|
|
52
|
+
"events": [
|
|
53
|
+
{
|
|
54
|
+
"id": "gre_1a2b3c4d",
|
|
55
|
+
"type": "created",
|
|
56
|
+
"reason": "Two-month product evaluation",
|
|
57
|
+
"source": "api",
|
|
58
|
+
"previousExpiresAt": null,
|
|
59
|
+
"expiresAt": "2026-10-01T00:00:00.000Z",
|
|
60
|
+
"duration": "cycles",
|
|
61
|
+
"durationCycles": 2,
|
|
62
|
+
"requestedExpiresAt": null,
|
|
63
|
+
"createdAt": "2026-08-01T00:00:00.000Z"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## When this fires
|
|
71
|
+
|
|
72
|
+
After a Plan Grant is committed through the API or dashboard. The payload is the grant as it existed at creation, and its last timeline event is `created`.
|
|
73
|
+
|
|
74
|
+
`customer.state_changed` also fires with trigger `plan_access_granted`.
|