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