@commet/node 9.1.1 → 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.
@@ -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
 
@@ -11,7 +11,7 @@
11
11
  "platformDocumentation": {
12
12
  "source": "apps/web/content/docs/en",
13
13
  "index": "platform-documentation.md",
14
- "count": 171,
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
 
@@ -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)
@@ -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`.
@@ -0,0 +1,86 @@
1
+ ---
2
+ lastModified: 2026-08-18
3
+ title: "plan_grant.expired"
4
+ description: "A plan grant expired."
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.expired",
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": "expired",
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": "system",
49
+ "revokedAt": null,
50
+ "createdAt": "2026-08-01T00:00:00.000Z",
51
+ "updatedAt": "2026-10-01T00:05: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
+ "id": "gre_9i0j1k2l",
67
+ "type": "expired",
68
+ "reason": "Two-month product evaluation",
69
+ "source": "system",
70
+ "previousExpiresAt": null,
71
+ "expiresAt": "2026-10-01T00:00:00.000Z",
72
+ "duration": null,
73
+ "durationCycles": null,
74
+ "requestedExpiresAt": null,
75
+ "createdAt": "2026-10-01T00:05:00.000Z"
76
+ }
77
+ ]
78
+ }
79
+ }
80
+ ```
81
+
82
+ ## When this fires
83
+
84
+ After an expired Plan Grant is durably closed by billing discovery or while creating its replacement. The payload is the old grant at expiration, and its last timeline event is `expired`.
85
+
86
+ `customer.state_changed` also fires with trigger `plan_access_ended` when billing discovery expires the grant.
@@ -0,0 +1,86 @@
1
+ ---
2
+ lastModified: 2026-08-18
3
+ title: "plan_grant.revoked"
4
+ description: "A plan grant was revoked."
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.revoked",
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": "revoked",
43
+ "duration": "until_revoked",
44
+ "durationCycles": null,
45
+ "startsAt": "2026-08-01T00:00:00.000Z",
46
+ "expiresAt": null,
47
+ "reason": "Evaluation completed",
48
+ "source": "api",
49
+ "revokedAt": "2026-08-20T14:00:00.000Z",
50
+ "createdAt": "2026-08-01T00:00:00.000Z",
51
+ "updatedAt": "2026-08-20T14:00:00.000Z",
52
+ "events": [
53
+ {
54
+ "id": "gre_1a2b3c4d",
55
+ "type": "created",
56
+ "reason": "Open-ended evaluation",
57
+ "source": "api",
58
+ "previousExpiresAt": null,
59
+ "expiresAt": null,
60
+ "duration": "until_revoked",
61
+ "durationCycles": null,
62
+ "requestedExpiresAt": null,
63
+ "createdAt": "2026-08-01T00:00:00.000Z"
64
+ },
65
+ {
66
+ "id": "gre_m3n4o5p6",
67
+ "type": "revoked",
68
+ "reason": "Evaluation completed",
69
+ "source": "api",
70
+ "previousExpiresAt": null,
71
+ "expiresAt": null,
72
+ "duration": null,
73
+ "durationCycles": null,
74
+ "requestedExpiresAt": null,
75
+ "createdAt": "2026-08-20T14:00:00.000Z"
76
+ }
77
+ ]
78
+ }
79
+ }
80
+ ```
81
+
82
+ ## When this fires
83
+
84
+ After an active Plan Grant is manually revoked through the API or dashboard. The payload is the grant at revocation, and its last timeline event is `revoked`.
85
+
86
+ `customer.state_changed` also fires with trigger `plan_access_ended`.
@@ -0,0 +1,86 @@
1
+ ---
2
+ lastModified: 2026-08-18
3
+ title: "plan_grant.updated"
4
+ description: "A plan grant duration changed."
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.updated",
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": "until_date",
44
+ "durationCycles": null,
45
+ "startsAt": "2026-08-01T00:00:00.000Z",
46
+ "expiresAt": "2026-11-15T00:00:00.000Z",
47
+ "reason": "Extended evaluation",
48
+ "source": "dashboard",
49
+ "revokedAt": null,
50
+ "createdAt": "2026-08-01T00:00:00.000Z",
51
+ "updatedAt": "2026-08-15T12: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
+ "id": "gre_5e6f7g8h",
67
+ "type": "updated",
68
+ "reason": "Extended evaluation",
69
+ "source": "dashboard",
70
+ "previousExpiresAt": "2026-10-01T00:00:00.000Z",
71
+ "expiresAt": "2026-11-15T00:00:00.000Z",
72
+ "duration": "until_date",
73
+ "durationCycles": null,
74
+ "requestedExpiresAt": "2026-11-15T00:00:00.000Z",
75
+ "createdAt": "2026-08-15T12:00:00.000Z"
76
+ }
77
+ ]
78
+ }
79
+ }
80
+ ```
81
+
82
+ ## When this fires
83
+
84
+ After an active Plan Grant's duration or deadline is committed. The payload is the grant at that update, and its last timeline event is `updated`.
85
+
86
+ This event does not fire for any other field change.
package/docs/webhooks.md CHANGED
@@ -545,6 +545,102 @@ Aggregate entitlement event answering one question: what can this customer acces
545
545
  - `credits` (`WebhookCreditsBalance | null`, required) — For credits plans: planCredits, purchasedCredits, totalCredits. Null otherwise.
546
546
  - `balance` (`WebhookBalance | null`, required) — For balance plans: currentBalance in rate scale (10000 = $1.00). Null otherwise.
547
547
 
548
+ ## plan_grant.created
549
+
550
+ Fired after a plan grant is durably created. The payload is the grant snapshot at creation.
551
+
552
+ ### Data
553
+
554
+ - `id` (`string`, required) — The public plan grant ID.
555
+ - `customerId` (`string`, required) — The public customer ID.
556
+ - `subscriptionId` (`string`, required) — The public subscription ID.
557
+ - `basePlanId` (`string`, required) — The public ID of the subscribed base plan.
558
+ - `targetPlanId` (`string`, required) — The public ID of the plan whose access was granted.
559
+ - `targetPlanReleaseId` (`string`, required) — The public ID of the immutable target plan release.
560
+ - `status` (`"active" | "expired" | "revoked"`, required) — The plan grant status at this transition.
561
+ - `duration` (`"cycles" | "until_date" | "until_revoked"`, required) — How the plan grant duration is defined at this transition.
562
+ - `durationCycles` (`number | null`, required) — The cycle count when duration is cycles.
563
+ - `startsAt` (`string`, required) — When the plan grant started.
564
+ - `expiresAt` (`string | null`, required) — The effective expiration deadline, if any.
565
+ - `reason` (`string`, required) — The reason recorded for this transition.
566
+ - `source` (`"dashboard" | "api" | "system"`, required) — Where this transition originated.
567
+ - `revokedAt` (`string | null`, required) — When the plan grant was revoked, otherwise null.
568
+ - `createdAt` (`string`, required) — When the plan grant was created.
569
+ - `updatedAt` (`string`, required) — When the represented transition occurred.
570
+ - `events` (`Array<WebhookPlanGrantTimelineEvent>`, required) — The grant timeline through the represented transition.
571
+
572
+ ## plan_grant.updated
573
+
574
+ Fired after a plan grant duration or deadline is durably changed. The payload is the grant snapshot at that update.
575
+
576
+ ### Data
577
+
578
+ - `id` (`string`, required) — The public plan grant ID.
579
+ - `customerId` (`string`, required) — The public customer ID.
580
+ - `subscriptionId` (`string`, required) — The public subscription ID.
581
+ - `basePlanId` (`string`, required) — The public ID of the subscribed base plan.
582
+ - `targetPlanId` (`string`, required) — The public ID of the plan whose access was granted.
583
+ - `targetPlanReleaseId` (`string`, required) — The public ID of the immutable target plan release.
584
+ - `status` (`"active" | "expired" | "revoked"`, required) — The plan grant status at this transition.
585
+ - `duration` (`"cycles" | "until_date" | "until_revoked"`, required) — How the plan grant duration is defined at this transition.
586
+ - `durationCycles` (`number | null`, required) — The cycle count when duration is cycles.
587
+ - `startsAt` (`string`, required) — When the plan grant started.
588
+ - `expiresAt` (`string | null`, required) — The effective expiration deadline, if any.
589
+ - `reason` (`string`, required) — The reason recorded for this transition.
590
+ - `source` (`"dashboard" | "api" | "system"`, required) — Where this transition originated.
591
+ - `revokedAt` (`string | null`, required) — When the plan grant was revoked, otherwise null.
592
+ - `createdAt` (`string`, required) — When the plan grant was created.
593
+ - `updatedAt` (`string`, required) — When the represented transition occurred.
594
+ - `events` (`Array<WebhookPlanGrantTimelineEvent>`, required) — The grant timeline through the represented transition.
595
+
596
+ ## plan_grant.expired
597
+
598
+ Fired after a plan grant is durably expired, whether discovered automatically or while replacing an expired grant.
599
+
600
+ ### Data
601
+
602
+ - `id` (`string`, required) — The public plan grant ID.
603
+ - `customerId` (`string`, required) — The public customer ID.
604
+ - `subscriptionId` (`string`, required) — The public subscription ID.
605
+ - `basePlanId` (`string`, required) — The public ID of the subscribed base plan.
606
+ - `targetPlanId` (`string`, required) — The public ID of the plan whose access was granted.
607
+ - `targetPlanReleaseId` (`string`, required) — The public ID of the immutable target plan release.
608
+ - `status` (`"active" | "expired" | "revoked"`, required) — The plan grant status at this transition.
609
+ - `duration` (`"cycles" | "until_date" | "until_revoked"`, required) — How the plan grant duration is defined at this transition.
610
+ - `durationCycles` (`number | null`, required) — The cycle count when duration is cycles.
611
+ - `startsAt` (`string`, required) — When the plan grant started.
612
+ - `expiresAt` (`string | null`, required) — The effective expiration deadline, if any.
613
+ - `reason` (`string`, required) — The reason recorded for this transition.
614
+ - `source` (`"dashboard" | "api" | "system"`, required) — Where this transition originated.
615
+ - `revokedAt` (`string | null`, required) — When the plan grant was revoked, otherwise null.
616
+ - `createdAt` (`string`, required) — When the plan grant was created.
617
+ - `updatedAt` (`string`, required) — When the represented transition occurred.
618
+ - `events` (`Array<WebhookPlanGrantTimelineEvent>`, required) — The grant timeline through the represented transition.
619
+
620
+ ## plan_grant.revoked
621
+
622
+ Fired after an active plan grant is durably revoked. The payload is the grant snapshot at revocation.
623
+
624
+ ### Data
625
+
626
+ - `id` (`string`, required) — The public plan grant ID.
627
+ - `customerId` (`string`, required) — The public customer ID.
628
+ - `subscriptionId` (`string`, required) — The public subscription ID.
629
+ - `basePlanId` (`string`, required) — The public ID of the subscribed base plan.
630
+ - `targetPlanId` (`string`, required) — The public ID of the plan whose access was granted.
631
+ - `targetPlanReleaseId` (`string`, required) — The public ID of the immutable target plan release.
632
+ - `status` (`"active" | "expired" | "revoked"`, required) — The plan grant status at this transition.
633
+ - `duration` (`"cycles" | "until_date" | "until_revoked"`, required) — How the plan grant duration is defined at this transition.
634
+ - `durationCycles` (`number | null`, required) — The cycle count when duration is cycles.
635
+ - `startsAt` (`string`, required) — When the plan grant started.
636
+ - `expiresAt` (`string | null`, required) — The effective expiration deadline, if any.
637
+ - `reason` (`string`, required) — The reason recorded for this transition.
638
+ - `source` (`"dashboard" | "api" | "system"`, required) — Where this transition originated.
639
+ - `revokedAt` (`string | null`, required) — When the plan grant was revoked, otherwise null.
640
+ - `createdAt` (`string`, required) — When the plan grant was created.
641
+ - `updatedAt` (`string`, required) — When the represented transition occurred.
642
+ - `events` (`Array<WebhookPlanGrantTimelineEvent>`, required) — The grant timeline through the represented transition.
643
+
548
644
  ## credits.granted
549
645
 
550
646
  Fired when non-purchase credits are granted to a subscription: plan-included credits at the start of each billing period, or a manual adjustment from the dashboard. Credit pack purchases fire credits.purchased instead.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commet/node",
3
- "version": "9.1.1",
3
+ "version": "9.2.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",