@commet/node 9.8.0 → 9.9.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 +216 -23
- package/dist/index.d.ts +216 -23
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.map +1 -1
- package/docs/api-reference/customers.md +2 -0
- package/docs/api-reference/generated-webhooks.md +2 -2
- package/docs/api-reference/index.md +1 -1
- package/docs/api-reference/plans.md +8 -3
- package/docs/api-reference/subscriptions.md +7 -5
- package/docs/documentation/cli.md +60 -49
- package/docs/documentation/create-api-key.md +3 -1
- package/docs/documentation/customers/customer-portal.md +10 -2
- package/docs/documentation/customers/manage-customers.md +2 -1
- package/docs/documentation/finance/payouts.md +11 -0
- package/docs/documentation/finance/supported-countries.md +5 -5
- package/docs/documentation/invoicing/handle-failed-payments.md +9 -9
- package/docs/documentation/payments/accept-one-time-payments.md +1 -1
- package/docs/documentation/payments/payment-orchestration.md +2 -0
- package/docs/documentation/payments/payment-providers.md +46 -0
- package/docs/documentation/payments/transactions-refunds-and-retries.md +1 -1
- package/docs/documentation/plans/add-ons.md +1 -1
- package/docs/documentation/plans/consumption-models.md +44 -9
- package/docs/documentation/plans/credit-packs.md +49 -1
- package/docs/documentation/plans/one-time-payments.md +3 -3
- package/docs/documentation/plans/plan-groups.md +46 -10
- package/docs/documentation/platform/dashboard-metrics-and-events.md +40 -9
- package/docs/documentation/sales/connect-dub-affiliates.md +52 -0
- package/docs/documentation/sales/introductory-offers.md +7 -13
- package/docs/documentation/sales/offers.md +10 -6
- package/docs/documentation/sales/promo-codes.md +47 -17
- package/docs/documentation/sales/promotional-offers.md +6 -7
- package/docs/documentation/sales/regional-prices.md +16 -0
- package/docs/documentation/sales/trial-periods.md +67 -40
- package/docs/documentation/subscriptions/manage-subscriptions.md +65 -2
- package/docs/documentation/subscriptions/pay-in-advance.md +4 -7
- package/docs/documentation/subscriptions/upgrade-and-downgrade-plans.md +20 -2
- package/docs/documentation/testing-sandbox.md +2 -0
- package/docs/documentation/usage/track-usage.md +23 -0
- package/docs/errors/index.md +1 -0
- package/docs/errors/plan_balance_limit_reached.md +22 -0
- package/docs/knowledge-base/how-do-credits-credit-packs-and-customer-credits-differ.md +8 -8
- package/docs/knowledge-base/how-do-discounts-work.md +7 -5
- package/docs/knowledge-base/how-do-free-plans-work-without-payment.md +14 -8
- package/docs/knowledge-base/how-do-offers-promo-codes-and-card-promotions-work-together.md +1 -1
- package/docs/knowledge-base/how-do-trial-periods-work.md +30 -24
- package/docs/knowledge-base/how-does-billing-work.md +1 -0
- package/docs/knowledge-base/what-happens-when-a-payment-fails.md +11 -9
- package/docs/manifest.json +12 -2
- package/docs/platform-documentation.md +1 -0
- package/docs/schemas.md +27 -14
- package/docs/webhooks/introduction.md +14 -12
- package/docs/webhooks.md +42 -6
- package/docs/webhooks.openapi.json +857 -745
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Payment Failures
|
|
3
|
-
description: Usage and seats keep working while Commet retries a failed charge on days 1, 3, 5 and 7,
|
|
3
|
+
description: Usage and seats keep working while Commet retries a failed charge on days 1, 3, 5 and 7; if all fail, the subscription ends or moves to the default plan.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
When a payment fails, your customer's usage and seats keep working while Commet retries the charge — but new purchases are blocked. If all retries fail, their subscription is canceled.
|
|
6
|
+
When a payment fails, your customer's usage and seats keep working while Commet retries the charge — but new purchases are blocked. If all retries fail, their subscription is canceled, or moves to the plan group's [default plan](/docs/plan-groups#default-plan-and-signup-trial).
|
|
7
7
|
|
|
8
8
|
## What Your Customer Experiences
|
|
9
9
|
|
|
@@ -14,15 +14,15 @@ Payment fails
|
|
|
14
14
|
→ Commet retries the charge automatically
|
|
15
15
|
|
|
16
16
|
All retries fail
|
|
17
|
-
→ Their subscription is canceled
|
|
18
|
-
→
|
|
17
|
+
→ Their subscription is canceled, or moves to the default plan
|
|
18
|
+
→ Paid access is revoked
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
| Stage | Access
|
|
22
|
-
| --------------------- |
|
|
23
|
-
| Payment fails | **Usage and seats keep working**
|
|
24
|
-
| During grace period | **Usage and seats keep working**
|
|
25
|
-
| All retries exhausted | Revoked
|
|
21
|
+
| Stage | Access | What's happening |
|
|
22
|
+
| --------------------- | --------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
23
|
+
| Payment fails | **Usage and seats keep working** | Subscription moves to `past_due`, invoice becomes `outstanding`, retries scheduled |
|
|
24
|
+
| During grace period | **Usage and seats keep working** | Automatic retries on day 1, day 3, day 5, and day 7; usage keeps accruing as debt |
|
|
25
|
+
| All retries exhausted | Revoked, or limited to the default plan | Subscription canceled or moved to the default plan, invoice marked `uncollectible` |
|
|
26
26
|
|
|
27
27
|
> **Warning**
|
|
28
28
|
>
|
|
@@ -31,3 +31,5 @@ All retries fail
|
|
|
31
31
|
## First Charge After a Trial
|
|
32
32
|
|
|
33
33
|
A retryable provider decline on the first paid invoice follows the same `past_due` dunning schedule. If the charge cannot start because the payment method is missing or the customer must take an action, the subscription remains `pending_payment` and checkout is used to complete payment instead of starting dunning.
|
|
34
|
+
|
|
35
|
+
A [trial without a payment method](/docs/trial-periods#start-a-trial-without-a-payment-method) that ends without a card is not charged. It moves to the default plan or is canceled, with no invoice.
|
package/docs/manifest.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"platformDocumentation": {
|
|
13
13
|
"source": "commet-labs/docs",
|
|
14
14
|
"index": "platform-documentation.md",
|
|
15
|
-
"count":
|
|
15
|
+
"count": 97,
|
|
16
16
|
"entries": [
|
|
17
17
|
"documentation/introduction.md",
|
|
18
18
|
"documentation/create-api-key.md",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"documentation/sales/promotional-offers.md",
|
|
52
52
|
"documentation/sales/introductory-offers.md",
|
|
53
53
|
"documentation/sales/promo-codes.md",
|
|
54
|
+
"documentation/sales/connect-dub-affiliates.md",
|
|
54
55
|
"documentation/sales/regional-prices.md",
|
|
55
56
|
"documentation/sales/trial-periods.md",
|
|
56
57
|
"documentation/subscriptions/manage-subscriptions.md",
|
|
@@ -114,7 +115,7 @@
|
|
|
114
115
|
},
|
|
115
116
|
"errorReferences": {
|
|
116
117
|
"index": "errors/index.md",
|
|
117
|
-
"count":
|
|
118
|
+
"count": 88,
|
|
118
119
|
"entries": [
|
|
119
120
|
{
|
|
120
121
|
"code": "validation_error",
|
|
@@ -290,6 +291,12 @@
|
|
|
290
291
|
"documentation": "errors/plan_credit_limit_reached.md",
|
|
291
292
|
"canonicalUrl": "/docs/api-reference/2026-08-27/errors/plan_credit_limit_reached.md"
|
|
292
293
|
},
|
|
294
|
+
{
|
|
295
|
+
"code": "plan_balance_limit_reached",
|
|
296
|
+
"type": "billing_error",
|
|
297
|
+
"documentation": "errors/plan_balance_limit_reached.md",
|
|
298
|
+
"canonicalUrl": "/docs/api-reference/2026-08-27/errors/plan_balance_limit_reached.md"
|
|
299
|
+
},
|
|
293
300
|
{
|
|
294
301
|
"code": "missing_regional_price",
|
|
295
302
|
"type": "billing_error",
|
|
@@ -1655,6 +1662,7 @@
|
|
|
1655
1662
|
"invoice.upcoming",
|
|
1656
1663
|
"payment_method.attached",
|
|
1657
1664
|
"payment_method.updated",
|
|
1665
|
+
"payment_method.detached",
|
|
1658
1666
|
"customer.created",
|
|
1659
1667
|
"customer.updated",
|
|
1660
1668
|
"customer.state_changed",
|
|
@@ -1667,9 +1675,11 @@
|
|
|
1667
1675
|
"credits.low",
|
|
1668
1676
|
"credits.depleted",
|
|
1669
1677
|
"credits.expired",
|
|
1678
|
+
"balance.granted",
|
|
1670
1679
|
"balance.topped_up",
|
|
1671
1680
|
"balance.low",
|
|
1672
1681
|
"balance.depleted",
|
|
1682
|
+
"balance.expired",
|
|
1673
1683
|
"quota.threshold_reached",
|
|
1674
1684
|
"quota.exceeded",
|
|
1675
1685
|
"seats.updated",
|
|
@@ -39,6 +39,7 @@ This documentation snapshot is serialized from the source of commet.co/docs and
|
|
|
39
39
|
- [documentation/sales/promotional-offers.md](./documentation/sales/promotional-offers.md)
|
|
40
40
|
- [documentation/sales/introductory-offers.md](./documentation/sales/introductory-offers.md)
|
|
41
41
|
- [documentation/sales/promo-codes.md](./documentation/sales/promo-codes.md)
|
|
42
|
+
- [documentation/sales/connect-dub-affiliates.md](./documentation/sales/connect-dub-affiliates.md)
|
|
42
43
|
- [documentation/sales/regional-prices.md](./documentation/sales/regional-prices.md)
|
|
43
44
|
- [documentation/sales/trial-periods.md](./documentation/sales/trial-periods.md)
|
|
44
45
|
- [documentation/subscriptions/manage-subscriptions.md](./documentation/subscriptions/manage-subscriptions.md)
|
package/docs/schemas.md
CHANGED
|
@@ -168,6 +168,12 @@ Generated from Commet API version `2026-08-27`.
|
|
|
168
168
|
- `object` (`"balance_topup"`, required)
|
|
169
169
|
- `livemode` (`boolean`, required)
|
|
170
170
|
|
|
171
|
+
### BusinessTaxId
|
|
172
|
+
|
|
173
|
+
- `country` (`string`, required)
|
|
174
|
+
- `type` (`string`, required)
|
|
175
|
+
- `value` (`string`, required)
|
|
176
|
+
|
|
171
177
|
### ClaimLink
|
|
172
178
|
|
|
173
179
|
- `url` (`string`, required)
|
|
@@ -266,6 +272,7 @@ Generated from Commet API version `2026-08-27`.
|
|
|
266
272
|
- `email` (`string`, required)
|
|
267
273
|
- `taxDocument` (`string | null`, required)
|
|
268
274
|
- `documentType` (`string | null`, required)
|
|
275
|
+
- `businessTaxId` (`BusinessTaxId | null`, required)
|
|
269
276
|
- `timezone` (`string | null`, required)
|
|
270
277
|
- `metadata` (`Record<string, unknown> | null`, required)
|
|
271
278
|
- `createdAt` (`string`, required)
|
|
@@ -514,9 +521,11 @@ Variants:
|
|
|
514
521
|
- `isPublic` (`boolean`, required)
|
|
515
522
|
- `isDefault` (`boolean`, required)
|
|
516
523
|
- `isFree` (`boolean`, required)
|
|
517
|
-
- `blockOnExhaustion` (`boolean | null`, required)
|
|
524
|
+
- `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.
|
|
518
525
|
- `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.
|
|
519
526
|
- `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
|
+
- `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.
|
|
528
|
+
- `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.
|
|
520
529
|
- `sortOrder` (`number`, required)
|
|
521
530
|
- `planGroupId` (`string | null`, required)
|
|
522
531
|
- `metadata` (`Record<string, unknown> | null`, required)
|
|
@@ -782,8 +791,8 @@ Variants:
|
|
|
782
791
|
- `planGrant` (`{ id: string; plan: { id: string; name: string }; expiresAt: string | null }`, optional)
|
|
783
792
|
- `consumptionModel` (`ConsumptionModel | null`, required)
|
|
784
793
|
- `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)
|
|
785
|
-
- `credits` (`{ remaining: number; included: number; purchased: number } | null`, required)
|
|
786
|
-
- `balance` (`{ remaining: number; included: number; currency: string } | null`, required)
|
|
794
|
+
- `credits` (`{ remaining: number; included: number; purchased: number; plan: number; total: number } | null`, required)
|
|
795
|
+
- `balance` (`{ remaining: number; included: number; currency: string; plan: number; purchased: number; total: number } | null`, required)
|
|
787
796
|
- `priceId` (`string | null`, required)
|
|
788
797
|
- `object` (`"subscription"`, required)
|
|
789
798
|
- `livemode` (`boolean`, required)
|
|
@@ -798,14 +807,15 @@ Variants:
|
|
|
798
807
|
|
|
799
808
|
### SubscriptionAutoTopUp
|
|
800
809
|
|
|
801
|
-
- `enabled` (`boolean`, required) — Whether credits
|
|
802
|
-
- `threshold` (`number | null`, required) —
|
|
803
|
-
- `quantity` (`number | null`, required) — Credits each top-up buys, or null when never configured.
|
|
804
|
-
- `
|
|
805
|
-
- `
|
|
806
|
-
- `
|
|
810
|
+
- `enabled` (`boolean`, required) — Whether top-ups run automatically: credits bought on a credits plan, balance added on a balance plan. Always false when the plan does not sell credits or has balance top-ups turned off.
|
|
811
|
+
- `threshold` (`number | null`, required) — The available amount at or below which a top-up runs, or null when never configured: credits (plan plus purchased) on a credits plan, minor units of the subscription currency (plan plus purchased balance) on a balance plan.
|
|
812
|
+
- `quantity` (`number | null`, required) — Credits each top-up buys on a credits plan, or null when never configured or on a balance plan.
|
|
813
|
+
- `amount` (`number | null`, required) — Minor units of the subscription currency each top-up adds on a balance plan, charged plus tax, or null when never configured or on a credits plan.
|
|
814
|
+
- `maxPerPeriod` (`number | null`, required) — Maximum top-ups per renewal period, or null when never configured.
|
|
815
|
+
- `status` (`"active" | "paused" | "off"`, required) — active tops up when the available amount reaches the threshold; paused stops after three consecutive failed top-ups, or after one whose charge could not be refunded, until the payment method changes, a credit purchase or balance top-up succeeds or it is saved enabled again; off tops up nothing.
|
|
816
|
+
- `topUpsThisPeriod` (`number`, required) — Top-ups made in the current renewal period.
|
|
807
817
|
- `periodResetsAt` (`string | null`, required) — When the top-up count of the period resets, or null before the subscription starts its first period.
|
|
808
|
-
- `lastFailure` (`{ reason: "payment_declined" | "no_payment_method" | "quantity_below_minimum" | "purchase_failed"; at: string } | null`, required) — The last top-up that failed, or null when none has failed.
|
|
818
|
+
- `lastFailure` (`{ reason: "payment_declined" | "no_payment_method" | "quantity_below_minimum" | "amount_below_minimum" | "purchase_failed"; at: string } | null`, required) — The last top-up that failed, or null when none has failed.
|
|
809
819
|
- `object` (`"subscription_auto_top_up"`, required)
|
|
810
820
|
- `livemode` (`boolean`, required)
|
|
811
821
|
|
|
@@ -966,8 +976,8 @@ Variants:
|
|
|
966
976
|
Variants:
|
|
967
977
|
|
|
968
978
|
- `{ 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 }`
|
|
969
|
-
- `{ allowed: boolean; subscriptionStatus: string; featureCode: string; quantity: number; reason?: string; message?: string; consumptionModel: "credits"; creditsPerUnit: number; estimatedCredits: number; planCredits: number; purchasedCredits: number; totalCredits: number; planCreditLimit: { credits: number; interval: "day" | "week"; spent: number; remaining: number; resetsAt: string } | null; object: "usage_check"; livemode: boolean }`
|
|
970
|
-
- `{ allowed: boolean; subscriptionStatus: string; featureCode: string; quantity: number; reason?: string; message?: string; consumptionModel: "balance"; unitPrice: number; estimatedAmount: number; currentBalance: number; blockOnExhaustion: boolean; currency: string; object: "usage_check"; livemode: boolean }`
|
|
979
|
+
- `{ allowed: boolean; subscriptionStatus: string; featureCode: string; quantity: number; reason?: string; message?: string; consumptionModel: "credits"; creditsPerUnit: number; estimatedCredits: number; 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 }`
|
|
980
|
+
- `{ allowed: boolean; subscriptionStatus: string; featureCode: string; quantity: number; reason?: string; message?: string; consumptionModel: "balance"; unitPrice: number; estimatedAmount: number; 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 }`
|
|
971
981
|
|
|
972
982
|
### UsageEvent
|
|
973
983
|
|
|
@@ -979,7 +989,7 @@ Variants:
|
|
|
979
989
|
- `ts` (`string`, required)
|
|
980
990
|
- `createdAt` (`string`, required)
|
|
981
991
|
- `properties` (`Array<{ property: string; value: string }>`, required)
|
|
982
|
-
- `consumption` (`{ model: "credits" | "balance"; deducted: number; remaining: number; blocked: boolean; planCreditLimit?: { credits: number; interval: "day" | "week"; spent: number; remaining: number; resetsAt: string } | null }`, optional)
|
|
992
|
+
- `consumption` (`{ model: "credits" | "balance"; deducted: number; 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)
|
|
983
993
|
- `object` (`"usage_event"`, required)
|
|
984
994
|
- `livemode` (`boolean`, required)
|
|
985
995
|
|
|
@@ -1027,7 +1037,10 @@ Variants:
|
|
|
1027
1037
|
|
|
1028
1038
|
### WebhookBalance
|
|
1029
1039
|
|
|
1030
|
-
- `currentBalance` (`number`, required)
|
|
1040
|
+
- `currentBalance` (`number`, required) — The available balance, plan plus purchased, in rate scale. Equal to totalBalance.
|
|
1041
|
+
- `planBalance` (`number`, required) — The plan part in rate scale: spent first, replaced or rolled over at each reset, negative while overage is owed.
|
|
1042
|
+
- `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`, required) — planBalance plus purchasedBalance, in rate scale.
|
|
1031
1044
|
|
|
1032
1045
|
### WebhookBankRef
|
|
1033
1046
|
|
|
@@ -462,9 +462,11 @@ After 8 failed attempts (the initial delivery plus 7 retries), the delivery is m
|
|
|
462
462
|
|
|
463
463
|
## Auto-disable for broken endpoints
|
|
464
464
|
|
|
465
|
-
|
|
465
|
+
Commet disables an endpoint when its three most recent deliveries with a final outcome all failed after their 8 attempts, even if newer deliveries are still retrying. A successful delivery among those three, including a test event, keeps the endpoint active. You get one email when the endpoint is disabled, with a link to it.
|
|
466
466
|
|
|
467
|
-
|
|
467
|
+
Deliveries still retrying when the endpoint is disabled are stopped: Commet doesn't call your receiver again for them or send their failure emails.
|
|
468
|
+
|
|
469
|
+
Once you've fixed the issue on your receiver, re-enable the endpoint in **Settings → Webhooks**: choose **Re-enable** in the endpoint's menu, or **Re-enable endpoint** in its detail. The next delivery that fails all its attempts disables it again unless a success lands first. Events that arrived while the endpoint was disabled are not replayed automatically — contact support if you need to backfill any missed events.
|
|
468
470
|
|
|
469
471
|
You can monitor delivery status, inspect payloads, and retry individual deliveries from the dashboard at any time.
|
|
470
472
|
|
|
@@ -472,14 +474,14 @@ You can monitor delivery status, inspect payloads, and retry individual deliveri
|
|
|
472
474
|
|
|
473
475
|
Every `subscription.*` webhook includes a `status` field. These are the valid values and which ones grant access to your product:
|
|
474
476
|
|
|
475
|
-
| Status | Grants access? | Meaning
|
|
476
|
-
| ----------------- | ------------------ |
|
|
477
|
-
| `draft` | No | Internal setup state before any event is fired
|
|
478
|
-
| `pending_payment` | **No** | Subscription created, waiting for the first charge to confirm
|
|
479
|
-
| `trialing` | **Yes** | Trial active
|
|
480
|
-
| `active` | **Yes** | Paid and current
|
|
481
|
-
| `past_due` | Yes (grace period) | A renewal charge failed; dunning retries in progress — usage and seats keep working, new purchases are blocked
|
|
482
|
-
| `canceled` | No | Terminal — the cancellation executed at period end,
|
|
477
|
+
| Status | Grants access? | Meaning |
|
|
478
|
+
| ----------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
479
|
+
| `draft` | No | Internal setup state before any event is fired |
|
|
480
|
+
| `pending_payment` | **No** | Subscription created, waiting for the first charge to confirm |
|
|
481
|
+
| `trialing` | **Yes** | Trial active, with or without a payment method; no charge yet |
|
|
482
|
+
| `active` | **Yes** | Paid and current |
|
|
483
|
+
| `past_due` | Yes (grace period) | A renewal charge failed; dunning retries in progress — usage and seats keep working, new purchases are blocked |
|
|
484
|
+
| `canceled` | No | Terminal — the cancellation executed at period end, dunning exhausted its retries, or a trial without a payment method ended without a card |
|
|
483
485
|
|
|
484
486
|
Typical flow:
|
|
485
487
|
|
|
@@ -490,8 +492,8 @@ draft → pending_payment → trialing → active ⇄ past_due
|
|
|
490
492
|
canceled
|
|
491
493
|
```
|
|
492
494
|
|
|
493
|
-
- Without a trial, `pending_payment` goes straight to `active` when the first charge confirms; with one, it goes to `trialing`.
|
|
494
|
-
- `trialing → active` happens when the trial converts — and also when it expires: trial expiry activates the subscription and regular billing begins.
|
|
495
|
+
- Without a trial, `pending_payment` goes straight to `active` when the first charge confirms; with one, it goes to `trialing`. A [trial without a payment method](/docs/trial-periods#start-a-trial-without-a-payment-method) starts in `trialing` with no checkout.
|
|
496
|
+
- `trialing → active` happens when the trial converts — and also when it expires: trial expiry activates the subscription and regular billing begins. A trial without a payment method that ends without a card moves to the plan group's default plan (`subscription.plan_changed`) or is canceled.
|
|
495
497
|
- `active ⇄ past_due`: a failed renewal starts dunning; a recovered payment returns the subscription to `active`.
|
|
496
498
|
- `canceled` is terminal, reached when a scheduled cancellation executes at period end or when dunning exhausts its retries.
|
|
497
499
|
|
package/docs/webhooks.md
CHANGED
|
@@ -584,6 +584,17 @@ Fired when a customer replaces their default payment method through the customer
|
|
|
584
584
|
- `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, oxxo, or mercado_pago. Null when unknown.
|
|
585
585
|
- `card` (`WebhookCardInfo | null`, required) — Card display metadata for the new method: brand, last4, expMonth, expYear. Null when the method is not a card or its details cannot be retrieved.
|
|
586
586
|
|
|
587
|
+
## payment_method.detached
|
|
588
|
+
|
|
589
|
+
Fired when a saved payment method is removed from a customer: the customer unlinked it at the payment provider (for example, revoking a Mercado Pago authorization), or removed it through the customer portal. Removing a method never changes the customer's subscriptions; a renewal that finds no usable method follows the usual failed-payment recovery.
|
|
590
|
+
|
|
591
|
+
### Data
|
|
592
|
+
|
|
593
|
+
- `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
|
|
594
|
+
- `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, oxxo, or mercado_pago. Null when unknown.
|
|
595
|
+
- `card` (`WebhookCardInfo | null`, required) — Card display metadata of the removed method: brand, last4, expMonth, expYear. Null when the method is not a card or its details cannot be retrieved.
|
|
596
|
+
- `reason` (`"unlinked_at_provider" | "removed_by_customer"`, required) — Why the method was removed: `unlinked_at_provider` when the customer revoked it at the payment provider, `removed_by_customer` when the customer removed it through the customer portal.
|
|
597
|
+
|
|
587
598
|
## customer.created
|
|
588
599
|
|
|
589
600
|
Fired when a customer is created, via the API (including batch create), SDK, or dashboard. The payload is the customer resource exactly as GET /customers returns it.
|
|
@@ -596,6 +607,7 @@ Fired when a customer is created, via the API (including batch create), SDK, or
|
|
|
596
607
|
- `email` (`string`, required) — The customer's email.
|
|
597
608
|
- `taxDocument` (`string | null`, required) — The customer's tax identification number, if provided.
|
|
598
609
|
- `documentType` (`string | null`, required) — The local tax document type label inferred from the customer's country (e.g. CUIT, RFC, RUT), or null when no tax document was provided.
|
|
610
|
+
- `businessTaxId` (`{ country: string; type: string; value: string } | null`, required) — The business tax ID saved for the customer (EU VAT number, Peruvian RUC), or null when the customer has none.
|
|
599
611
|
- `timezone` (`string | null`, required) — The customer's timezone.
|
|
600
612
|
- `metadata` (`Record<string, unknown> | null`, required) — Custom key-value metadata you attached to the customer.
|
|
601
613
|
- `createdAt` (`string`, required) — ISO 8601 datetime when the customer was created.
|
|
@@ -613,6 +625,7 @@ Fired when a customer's details change (email, name, timezone, externalId, or me
|
|
|
613
625
|
- `email` (`string`, required) — The customer's email.
|
|
614
626
|
- `taxDocument` (`string | null`, required) — The customer's tax identification number, if provided.
|
|
615
627
|
- `documentType` (`string | null`, required) — The local tax document type label inferred from the customer's country (e.g. CUIT, RFC, RUT), or null when no tax document was provided.
|
|
628
|
+
- `businessTaxId` (`{ country: string; type: string; value: string } | null`, required) — The business tax ID saved for the customer (EU VAT number, Peruvian RUC), or null when the customer has none.
|
|
616
629
|
- `timezone` (`string | null`, required) — The customer's timezone.
|
|
617
630
|
- `metadata` (`Record<string, unknown> | null`, required) — Custom key-value metadata you attached to the customer.
|
|
618
631
|
- `createdAt` (`string`, required) — ISO 8601 datetime when the customer was created.
|
|
@@ -634,7 +647,7 @@ Aggregate entitlement event answering one question: what can this customer acces
|
|
|
634
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; 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 } } } | { 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.
|
|
635
648
|
- `seats` (`Array<WebhookSeatSummary>`, required) — Summary of seats-type features: code, current, included, remaining, unlimited.
|
|
636
649
|
- `credits` (`WebhookCreditsBalance | null`, required) — For credits plans: planCredits, purchasedCredits, totalCredits. Null otherwise.
|
|
637
|
-
- `balance` (`WebhookBalance | null`, required) — For balance plans
|
|
650
|
+
- `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.
|
|
638
651
|
|
|
639
652
|
## plan_grant.created
|
|
640
653
|
|
|
@@ -758,19 +771,19 @@ Fired when a customer buys a credit pack or a chosen quantity of credits through
|
|
|
758
771
|
|
|
759
772
|
## credits.low
|
|
760
773
|
|
|
761
|
-
Fired when a subscription's
|
|
774
|
+
Fired when a subscription's available credits (plan plus purchased) cross below 10% of their last refill: a period reset, a purchase or a manual adjustment. Emitted once per crossing, the same rule as balance.low.
|
|
762
775
|
|
|
763
776
|
### Data
|
|
764
777
|
|
|
765
778
|
- `subscriptionId` (`string`, required) — The subscription ID.
|
|
766
779
|
- `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
|
|
767
780
|
- `remainingCredits` (`number`, required) — Total credits remaining (plan plus purchased).
|
|
768
|
-
- `thresholdCredits` (`number`, required) — The low-credit threshold that was crossed: 10% of the
|
|
769
|
-
- `periodCredits` (`number`, required) — The
|
|
781
|
+
- `thresholdCredits` (`number`, required) — The low-credit threshold that was crossed: 10% of the last refill.
|
|
782
|
+
- `periodCredits` (`number`, required) — The credits added by the last refill: a period reset, a purchase or a manual adjustment.
|
|
770
783
|
|
|
771
784
|
## credits.depleted
|
|
772
785
|
|
|
773
|
-
Fired
|
|
786
|
+
Fired each time a subscription's available credits cross to zero or below. Usage that needs more credits than remain is rejected from this point, unless the plan allows overage, which is billed at its price per credit at the next renewal. Also fires customer.state_changed with trigger credits_depleted.
|
|
774
787
|
|
|
775
788
|
### Data
|
|
776
789
|
|
|
@@ -788,9 +801,21 @@ Fired at a reset when unused plan credits are discarded. On a plan whose unused
|
|
|
788
801
|
- `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
|
|
789
802
|
- `expiredCredits` (`number`, required) — The plan credits that were discarded.
|
|
790
803
|
|
|
804
|
+
## balance.granted
|
|
805
|
+
|
|
806
|
+
Fired when non-purchase balance is granted to a subscription: the plan balance at the start of each billing period, or a manual adjustment from the dashboard or the API, which goes to the purchased balance. Balance top-ups fire balance.topped_up instead.
|
|
807
|
+
|
|
808
|
+
### Data
|
|
809
|
+
|
|
810
|
+
- `subscriptionId` (`string`, required) — The subscription ID.
|
|
811
|
+
- `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
|
|
812
|
+
- `amount` (`number`, required) — The balance granted in rate scale (10000 = 1.00 of the subscription currency).
|
|
813
|
+
- `currency` (`string`, required) — The subscription currency.
|
|
814
|
+
- `reason` (`string`, required) — Why the balance was granted: period_reset or manual_adjustment.
|
|
815
|
+
|
|
791
816
|
## balance.topped_up
|
|
792
817
|
|
|
793
|
-
Fired when a
|
|
818
|
+
Fired when a balance top-up succeeds: through the API, an automatic top-up or the customer portal. The amount goes to the purchased balance, which is spent after the plan balance and kept until the subscription ends.
|
|
794
819
|
|
|
795
820
|
### Data
|
|
796
821
|
|
|
@@ -824,6 +849,17 @@ Fired when a subscription's prepaid balance crosses to zero or below. With block
|
|
|
824
849
|
- `currentBalance` (`number`, required) — The balance after depletion in rate scale. Zero, or negative when overage is allowed.
|
|
825
850
|
- `currency` (`string`, required) — The subscription currency.
|
|
826
851
|
|
|
852
|
+
## balance.expired
|
|
853
|
+
|
|
854
|
+
Fired at a reset when unused plan balance is discarded. On a plan whose unused plan balance expires, all of it expires at each reset. On a plan that rolls it over, a reset keeps it, up to the plan's maxPlanBalance when it has one, and only the excess expires. An overage debt invoiced at the renewal counts as nothing left over. Purchased balance never expires and is not affected.
|
|
855
|
+
|
|
856
|
+
### Data
|
|
857
|
+
|
|
858
|
+
- `subscriptionId` (`string`, required) — The subscription ID.
|
|
859
|
+
- `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
|
|
860
|
+
- `expiredAmount` (`number`, required) — The plan balance that was discarded, in rate scale (10000 = 1.00 of the subscription currency).
|
|
861
|
+
- `currency` (`string`, required) — The subscription currency.
|
|
862
|
+
|
|
827
863
|
## quota.threshold_reached
|
|
828
864
|
|
|
829
865
|
Fired when a metered feature's usage crosses 80% of its included quantity for the current period. Emitted once per feature per billing period, when the crossing happens.
|