@commet/node 9.9.0 → 9.11.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 +932 -59
- package/dist/index.d.ts +932 -59
- package/dist/index.js +209 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +209 -13
- package/dist/index.mjs.map +1 -1
- package/docs/ai-onboarding/mcp-server.md +2 -0
- package/docs/api-reference/addons.md +3 -1
- package/docs/api-reference/credit-packs.md +3 -1
- package/docs/api-reference/customers.md +3 -3
- package/docs/api-reference/generated-webhooks.md +2 -2
- package/docs/api-reference/index.md +3 -3
- package/docs/api-reference/invoices.md +4 -3
- package/docs/api-reference/plans.md +487 -6
- package/docs/api-reference/subscriptions.md +45 -4
- package/docs/api-reference/transactions.md +2 -1
- package/docs/documentation/api-versioning.md +8 -2
- package/docs/documentation/cli.md +4 -0
- package/docs/documentation/customers/customer-portal.md +2 -2
- package/docs/documentation/invoicing/manage-invoices.md +1 -1
- package/docs/documentation/plans/add-ons.md +16 -5
- package/docs/documentation/plans/balance-and-top-ups.md +1 -1
- package/docs/documentation/plans/consumption-models.md +23 -3
- package/docs/documentation/plans/create-plans.md +5 -1
- package/docs/documentation/plans/credit-packs.md +22 -10
- package/docs/documentation/plans/plan-groups.md +1 -1
- package/docs/documentation/plans/plan-versions.md +267 -0
- package/docs/documentation/sales/regional-prices.md +23 -9
- package/docs/documentation/sales/trial-periods.md +3 -3
- package/docs/documentation/subscriptions/manage-subscriptions.md +50 -13
- package/docs/documentation/subscriptions/upgrade-and-downgrade-plans.md +2 -0
- package/docs/errors/addon_has_activations.md +2 -2
- package/docs/errors/addon_unavailable.md +22 -0
- package/docs/errors/credit_pack_unavailable.md +22 -0
- package/docs/errors/currency_held_by_balance_plan.md +22 -0
- package/docs/errors/currency_held_by_customer_credit.md +22 -0
- package/docs/errors/currency_held_by_fixed_amount_discount.md +22 -0
- package/docs/errors/currency_held_by_payment_method.md +22 -0
- package/docs/errors/currency_held_by_prepaid_period.md +22 -0
- package/docs/errors/currency_held_by_scheduled_pause.md +22 -0
- package/docs/errors/index.md +14 -2
- package/docs/errors/missing_regional_price.md +3 -3
- package/docs/errors/plan_experiment_not_found.md +22 -0
- package/docs/errors/plan_version_not_found.md +22 -0
- package/docs/errors/subscribers_do_not_fit.md +22 -0
- package/docs/errors/version_not_newer.md +22 -0
- package/docs/knowledge-base/how-do-free-plans-work-without-payment.md +4 -3
- package/docs/knowledge-base/how-do-trial-periods-work.md +3 -3
- package/docs/knowledge-base/how-does-billing-work.md +26 -28
- package/docs/knowledge-base/how-does-quota-based-billing-work.md +12 -22
- package/docs/knowledge-base/how-does-seat-based-billing-work.md +12 -22
- package/docs/knowledge-base/what-happens-when-a-customer-changes-plans.md +11 -8
- package/docs/knowledge-base/what-happens-when-you-change-your-prices.md +34 -29
- package/docs/knowledge-base/what-invoices-do-customers-receive-and-when.md +1 -1
- package/docs/manifest.json +227 -2
- package/docs/platform-documentation.md +1 -0
- package/docs/schemas.md +128 -13
- package/docs/webhooks/introduction.md +3 -1
- package/docs/webhooks.md +27 -2
- package/docs/webhooks.openapi.json +231 -1
- package/package.json +1 -1
package/docs/schemas.md
CHANGED
|
@@ -140,6 +140,7 @@ Generated from Commet API version `2026-08-27`.
|
|
|
140
140
|
- `includedUnits` (`number | null`, required)
|
|
141
141
|
- `overageRate` (`number | null`, required)
|
|
142
142
|
- `creditCost` (`number | null`, required)
|
|
143
|
+
- `planIds` (`Array<string>`, required) — Plans that sell the add-on.
|
|
143
144
|
- `object` (`"addon"`, required)
|
|
144
145
|
- `livemode` (`boolean`, required)
|
|
145
146
|
|
|
@@ -165,6 +166,7 @@ Generated from Commet API version `2026-08-27`.
|
|
|
165
166
|
### BalanceTopup
|
|
166
167
|
|
|
167
168
|
- `amount` (`number`, required)
|
|
169
|
+
- `status` (`"succeeded" | "processing"`, required) — `succeeded` when the payment was confirmed and the balance was added. `processing` when the payment method confirms later: the balance is added once the payment is confirmed, and nothing is added if it is declined.
|
|
168
170
|
- `object` (`"balance_topup"`, required)
|
|
169
171
|
- `livemode` (`boolean`, required)
|
|
170
172
|
|
|
@@ -214,6 +216,7 @@ Generated from Commet API version `2026-08-27`.
|
|
|
214
216
|
- `hasPaymentMethod` (`boolean`, required) — Whether Commet can charge this subscription on its own at its next charge (the trial end or the renewal). A trial that started without a payment method reports false until the customer adds one for this subscription; a payment method saved for another subscription does not count. A subscription on a free plan reports false.
|
|
215
217
|
- `createdAt` (`string`, required)
|
|
216
218
|
- `updatedAt` (`string`, required)
|
|
219
|
+
- `planVersion` (`{ id: string; label: string } | null`, required) — The plan version whose terms the subscription has now. It keeps paying and receiving everything from this version until it is moved.
|
|
217
220
|
- `offerApplications` (`Array<SubscriptionOfferApplication>`, required)
|
|
218
221
|
- `pause` (`{ status: "scheduled"; mode: "period_end"; requestedAt: string; effectiveAt: string; resumeAt: string | null } | { status: "active"; mode: "immediate" | "period_end"; requestedAt: string; effectiveAt: string; resumeAt: string | null } | null`, required)
|
|
219
222
|
- `checkoutProvider` (`PaymentProvider | null`, required) — Payment provider resolved for this checkout when the subscription response was created. This is an informational snapshot and may differ when the checkout is loaded if its country or the organization's routing changes.
|
|
@@ -237,6 +240,7 @@ Generated from Commet API version `2026-08-27`.
|
|
|
237
240
|
### CreditGrant
|
|
238
241
|
|
|
239
242
|
- `credits` (`number`, required)
|
|
243
|
+
- `status` (`"succeeded" | "processing"`, required) — `succeeded` when the payment was confirmed and the credits were added. `processing` when the payment method confirms later: the credits are added once the payment is confirmed, and nothing is added if it is declined.
|
|
240
244
|
- `object` (`"credit_grant"`, required)
|
|
241
245
|
- `livemode` (`boolean`, required)
|
|
242
246
|
|
|
@@ -247,6 +251,7 @@ Generated from Commet API version `2026-08-27`.
|
|
|
247
251
|
- `description` (`string | null`, required)
|
|
248
252
|
- `credits` (`number`, required)
|
|
249
253
|
- `price` (`number`, required)
|
|
254
|
+
- `planIds` (`Array<string>`, required) — Plans that sell the credit pack.
|
|
250
255
|
- `isActive` (`boolean`, required)
|
|
251
256
|
- `createdAt` (`string`, required)
|
|
252
257
|
- `updatedAt` (`string`, required)
|
|
@@ -260,6 +265,7 @@ Generated from Commet API version `2026-08-27`.
|
|
|
260
265
|
- `description` (`string | null`, required)
|
|
261
266
|
- `credits` (`number`, required)
|
|
262
267
|
- `price` (`number`, required)
|
|
268
|
+
- `planIds` (`Array<string>`, required) — Plans that sell the credit pack.
|
|
263
269
|
- `currency` (`string`, required)
|
|
264
270
|
- `object` (`"credit_pack"`, required)
|
|
265
271
|
- `livemode` (`boolean`, required)
|
|
@@ -283,7 +289,7 @@ Generated from Commet API version `2026-08-27`.
|
|
|
283
289
|
### CustomerBatch
|
|
284
290
|
|
|
285
291
|
- `successful` (`Array<{ id: string; externalId: string | null; email: string }>`, required)
|
|
286
|
-
- `failed` (`Array<{ index: number; error: string; data: { id?: string; externalId?: string; email: string; fullName?: string | null; taxDocument?: string | null; timezone?: string; metadata?: Record<string, unknown> | null; address?: { line1: string; line2?: string; city: string; state?: string; postalCode: string; country: string; region?: string } } }>`, required)
|
|
292
|
+
- `failed` (`Array<{ index: number; error: string; data: { id?: string; externalId?: string; email: string; fullName?: string | null; taxDocument?: string | null; businessTaxId?: string; timezone?: string; metadata?: Record<string, unknown> | null; address?: { line1: string; line2?: string; city: string; state?: string; postalCode: string; country: string; region?: string } } }>`, required)
|
|
287
293
|
- `object` (`"customer_batch"`, required)
|
|
288
294
|
- `livemode` (`boolean`, required)
|
|
289
295
|
|
|
@@ -357,7 +363,7 @@ Generated from Commet API version `2026-08-27`.
|
|
|
357
363
|
Variants:
|
|
358
364
|
|
|
359
365
|
- `{ code: string; name: string; unitName: string | null; allowed: boolean; type: "boolean"; enabled: boolean; baseAccess?: { enabled: boolean } | null; object: "feature_access"; livemode: boolean }`
|
|
360
|
-
- `{ 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;
|
|
366
|
+
- `{ 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; unlimited: boolean; availableUnits?: number } | { model: "balance"; period: { start: string; end: string }; unitsUsed: number; spent: { amount: number; currency: string }; unlimited: boolean; availableUnits?: number; unitPrice?: { amount: number; currency: string; scale: 10000 } }; baseAccess?: { includedUnits: number; unlimited: boolean } | null; object: "feature_access"; livemode: boolean }`
|
|
361
367
|
- `{ 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 }`
|
|
362
368
|
- `{ 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 }`
|
|
363
369
|
|
|
@@ -421,6 +427,13 @@ Variants:
|
|
|
421
427
|
- `object` (`"invoice"`, required)
|
|
422
428
|
- `livemode` (`boolean`, required)
|
|
423
429
|
|
|
430
|
+
### KeptOnVersion
|
|
431
|
+
|
|
432
|
+
- `subscriptionId` (`string`, required)
|
|
433
|
+
- `keptOnVersion` (`true`, required)
|
|
434
|
+
- `object` (`"kept_on_version"`, required)
|
|
435
|
+
- `livemode` (`boolean`, required)
|
|
436
|
+
|
|
424
437
|
### ManagedBy
|
|
425
438
|
|
|
426
439
|
Variants:
|
|
@@ -523,8 +536,10 @@ Variants:
|
|
|
523
536
|
- `isFree` (`boolean`, required)
|
|
524
537
|
- `blockOnExhaustion` (`boolean | null`, required) — Credits and balance plans: true stops usage when the plan and purchased amounts run out; false lets usage continue and bills the missing amount as overage at the next renewal (credits at the price per credit). Trials and free plans always stop.
|
|
525
538
|
- `unusedPlanCredits` (`{ type: "expire" } | { type: "roll_over"; maxPlanCredits: number | null } | null`, required) — Credits plans only; null for other consumption models. What happens to unused plan credits at each reset. Purchased credits never expire and never count toward maxPlanCredits.
|
|
539
|
+
- `unlimitedPlanCredits` (`boolean | null`, required) — Credits plans only; null for other consumption models. true when the plan credits are unlimited: usage never spends them and only planCreditLimit caps it.
|
|
526
540
|
- `planCreditLimit` (`{ credits: number; interval: "day" | "week" } | null`, required) — Credits plans only. The most plan credits a subscription spends per day or per week; null means no limit.
|
|
527
541
|
- `unusedPlanBalance` (`{ type: "expire" } | { type: "roll_over"; maxPlanBalance: number | null } | null`, required) — Balance plans only; null for other consumption models. What happens to unused plan balance at each reset. Purchased balance never expires and never counts toward maxPlanBalance.
|
|
542
|
+
- `unlimitedPlanBalance` (`boolean | null`, required) — Balance plans only; null for other consumption models. true when the plan balance is unlimited: usage never spends it and only planBalanceLimit caps it.
|
|
528
543
|
- `planBalanceLimit` (`{ amount: number; interval: "day" | "week" } | null`, required) — Balance plans only. The most plan balance a subscription spends per day or per week, in USD cents; null means no limit.
|
|
529
544
|
- `sortOrder` (`number`, required)
|
|
530
545
|
- `planGroupId` (`string | null`, required)
|
|
@@ -534,6 +549,7 @@ Variants:
|
|
|
534
549
|
- `features` (`Array<{ code: string; name: string; type: FeatureType; unitName: string | null; enabled: boolean; includedAmount: number | null; unlimited: boolean; overage: { enabled: boolean; model: "per_unit" | null; unitPrice: number | null } | null; regionalPrices: Array<{ currency: string; overageUnitPrice: number | null; autoSynced: boolean }> }>`, required)
|
|
535
550
|
- `prices` (`Array<{ id: string; billingInterval: BillingInterval; price: number; isDefault: boolean; trialDays: number; trialRequiresPaymentMethod: boolean | null; includedBalance: number | null; includedCredits: number | null; offerId: string | null; inheritsFromPriceId: string | null; metadata: Record<string, unknown>; marketPrices: Array<{ marketGroupId: string; currency: string; price: number }>; regionalPrices: Array<{ currency: string; price: number; includedBalance: number | null; autoSynced: boolean }> }>`, required)
|
|
536
551
|
- `exchangeRates` (`Array<{ currency: string; exchangeRate: number }>`, required)
|
|
552
|
+
- `countries` (`Array<{ country: string; currency: string; prices: Array<{ billingInterval: BillingInterval; price: number; manual: boolean }>; addons: Array<{ addonId: string; price: number; manual: boolean }>; creditPacks: Array<{ creditPackId: string; price: number; manual: boolean }> }>`, required) — Countries with their own currency or prices in the current version. Buyers from any other country pay the USD prices.
|
|
537
553
|
- `object` (`"plan"`, required)
|
|
538
554
|
- `livemode` (`boolean`, required)
|
|
539
555
|
|
|
@@ -545,6 +561,46 @@ Variants:
|
|
|
545
561
|
- `{ outcome: "scheduled"; id: string; scheduled: true; scheduledFor: string; changeType: "subscription.plan_downgrade" | "subscription.interval_change" | "subscription.cancel"; customerId: string; newPlanId?: string; newPlanName?: string; newBillingInterval?: string; seatLimitWarning?: { featureCode: string; featureName: string; currentSeats: number; included: number; newPlanName: string; effectiveDate: string }; object: "plan_change"; livemode: boolean }`
|
|
546
562
|
- `{ outcome: "completed"; id: string; scheduled: false; customerId: string; previousPlan: { id: string; name: string }; currentPlan: { id: string; name: string; price: number }; billingInterval: string; billing: { credit: number; creditsApplied: number; charge: number; taxAmount: number; netAmount: number; totalCharged: number; remainingCreditBalance: number }; invoiceId?: string; offerApplication?: { id: string; offerId: string; name: string; currency: string; subtotal: number; discountAmount: number; total: number; phases: Array<{ type: "free_trial"; durationDays: number; startsAt: string | null; endsAt: string | null } | { type: "percentage"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; startsAt: string | null; endsAt: string | null; percentage: number } | { type: "amount_off"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; startsAt: string | null; endsAt: string | null; amount: number } | { type: "fixed_price"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; startsAt: string | null; endsAt: string | null; price: number }>; appliesTo: { type: "plan_price"; id: string } | { type: "addon"; id: string } | { type: "credit_pack"; id: string } }; object: "plan_change"; livemode: boolean }`
|
|
547
563
|
|
|
564
|
+
### PlanDraft
|
|
565
|
+
|
|
566
|
+
- `id` (`string`, required) — Public plan draft ID.
|
|
567
|
+
- `fromVersionId` (`string`, required) — The version the draft started from.
|
|
568
|
+
- `changes` (`Array<{ key: string; section: string; country: string | null; label: string; before: string | null; after: string | null }>`, required) — What the draft changes against the version it started from.
|
|
569
|
+
- `createdAt` (`string`, required)
|
|
570
|
+
- `updatedAt` (`string`, required)
|
|
571
|
+
- `object` (`"plan_draft"`, required)
|
|
572
|
+
- `livemode` (`boolean`, required)
|
|
573
|
+
|
|
574
|
+
### PlanDraftPublication
|
|
575
|
+
|
|
576
|
+
- `preview` (`boolean`, required)
|
|
577
|
+
- `version` (`{ id: string; label: string; number: number | null; experiment: { code: string; version: number } | null; isCurrent: boolean; parentVersionId: string | null; subscriptionCount: number; maxPlanCredits: number | null; maxPlanBalance: number | null; prices: Array<{ id: string; billingInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time"; price: number; includedCredits: number | null; includedBalance: number | null; regionalPrices: Array<{ currency: string; price: number; includedBalance: number | null }> }>; createdAt: string } | null`, required) — The published version. Null for a preview.
|
|
578
|
+
- `moveId` (`string | null`, required) — The move of subscribers, if any.
|
|
579
|
+
- `subscribers` (`{ moving: number; keptOnVersion: number; needsAChange: number; leftOut: Array<{ subscriptionId: string; code: string; message: string }> } | null`, required)
|
|
580
|
+
- `object` (`"plan_draft_publication"`, required)
|
|
581
|
+
- `livemode` (`boolean`, required)
|
|
582
|
+
|
|
583
|
+
### PlanExperiment
|
|
584
|
+
|
|
585
|
+
- `id` (`string`, required) — Public plan experiment ID.
|
|
586
|
+
- `code` (`string`, required) — The code to sell it with as planCode, such as pro:price-test. It always sells the experiment's latest version while running, and the plan's current version once closed.
|
|
587
|
+
- `status` (`"running" | "won" | "archived"`, required) — running sells its latest version; won became the plan's current version; archived stopped selling.
|
|
588
|
+
- `startedFromVersionId` (`string`, required) — The plan's version that was current when it started.
|
|
589
|
+
- `latestVersionId` (`string`, required) — Its latest version.
|
|
590
|
+
- `sellsVersionId` (`string`, required) — The version its code sells to new buyers today.
|
|
591
|
+
- `subscriptionCount` (`number`, required) — Active, trialing, past due and paused subscriptions on its versions.
|
|
592
|
+
- `createdAt` (`string`, required)
|
|
593
|
+
- `closedAt` (`string | null`, required)
|
|
594
|
+
- `object` (`"plan_experiment"`, required)
|
|
595
|
+
- `livemode` (`boolean`, required)
|
|
596
|
+
|
|
597
|
+
### PlanExperimentArchive
|
|
598
|
+
|
|
599
|
+
- `experiment` (`{ id: string; code: string; status: "running" | "won" | "archived"; startedFromVersionId: string; latestVersionId: string; sellsVersionId: string; subscriptionCount: number; createdAt: string; closedAt: string | null }`, required)
|
|
600
|
+
- `moveId` (`string | null`, required) — The move of its subscribers, or null when they stay.
|
|
601
|
+
- `object` (`"plan_experiment_archive"`, required)
|
|
602
|
+
- `livemode` (`boolean`, required)
|
|
603
|
+
|
|
548
604
|
### PlanFeature
|
|
549
605
|
|
|
550
606
|
- `planId` (`string`, required)
|
|
@@ -604,6 +660,22 @@ Variants:
|
|
|
604
660
|
- `object` (`"plan_group"`, required)
|
|
605
661
|
- `livemode` (`boolean`, required)
|
|
606
662
|
|
|
663
|
+
### PlanMove
|
|
664
|
+
|
|
665
|
+
- `id` (`string | null`, required) — Public move ID. Null for a preview, which records nothing.
|
|
666
|
+
- `toVersionId` (`string`, required)
|
|
667
|
+
- `fromVersionIds` (`Array<string>`, required) — The versions its subscribers are moving from.
|
|
668
|
+
- `effective` (`"now" | "period_end"`, required)
|
|
669
|
+
- `preview` (`boolean`, required)
|
|
670
|
+
- `status` (`"checking" | "blocked" | "checked" | "moving" | "completed" | "canceled"`, required) — checked is a preview where everyone fits; moving while subscribers wait for their move; completed once every move ran; canceled after it was canceled.
|
|
671
|
+
- `counts` (`{ moving: number; moved: number; needsAChange: number; leftOut: number; canceled: number; keptOnVersion: number }`, required)
|
|
672
|
+
- `subscriptions` (`Array<{ subscriptionId: string; status: "moving" | "moved" | "needs_a_change" | "left_out" | "canceled" | "kept_on_version"; code: string | null; message: string | null }>`, required)
|
|
673
|
+
- `createdAt` (`string | null`, required)
|
|
674
|
+
- `completedAt` (`string | null`, required)
|
|
675
|
+
- `canceledAt` (`string | null`, required)
|
|
676
|
+
- `object` (`"plan_move"`, required)
|
|
677
|
+
- `livemode` (`boolean`, required)
|
|
678
|
+
|
|
607
679
|
### PlanPrice
|
|
608
680
|
|
|
609
681
|
- `id` (`string`, required) — Public plan price ID.
|
|
@@ -641,6 +713,30 @@ Variants:
|
|
|
641
713
|
- `object` (`"plan_regional_pricing"`, required)
|
|
642
714
|
- `livemode` (`boolean`, required)
|
|
643
715
|
|
|
716
|
+
### PlanVersion
|
|
717
|
+
|
|
718
|
+
- `id` (`string`, required) — Public plan version ID.
|
|
719
|
+
- `label` (`string`, required) — The plan's versions are numbered 1, 2, 3; an experiment's own versions read with its code, such as price-test 2.
|
|
720
|
+
- `number` (`number | null`, required) — The plan's version number. Null for a version that only belongs to an experiment; an experiment version made current takes the next number.
|
|
721
|
+
- `experiment` (`{ code: string; version: number } | null`, required) — The experiment this version belongs to, if any.
|
|
722
|
+
- `isCurrent` (`boolean`, required) — Whether new buyers get this version.
|
|
723
|
+
- `parentVersionId` (`string | null`, required) — The version this one was created from.
|
|
724
|
+
- `subscriptionCount` (`number`, required) — Active, trialing, past due and paused subscriptions on it.
|
|
725
|
+
- `maxPlanCredits` (`number | null`, required)
|
|
726
|
+
- `maxPlanBalance` (`number | null`, required)
|
|
727
|
+
- `prices` (`Array<{ id: string; billingInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time"; price: number; includedCredits: number | null; includedBalance: number | null; regionalPrices: Array<{ currency: string; price: number; includedBalance: number | null }> }>`, required)
|
|
728
|
+
- `createdAt` (`string`, required)
|
|
729
|
+
- `object` (`"plan_version"`, required)
|
|
730
|
+
- `livemode` (`boolean`, required)
|
|
731
|
+
|
|
732
|
+
### PlanVersionComparison
|
|
733
|
+
|
|
734
|
+
- `versionId` (`string`, required) — The version the changes start from.
|
|
735
|
+
- `againstVersionId` (`string`, required) — The version they end at.
|
|
736
|
+
- `changes` (`Array<{ key: string; section: string; country: string | null; label: string; before: string | null; after: string | null }>`, required) — Every term that differs, the plan's first and then each country.
|
|
737
|
+
- `object` (`"plan_version_comparison"`, required)
|
|
738
|
+
- `livemode` (`boolean`, required)
|
|
739
|
+
|
|
644
740
|
### PortalAccess
|
|
645
741
|
|
|
646
742
|
- `portalUrl` (`string`, required)
|
|
@@ -663,6 +759,7 @@ Variants:
|
|
|
663
759
|
- `daysRemaining` (`number`, required)
|
|
664
760
|
- `totalDays` (`number`, required)
|
|
665
761
|
- `isUpgrade` (`boolean`, required)
|
|
762
|
+
- `deactivatedAddons` (`Array<{ addonId: string; name: string }>`, required) — Active add-ons that the version the change moves the subscription to does not sell. The change deactivates them when it applies.
|
|
666
763
|
- `offerApplication` (`{ id: string; offerId: string; name: string; currency: string; subtotal: number; discountAmount: number; total: number; phases: Array<{ type: "free_trial"; durationDays: number; startsAt: string | null; endsAt: string | null } | { type: "percentage"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; startsAt: string | null; endsAt: string | null; percentage: number } | { type: "amount_off"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; startsAt: string | null; endsAt: string | null; amount: number } | { type: "fixed_price"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; startsAt: string | null; endsAt: string | null; price: number }>; appliesTo: { type: "plan_price"; id: string } | { type: "addon"; id: string } | { type: "credit_pack"; id: string } }`, optional)
|
|
667
764
|
- `object` (`"plan_change_preview"`, required)
|
|
668
765
|
- `livemode` (`boolean`, required)
|
|
@@ -764,6 +861,17 @@ Variants:
|
|
|
764
861
|
- `object` (`"invoice_delivery"`, required)
|
|
765
862
|
- `livemode` (`boolean`, required)
|
|
766
863
|
|
|
864
|
+
### SubscriberNeedingAChange
|
|
865
|
+
|
|
866
|
+
- `subscriptionId` (`string`, required)
|
|
867
|
+
- `moveId` (`string`, required) — The move it could not complete.
|
|
868
|
+
- `fromVersionId` (`string`, required) — The version it stays on.
|
|
869
|
+
- `toVersionId` (`string`, required) — The version it could not move to.
|
|
870
|
+
- `code` (`string`, required) — Why it could not move.
|
|
871
|
+
- `message` (`string`, required)
|
|
872
|
+
- `object` (`"subscriber_needing_a_change"`, required)
|
|
873
|
+
- `livemode` (`boolean`, required)
|
|
874
|
+
|
|
767
875
|
### Subscription
|
|
768
876
|
|
|
769
877
|
- `id` (`string`, required)
|
|
@@ -786,13 +894,15 @@ Variants:
|
|
|
786
894
|
- `hasPaymentMethod` (`boolean`, required) — Whether Commet can charge this subscription on its own at its next charge (the trial end or the renewal). A trial that started without a payment method reports false until the customer adds one for this subscription; a payment method saved for another subscription does not count. A subscription on a free plan reports false.
|
|
787
895
|
- `createdAt` (`string`, required)
|
|
788
896
|
- `updatedAt` (`string`, required)
|
|
897
|
+
- `planVersion` (`{ id: string; label: string } | null`, required) — The plan version whose terms the subscription has now. It keeps paying and receiving everything from this version until it is moved.
|
|
789
898
|
- `offerApplications` (`Array<SubscriptionOfferApplication>`, required)
|
|
790
899
|
- `pause` (`{ status: "scheduled"; mode: "period_end"; requestedAt: string; effectiveAt: string; resumeAt: string | null } | { status: "active"; mode: "immediate" | "period_end"; requestedAt: string; effectiveAt: string; resumeAt: string | null } | null`, required)
|
|
900
|
+
- `scheduledVersionChange` (`{ planVersionId: string; label: string; effectiveAt: string; currency: string } | null`, required) — A move to another version of the plan pending for the next renewal.
|
|
791
901
|
- `planGrant` (`{ id: string; plan: { id: string; name: string }; expiresAt: string | null }`, optional)
|
|
792
902
|
- `consumptionModel` (`ConsumptionModel | null`, required)
|
|
793
903
|
- `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)
|
|
794
|
-
- `credits` (`{
|
|
795
|
-
- `balance` (`{
|
|
904
|
+
- `credits` (`{ unlimited: boolean; remaining?: number; included: number; purchased: number; plan?: number; total?: number } | null`, required)
|
|
905
|
+
- `balance` (`{ unlimited: boolean; remaining?: number; included: number; currency: string; plan?: number; purchased: number; total?: number } | null`, required)
|
|
796
906
|
- `priceId` (`string | null`, required)
|
|
797
907
|
- `object` (`"subscription"`, required)
|
|
798
908
|
- `livemode` (`boolean`, required)
|
|
@@ -800,7 +910,7 @@ Variants:
|
|
|
800
910
|
### SubscriptionAddon
|
|
801
911
|
|
|
802
912
|
- `addonId` (`string`, required)
|
|
803
|
-
- `status` (`"active"`, required)
|
|
913
|
+
- `status` (`"active" | "processing"`, required) — `active` when the add-on is active. `processing` when the payment method confirms later: the add-on is activated once the payment is confirmed, and stays inactive if it is declined.
|
|
804
914
|
- `proratedCharge` (`number`, required)
|
|
805
915
|
- `object` (`"subscription_addon"`, required)
|
|
806
916
|
- `livemode` (`boolean`, required)
|
|
@@ -875,6 +985,7 @@ Variants:
|
|
|
875
985
|
- `hasPaymentMethod` (`boolean`, required) — Whether Commet can charge this subscription on its own at its next charge (the trial end or the renewal). A trial that started without a payment method reports false until the customer adds one for this subscription; a payment method saved for another subscription does not count. A subscription on a free plan reports false.
|
|
876
986
|
- `createdAt` (`string`, required)
|
|
877
987
|
- `updatedAt` (`string`, required)
|
|
988
|
+
- `planVersion` (`{ id: string; label: string } | null`, required) — The plan version whose terms the subscription has now. It keeps paying and receiving everything from this version until it is moved.
|
|
878
989
|
- `offerApplications` (`Array<SubscriptionOfferApplication>`, required)
|
|
879
990
|
- `pause` (`{ status: "scheduled"; mode: "period_end"; requestedAt: string; effectiveAt: string; resumeAt: string | null } | { status: "active"; mode: "immediate" | "period_end"; requestedAt: string; effectiveAt: string; resumeAt: string | null } | null`, required)
|
|
880
991
|
- `priceId` (`string | null`, required)
|
|
@@ -913,6 +1024,7 @@ Variants:
|
|
|
913
1024
|
- `subtotal` (`number | null`, required) — Subtotal in USD cents (gross minus tax). Null when grossAmount is null.
|
|
914
1025
|
- `taxAmount` (`number | null`, required)
|
|
915
1026
|
- `presentmentAmount` (`number | null`, required) — Amount in the charge currency's smallest unit, as presented to the customer. Set for non-USD charges; null when the charge was made in USD.
|
|
1027
|
+
- `amountRefunded` (`number`, required) — Cumulative confirmed refunds in the payment currency’s smallest unit.
|
|
916
1028
|
- `currency` (`string`, required)
|
|
917
1029
|
- `provider` (`PaymentProvider`, required) — The payment provider the charge was routed to: stripe, commet, or dlocal.
|
|
918
1030
|
- `paymentMethod` (`PaymentMethod | null`, required) — The method used for this charge: card, oxxo, or mercado_pago. Null when unknown.
|
|
@@ -936,6 +1048,7 @@ Variants:
|
|
|
936
1048
|
- `subtotal` (`number | null`, required) — Subtotal in USD cents (gross minus tax). Null when grossAmount is null.
|
|
937
1049
|
- `taxAmount` (`number | null`, required)
|
|
938
1050
|
- `presentmentAmount` (`number | null`, required) — Amount in the charge currency's smallest unit, as presented to the customer. Set for non-USD charges; null when the charge was made in USD.
|
|
1051
|
+
- `amountRefunded` (`number`, required) — Cumulative confirmed refunds in the payment currency’s smallest unit.
|
|
939
1052
|
- `currency` (`string`, required)
|
|
940
1053
|
- `provider` (`PaymentProvider`, required) — The payment provider the charge was routed to: stripe, commet, or dlocal.
|
|
941
1054
|
- `paymentMethod` (`PaymentMethod | null`, required) — The method used for this charge: card, oxxo, or mercado_pago. Null when unknown.
|
|
@@ -976,8 +1089,8 @@ Variants:
|
|
|
976
1089
|
Variants:
|
|
977
1090
|
|
|
978
1091
|
- `{ allowed: boolean; subscriptionStatus: string; featureCode: string; quantity: number; reason?: string; message?: string; consumptionModel: "metered"; current: number; remaining: number; unlimited: boolean; included: number; overageEnabled: boolean; overageUnitPrice: number | null; object: "usage_check"; livemode: boolean }`
|
|
979
|
-
- `{ allowed: boolean; subscriptionStatus: string; featureCode: string; quantity: number; reason?: string; message?: string; consumptionModel: "credits"; creditsPerUnit: number; estimatedCredits: number;
|
|
980
|
-
- `{ allowed: boolean; subscriptionStatus: string; featureCode: string; quantity: number; reason?: string; message?: string; consumptionModel: "balance"; unitPrice: number; estimatedAmount: number;
|
|
1092
|
+
- `{ allowed: boolean; subscriptionStatus: string; featureCode: string; quantity: number; reason?: string; message?: string; consumptionModel: "credits"; creditsPerUnit: number; estimatedCredits: number; unlimited: boolean; planCredits?: number; purchasedCredits: number; totalCredits?: number; planCreditLimit: { credits: number; interval: "day" | "week"; spent: number; remaining: number; resetsAt: string } | null; blockOnExhaustion: boolean; object: "usage_check"; livemode: boolean }`
|
|
1093
|
+
- `{ allowed: boolean; subscriptionStatus: string; featureCode: string; quantity: number; reason?: string; message?: string; consumptionModel: "balance"; unitPrice: number; estimatedAmount: number; unlimited: boolean; currentBalance?: number; planBalance?: number; purchasedBalance: number; totalBalance?: number; planBalanceLimit: { amount: number; interval: "day" | "week"; spent: number; remaining: number; resetsAt: string } | null; blockOnExhaustion: boolean; currency: string; object: "usage_check"; livemode: boolean }`
|
|
981
1094
|
|
|
982
1095
|
### UsageEvent
|
|
983
1096
|
|
|
@@ -989,7 +1102,7 @@ Variants:
|
|
|
989
1102
|
- `ts` (`string`, required)
|
|
990
1103
|
- `createdAt` (`string`, required)
|
|
991
1104
|
- `properties` (`Array<{ property: string; value: string }>`, required)
|
|
992
|
-
- `consumption` (`{ model: "credits" | "balance"; deducted: number;
|
|
1105
|
+
- `consumption` (`{ model: "credits" | "balance"; deducted: number; unlimited: boolean; remaining?: number; blocked: boolean; planCreditLimit?: { credits: number; interval: "day" | "week"; spent: number; remaining: number; resetsAt: string } | null; planBalanceLimit?: { amount: number; interval: "day" | "week"; spent: number; remaining: number; resetsAt: string } | null }`, optional)
|
|
993
1106
|
- `object` (`"usage_event"`, required)
|
|
994
1107
|
- `livemode` (`boolean`, required)
|
|
995
1108
|
|
|
@@ -1037,10 +1150,11 @@ Variants:
|
|
|
1037
1150
|
|
|
1038
1151
|
### WebhookBalance
|
|
1039
1152
|
|
|
1040
|
-
- `
|
|
1041
|
-
- `
|
|
1153
|
+
- `unlimited` (`boolean`, required) — true when the plan balance is unlimited: usage never spends it and only the plan balance limit caps it.
|
|
1154
|
+
- `currentBalance` (`number`, optional) — The available balance, plan plus purchased, in rate scale. Equal to totalBalance. Omitted when unlimited is true.
|
|
1155
|
+
- `planBalance` (`number`, optional) — The plan part in rate scale: spent first, replaced or rolled over at each reset, negative while overage is owed. Omitted when unlimited is true.
|
|
1042
1156
|
- `purchasedBalance` (`number`, required) — The purchased part in rate scale: top-ups and manual adjustments, spent after the plan part and kept until the subscription ends.
|
|
1043
|
-
- `totalBalance` (`number`,
|
|
1157
|
+
- `totalBalance` (`number`, optional) — planBalance plus purchasedBalance, in rate scale. Omitted when unlimited is true.
|
|
1044
1158
|
|
|
1045
1159
|
### WebhookBankRef
|
|
1046
1160
|
|
|
@@ -1056,9 +1170,10 @@ Variants:
|
|
|
1056
1170
|
|
|
1057
1171
|
### WebhookCreditsBalance
|
|
1058
1172
|
|
|
1059
|
-
- `
|
|
1173
|
+
- `unlimited` (`boolean`, required) — true when the plan credits are unlimited: usage never spends them and only the plan credit limit caps it.
|
|
1174
|
+
- `planCredits` (`number`, optional) — Plan credits left. Omitted when unlimited is true.
|
|
1060
1175
|
- `purchasedCredits` (`number`, required)
|
|
1061
|
-
- `totalCredits` (`number`,
|
|
1176
|
+
- `totalCredits` (`number`, optional) — planCredits plus purchasedCredits. Omitted when unlimited is true.
|
|
1062
1177
|
|
|
1063
1178
|
### WebhookPlanGrantTimelineEvent
|
|
1064
1179
|
|
|
@@ -11,6 +11,8 @@ Webhooks let your application receive real-time HTTP notifications when events h
|
|
|
11
11
|
2. You select which events you want to receive
|
|
12
12
|
3. When an event occurs, Commet sends a `POST` request to your URL with the event data
|
|
13
13
|
|
|
14
|
+
An endpoint receives only the events it lists. New event types are not added to existing endpoints: when Commet adds one, such as `subscription.version_changed`, edit the endpoint to receive it.
|
|
15
|
+
|
|
14
16
|
## Local development
|
|
15
17
|
|
|
16
18
|
Use the Commet CLI to forward webhook events to your local server in real time — no tunneling tools needed:
|
|
@@ -472,7 +474,7 @@ You can monitor delivery status, inspect payloads, and retry individual deliveri
|
|
|
472
474
|
|
|
473
475
|
## Subscription status lifecycle
|
|
474
476
|
|
|
475
|
-
|
|
477
|
+
Most `subscription.*` webhooks include a `status` field. These are the valid values and which ones grant access to your product:
|
|
476
478
|
|
|
477
479
|
| Status | Grants access? | Meaning |
|
|
478
480
|
| ----------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
package/docs/webhooks.md
CHANGED
|
@@ -221,6 +221,30 @@ Fired when a scheduled plan change will no longer take effect: it was revoked th
|
|
|
221
221
|
- `billingInterval` (`string | null`, required) — The current billing interval.
|
|
222
222
|
- `revokedBillingInterval` (`string | null`, required) — The previously scheduled billing interval, if the revoked change included one.
|
|
223
223
|
|
|
224
|
+
## subscription.version_changed
|
|
225
|
+
|
|
226
|
+
Fired when a subscription moves to another version of its plan: a move applied now or a scheduled move that took effect at renewal. Making an experiment current moves nobody, so it sends none. The plan stays the same; the version's prices and features apply from now on.
|
|
227
|
+
|
|
228
|
+
### Data
|
|
229
|
+
|
|
230
|
+
- `subscriptionId` (`string`, required) — The subscription ID.
|
|
231
|
+
- `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
|
|
232
|
+
- `fromVersionId` (`string`, required) — The version the subscription left.
|
|
233
|
+
- `toVersionId` (`string`, required) — The version the subscription is on now.
|
|
234
|
+
- `currency` (`string`, required) — The currency the subscription pays in.
|
|
235
|
+
- `billingInterval` (`string`, required) — The billing interval the subscription pays.
|
|
236
|
+
|
|
237
|
+
## subscription.version_change_canceled
|
|
238
|
+
|
|
239
|
+
Fired when a scheduled move to another plan version will no longer take effect because the subscription no longer fit the version at its renewal, or because the merchant revoked the scheduled version change or canceled the plan move. A new move that replaces it, a move made now, a plan change or an immediate cancellation sends none. The subscription stays on its version; reason says why.
|
|
240
|
+
|
|
241
|
+
### Data
|
|
242
|
+
|
|
243
|
+
- `subscriptionId` (`string`, required) — The subscription ID.
|
|
244
|
+
- `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
|
|
245
|
+
- `toVersionId` (`string`, required) — The version the subscription was going to move to.
|
|
246
|
+
- `reason` (`string`, required) — Why the move was canceled: canceled_by_merchant, version_change_failed when the move could not be applied at renewal, the code of what the subscription no longer fits (addon_unavailable, seat_limit_exceeded, price_not_found, missing_regional_price), or, for a move that charges it in USD, what keeps it in its currency (currency_held_by_payment_method, currency_held_by_customer_credit, currency_held_by_balance_plan, currency_held_by_fixed_amount_discount, currency_held_by_prepaid_period, currency_held_by_scheduled_pause).
|
|
247
|
+
|
|
224
248
|
## subscription.past_due
|
|
225
249
|
|
|
226
250
|
Fired when a recurring payment fails on a previously paid subscription and its status becomes past_due. past_due is a grace window, not a cutoff: usage and seats keep working while new purchases are blocked, and dunning retries the charge — use this to notify the customer and recover the payment.
|
|
@@ -391,6 +415,7 @@ Fired when a payment is refunded, fully or partially. A refund does not change t
|
|
|
391
415
|
- `invoiceNumber` (`string | null`, required) — The human-readable invoice number, if available.
|
|
392
416
|
- `customerId` (`string | null`, required) — The customer ID, when the payment is linked to an invoice. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
|
|
393
417
|
- `subscriptionId` (`string | null`, required) — The subscription ID, if the invoice is linked to a subscription.
|
|
418
|
+
- `amountRefunded` (`number`, required) — Cumulative confirmed refunds in the payment currency’s smallest unit.
|
|
394
419
|
- `refundAmount` (`number`, required) — The refunded amount in cents (100 = $1.00).
|
|
395
420
|
- `currency` (`string`, required) — The refund currency code.
|
|
396
421
|
|
|
@@ -513,7 +538,7 @@ Fired when a new invoice is generated for a subscription, typically at the start
|
|
|
513
538
|
|
|
514
539
|
## invoice.voided
|
|
515
540
|
|
|
516
|
-
Fired when an invoice is voided — nullified before collection,
|
|
541
|
+
Fired when an invoice is voided — nullified before collection, for example when its subscription is canceled. Voiding is terminal: a void invoice is never retried or collected.
|
|
517
542
|
|
|
518
543
|
### Data
|
|
519
544
|
|
|
@@ -644,7 +669,7 @@ Aggregate entitlement event answering one question: what can this customer acces
|
|
|
644
669
|
- `plan` (`WebhookPlanRef | null`, required) — The current plan (id and name), or null when status is none.
|
|
645
670
|
- `billingInterval` (`string | null`, required) — The current billing interval.
|
|
646
671
|
- `consumptionModel` (`string | null`, required) — The plan's consumption model: metered, credits, or balance.
|
|
647
|
-
- `features` (`Array<{ code: string; name: string; unitName: string | null; allowed: boolean; type: "boolean"; enabled: boolean } | { 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;
|
|
672
|
+
- `features` (`Array<{ code: string; name: string; unitName: string | null; allowed: boolean; type: "boolean"; enabled: boolean } | { 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; unlimited: boolean; availableUnits?: number } | { model: "balance"; period: { start: string; end: string }; unitsUsed: number; spent: { amount: number; currency: string }; unlimited: boolean; availableUnits?: number; unitPrice?: { amount: number; currency: string; scale: 10000 } } } | { 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 } } } } | { 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 } }>`, required) — Current feature access, discriminated by type. Boolean features expose enabled; usage features expose model-specific consumption; seats and quota expose usage allowances.
|
|
648
673
|
- `seats` (`Array<WebhookSeatSummary>`, required) — Summary of seats-type features: code, current, included, remaining, unlimited.
|
|
649
674
|
- `credits` (`WebhookCreditsBalance | null`, required) — For credits plans: planCredits, purchasedCredits, totalCredits. Null otherwise.
|
|
650
675
|
- `balance` (`WebhookBalance | null`, required) — For balance plans, in rate scale (10000 = 1.00 of the subscription currency): currentBalance (the available total), planBalance, purchasedBalance and totalBalance. Null otherwise.
|