@commet/node 9.6.0 → 9.8.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.
Files changed (96) hide show
  1. package/dist/index.d.mts +258 -51
  2. package/dist/index.d.ts +258 -51
  3. package/dist/index.js +47 -11
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +47 -11
  6. package/dist/index.mjs.map +1 -1
  7. package/docs/ai-onboarding/commet-skill.md +1 -1
  8. package/docs/ai-onboarding/mcp-server.md +2 -2
  9. package/docs/api-reference/customers.md +4 -2
  10. package/docs/api-reference/index.md +2 -2
  11. package/docs/api-reference/offers.md +2 -2
  12. package/docs/api-reference/plans.md +9 -1
  13. package/docs/api-reference/promo-codes.md +3 -1
  14. package/docs/api-reference/subscriptions.md +106 -8
  15. package/docs/api-reference/usage.md +0 -4
  16. package/docs/documentation/better-auth.md +1 -8
  17. package/docs/documentation/customers/customer-portal.md +1 -7
  18. package/docs/documentation/customers/manage-customers.md +0 -6
  19. package/docs/documentation/error-handling.md +1 -1
  20. package/docs/documentation/finance/acceptable-use.md +1 -6
  21. package/docs/documentation/finance/finance-overview.md +0 -5
  22. package/docs/documentation/finance/local-currency-taxes.md +0 -6
  23. package/docs/documentation/finance/merchant-of-record.md +0 -7
  24. package/docs/documentation/finance/payouts-verification.md +0 -5
  25. package/docs/documentation/finance/payouts.md +0 -6
  26. package/docs/documentation/finance/supported-countries.md +1 -6
  27. package/docs/documentation/go/integrate-with-encore.md +1 -8
  28. package/docs/documentation/go/integrate-with-go.md +1 -8
  29. package/docs/documentation/invoicing/handle-failed-payments.md +3 -9
  30. package/docs/documentation/invoicing/invoices-and-billing-cycles.md +0 -6
  31. package/docs/documentation/java/integrate-with-java.md +1 -5
  32. package/docs/documentation/nodejs/integrate-with-astro.md +1 -8
  33. package/docs/documentation/nodejs/integrate-with-bun.md +1 -8
  34. package/docs/documentation/nodejs/integrate-with-express.md +1 -8
  35. package/docs/documentation/nodejs/integrate-with-hono.md +1 -8
  36. package/docs/documentation/nodejs/integrate-with-nextjs.md +1 -8
  37. package/docs/documentation/nodejs/integrate-with-nuxt.md +1 -8
  38. package/docs/documentation/nodejs/integrate-with-remix.md +1 -8
  39. package/docs/documentation/nodejs/integrate-with-sveltekit.md +1 -8
  40. package/docs/documentation/payments/accept-one-time-payments.md +0 -8
  41. package/docs/documentation/payments/payment-orchestration.md +0 -6
  42. package/docs/documentation/payments/payment-providers.md +0 -6
  43. package/docs/documentation/php/integrate-with-laravel.md +1 -8
  44. package/docs/documentation/php/integrate-with-php.md +1 -7
  45. package/docs/documentation/php/integrate-with-symfony.md +1 -8
  46. package/docs/documentation/plans/add-ons.md +0 -8
  47. package/docs/documentation/plans/configure-features.md +1 -8
  48. package/docs/documentation/plans/consumption-models.md +0 -7
  49. package/docs/documentation/plans/create-plans.md +0 -9
  50. package/docs/documentation/plans/credit-packs.md +0 -7
  51. package/docs/documentation/plans/one-time-payments.md +36 -7
  52. package/docs/documentation/plans/plan-groups.md +0 -6
  53. package/docs/documentation/python/integrate-with-django.md +1 -8
  54. package/docs/documentation/python/integrate-with-fastapi.md +1 -8
  55. package/docs/documentation/python/integrate-with-flask.md +1 -8
  56. package/docs/documentation/python/integrate-with-python.md +1 -8
  57. package/docs/documentation/sales/introductory-offers.md +1 -9
  58. package/docs/documentation/sales/offers.md +0 -8
  59. package/docs/documentation/sales/promo-codes.md +0 -7
  60. package/docs/documentation/sales/promotional-offers.md +0 -7
  61. package/docs/documentation/sales/regional-prices.md +0 -7
  62. package/docs/documentation/sales/trial-periods.md +0 -8
  63. package/docs/documentation/sdk-reference.md +1 -1
  64. package/docs/documentation/subscriptions/manage-subscriptions.md +2 -9
  65. package/docs/documentation/subscriptions/pay-in-advance.md +161 -0
  66. package/docs/documentation/subscriptions/plan-grants.md +0 -6
  67. package/docs/documentation/subscriptions/upgrade-and-downgrade-plans.md +1 -7
  68. package/docs/documentation/testing-sandbox.md +1 -1
  69. package/docs/documentation/usage/ai-token-billing.md +0 -6
  70. package/docs/documentation/usage/quota-management.md +1 -7
  71. package/docs/documentation/usage/seat-management.md +1 -7
  72. package/docs/documentation/usage/track-usage.md +1 -7
  73. package/docs/errors/customer_deleted.md +22 -0
  74. package/docs/errors/index.md +4 -0
  75. package/docs/errors/managed_by_integration.md +22 -0
  76. package/docs/errors/no_scheduled_plan_change.md +22 -0
  77. package/docs/errors/plan_credit_limit_reached.md +22 -0
  78. package/docs/knowledge-base/how-do-discounts-work.md +0 -8
  79. package/docs/knowledge-base/how-do-free-plans-work-without-payment.md +1 -7
  80. package/docs/knowledge-base/how-do-monthly-quarterly-and-yearly-billing-work.md +0 -6
  81. package/docs/knowledge-base/how-do-trial-periods-work.md +1 -8
  82. package/docs/knowledge-base/how-does-billing-work.md +1 -1
  83. package/docs/knowledge-base/how-does-quota-based-billing-work.md +1 -7
  84. package/docs/knowledge-base/how-does-seat-based-billing-work.md +1 -7
  85. package/docs/knowledge-base/how-is-proration-calculated-when-changing-plans.md +0 -6
  86. package/docs/knowledge-base/what-happens-when-a-customer-changes-plans.md +0 -6
  87. package/docs/knowledge-base/what-happens-when-a-payment-fails.md +1 -7
  88. package/docs/knowledge-base/what-happens-when-you-change-your-prices.md +1 -7
  89. package/docs/knowledge-base/what-invoices-do-customers-receive-and-when.md +1 -7
  90. package/docs/manifest.json +51 -2
  91. package/docs/platform-documentation.md +1 -0
  92. package/docs/schemas.md +46 -8
  93. package/docs/webhooks/introduction.md +3 -3
  94. package/docs/webhooks.md +15 -15
  95. package/docs/webhooks.openapi.json +15 -5
  96. package/package.json +1 -1
@@ -12,7 +12,7 @@
12
12
  "platformDocumentation": {
13
13
  "source": "commet-labs/docs",
14
14
  "index": "platform-documentation.md",
15
- "count": 95,
15
+ "count": 96,
16
16
  "entries": [
17
17
  "documentation/introduction.md",
18
18
  "documentation/create-api-key.md",
@@ -54,6 +54,7 @@
54
54
  "documentation/sales/regional-prices.md",
55
55
  "documentation/sales/trial-periods.md",
56
56
  "documentation/subscriptions/manage-subscriptions.md",
57
+ "documentation/subscriptions/pay-in-advance.md",
57
58
  "documentation/subscriptions/plan-grants.md",
58
59
  "documentation/subscriptions/upgrade-and-downgrade-plans.md",
59
60
  "documentation/usage/track-usage.md",
@@ -113,7 +114,7 @@
113
114
  },
114
115
  "errorReferences": {
115
116
  "index": "errors/index.md",
116
- "count": 83,
117
+ "count": 87,
117
118
  "entries": [
118
119
  {
119
120
  "code": "validation_error",
@@ -163,6 +164,12 @@
163
164
  "documentation": "errors/customer_not_found.md",
164
165
  "canonicalUrl": "/docs/api-reference/2026-08-27/errors/customer_not_found.md"
165
166
  },
167
+ {
168
+ "code": "customer_deleted",
169
+ "type": "conflict_error",
170
+ "documentation": "errors/customer_deleted.md",
171
+ "canonicalUrl": "/docs/api-reference/2026-08-27/errors/customer_deleted.md"
172
+ },
166
173
  {
167
174
  "code": "feature_not_found",
168
175
  "type": "not_found_error",
@@ -277,6 +284,12 @@
277
284
  "documentation": "errors/included_limit_reached.md",
278
285
  "canonicalUrl": "/docs/api-reference/2026-08-27/errors/included_limit_reached.md"
279
286
  },
287
+ {
288
+ "code": "plan_credit_limit_reached",
289
+ "type": "billing_error",
290
+ "documentation": "errors/plan_credit_limit_reached.md",
291
+ "canonicalUrl": "/docs/api-reference/2026-08-27/errors/plan_credit_limit_reached.md"
292
+ },
280
293
  {
281
294
  "code": "missing_regional_price",
282
295
  "type": "billing_error",
@@ -427,6 +440,12 @@
427
440
  "documentation": "errors/plan_change_scheduled.md",
428
441
  "canonicalUrl": "/docs/api-reference/2026-08-27/errors/plan_change_scheduled.md"
429
442
  },
443
+ {
444
+ "code": "no_scheduled_plan_change",
445
+ "type": "conflict_error",
446
+ "documentation": "errors/no_scheduled_plan_change.md",
447
+ "canonicalUrl": "/docs/api-reference/2026-08-27/errors/no_scheduled_plan_change.md"
448
+ },
430
449
  {
431
450
  "code": "addon_not_found",
432
451
  "type": "not_found_error",
@@ -553,6 +572,12 @@
553
572
  "documentation": "errors/price_in_use.md",
554
573
  "canonicalUrl": "/docs/api-reference/2026-08-27/errors/price_in_use.md"
555
574
  },
575
+ {
576
+ "code": "managed_by_integration",
577
+ "type": "conflict_error",
578
+ "documentation": "errors/managed_by_integration.md",
579
+ "canonicalUrl": "/docs/api-reference/2026-08-27/errors/managed_by_integration.md"
580
+ },
556
581
  {
557
582
  "code": "market_not_found",
558
583
  "type": "not_found_error",
@@ -1286,6 +1311,18 @@
1286
1311
  "method": "POST",
1287
1312
  "path": "/subscriptions/{id}/addons"
1288
1313
  },
1314
+ {
1315
+ "name": "getAutoTopUp",
1316
+ "operationId": "get-subscription-auto-top-up",
1317
+ "method": "GET",
1318
+ "path": "/subscriptions/{id}/auto-top-up"
1319
+ },
1320
+ {
1321
+ "name": "updateAutoTopUp",
1322
+ "operationId": "update-subscription-auto-top-up",
1323
+ "method": "PATCH",
1324
+ "path": "/subscriptions/{id}/auto-top-up"
1325
+ },
1289
1326
  {
1290
1327
  "name": "adjustBalance",
1291
1328
  "operationId": "adjust-balance",
@@ -1352,6 +1389,12 @@
1352
1389
  "method": "POST",
1353
1390
  "path": "/subscriptions/{id}/payment-method/update"
1354
1391
  },
1392
+ {
1393
+ "name": "createPrepaidPeriodsCheckout",
1394
+ "operationId": "create-prepaid-periods-checkout",
1395
+ "method": "POST",
1396
+ "path": "/subscriptions/{id}/prepaid-periods"
1397
+ },
1355
1398
  {
1356
1399
  "name": "previewChange",
1357
1400
  "operationId": "preview-change-plan",
@@ -1382,6 +1425,12 @@
1382
1425
  "method": "GET",
1383
1426
  "path": "/subscriptions/{id}"
1384
1427
  },
1428
+ {
1429
+ "name": "revokeScheduledPlanChange",
1430
+ "operationId": "revoke-scheduled-plan-change",
1431
+ "method": "DELETE",
1432
+ "path": "/subscriptions/{id}/scheduled-plan-change"
1433
+ },
1385
1434
  {
1386
1435
  "name": "uncancel",
1387
1436
  "operationId": "uncancel-subscription",
@@ -42,6 +42,7 @@ This documentation snapshot is serialized from the source of commet.co/docs and
42
42
  - [documentation/sales/regional-prices.md](./documentation/sales/regional-prices.md)
43
43
  - [documentation/sales/trial-periods.md](./documentation/sales/trial-periods.md)
44
44
  - [documentation/subscriptions/manage-subscriptions.md](./documentation/subscriptions/manage-subscriptions.md)
45
+ - [documentation/subscriptions/pay-in-advance.md](./documentation/subscriptions/pay-in-advance.md)
45
46
  - [documentation/subscriptions/plan-grants.md](./documentation/subscriptions/plan-grants.md)
46
47
  - [documentation/subscriptions/upgrade-and-downgrade-plans.md](./documentation/subscriptions/upgrade-and-downgrade-plans.md)
47
48
  - [documentation/usage/track-usage.md](./documentation/usage/track-usage.md)
package/docs/schemas.md CHANGED
@@ -38,12 +38,15 @@ Generated from Commet API version `2026-08-27`.
38
38
  - `"one_time_payment"`
39
39
  - `"reactivation"`
40
40
  - `"resume"`
41
+ - `"prepayment"`
41
42
 
42
43
  ### PaymentMethod
43
44
 
44
45
  - `"card"`
45
46
  - `"oxxo"`
46
47
  - `"mercado_pago"`
48
+ - `"google_pay"`
49
+ - `"smartpix"`
47
50
 
48
51
  ### PaymentProvider
49
52
 
@@ -202,6 +205,7 @@ Generated from Commet API version `2026-08-27`.
202
205
  - `billingDayOfMonth` (`number | null`, required)
203
206
  - `nextBillingDate` (`string | null`, required)
204
207
  - `checkoutUrl` (`string | null`, required)
208
+ - `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.
205
209
  - `createdAt` (`string`, required)
206
210
  - `updatedAt` (`string`, required)
207
211
  - `offerApplications` (`Array<SubscriptionOfferApplication>`, required)
@@ -375,7 +379,7 @@ Variants:
375
379
  - `planName` (`string | null`, required)
376
380
  - `poNumber` (`string | null`, required)
377
381
  - `reference` (`string | null`, required)
378
- - `lineItems` (`Array<{ lineType: "plan_base" | "feature_overage" | "feature_seats" | "feature_quota" | "discount" | "promo_code_discount" | "credit" | "balance_overage" | "addon_base" | "one_time"; featureName: string | null; description: string; quantity: number; unitAmount: number; amount: number; includedAmount: number | null; usedAmount: number | null; overageAmount: number | null; discountType: string | null; discountValue: number | null; discountName: string | null; chargeType: "standard" | "advance" | "true_up" }>`, required)
382
+ - `lineItems` (`Array<{ lineType: "plan_base" | "feature_overage" | "feature_seats" | "feature_quota" | "discount" | "promo_code_discount" | "credit" | "balance_overage" | "addon_base" | "one_time" | "prepaid_period"; featureName: string | null; description: string; quantity: number; unitAmount: number; amount: number; includedAmount: number | null; usedAmount: number | null; overageAmount: number | null; discountType: string | null; discountValue: number | null; discountName: string | null; chargeType: "standard" | "advance" | "true_up" }>`, required)
379
383
  - `object` (`"invoice"`, required)
380
384
  - `livemode` (`boolean`, required)
381
385
 
@@ -410,6 +414,13 @@ Variants:
410
414
  - `object` (`"invoice"`, required)
411
415
  - `livemode` (`boolean`, required)
412
416
 
417
+ ### ManagedBy
418
+
419
+ Variants:
420
+
421
+ - `"dub"`
422
+ - `null`
423
+
413
424
  ### Market
414
425
 
415
426
  - `id` (`string`, required)
@@ -425,11 +436,12 @@ Variants:
425
436
 
426
437
  - `id` (`string`, required)
427
438
  - `name` (`string`, required)
428
- - `phases` (`Array<{ type: "free_trial"; durationDays: number } | { type: "percentage"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; percentage: number } | { type: "amount_off"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; amounts: Array<{ currency: string; amount: number }> } | { type: "fixed_price"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; prices: Array<{ currency: string; amount: number }> }>`, required)
439
+ - `phases` (`Array<{ type: "percentage"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; percentage: number } | { type: "amount_off"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; amounts: Array<{ currency: string; amount: number }> } | { type: "fixed_price"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; prices: Array<{ currency: string; amount: number }> }>`, required)
429
440
  - `metadata` (`Record<string, unknown>`, required)
430
441
  - `startsAt` (`string | null`, required)
431
442
  - `endsAt` (`string | null`, required)
432
443
  - `active` (`boolean`, required)
444
+ - `managedBy` (`ManagedBy`, required) — Integration that manages this record, or null when the merchant does. While an integration manages it, its terms change only in that integration and edits answer 409 managed_by_integration.
433
445
  - `createdAt` (`string`, required)
434
446
  - `updatedAt` (`string`, required)
435
447
  - `object` (`"offer"`, required)
@@ -437,7 +449,7 @@ Variants:
437
449
 
438
450
  ### Payment
439
451
 
440
- - `paymentContext` (`{ reason: "first_subscription_payment" | "trial_conversion" | "recurring_billing" | "plan_change" | "reactivation" | "subscription_resume" | "one_time_payment" | "overage" | "adjustment"; paymentLinkId: string | null; recovery: { type: "payment_recovery" } | { type: "dunning_retry"; attempt: number; maxAttempts: number } | null } | null`, required) — Charge context captured for new payments. Null for historical payments with no captured context.
452
+ - `paymentContext` (`{ reason: "first_subscription_payment" | "trial_conversion" | "recurring_billing" | "plan_change" | "reactivation" | "subscription_resume" | "one_time_payment" | "overage" | "adjustment" | "addon_activation" | "prepayment"; paymentLinkId: string | null; recovery: { type: "payment_recovery" } | { type: "dunning_retry"; attempt: number; maxAttempts: number } | null } | null`, required) — Charge context captured for new payments. Null for historical payments with no captured context.
441
453
  - `id` (`string`, required)
442
454
  - `customerId` (`string | null`, required)
443
455
  - `kind` (`"link" | "charge"`, required)
@@ -503,13 +515,15 @@ Variants:
503
515
  - `isDefault` (`boolean`, required)
504
516
  - `isFree` (`boolean`, required)
505
517
  - `blockOnExhaustion` (`boolean | null`, required)
518
+ - `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
+ - `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.
506
520
  - `sortOrder` (`number`, required)
507
521
  - `planGroupId` (`string | null`, required)
508
522
  - `metadata` (`Record<string, unknown> | null`, required)
509
523
  - `createdAt` (`string`, required)
510
524
  - `updatedAt` (`string`, required)
511
525
  - `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)
512
- - `prices` (`Array<{ id: string; billingInterval: BillingInterval; price: number; isDefault: boolean; trialDays: number; 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)
526
+ - `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)
513
527
  - `exchangeRates` (`Array<{ currency: string; exchangeRate: number }>`, required)
514
528
  - `object` (`"plan"`, required)
515
529
  - `livemode` (`boolean`, required)
@@ -589,6 +603,7 @@ Variants:
589
603
  - `price` (`number`, required) — Price in the currency's minor unit (for example, cents for USD).
590
604
  - `isDefault` (`boolean`, required)
591
605
  - `trialDays` (`number`, required)
606
+ - `trialRequiresPaymentMethod` (`boolean | null`, required) — Whether the price's free trial needs a payment method to start. When false, a new subscription starts trialing right away without checkout; without a payment method added by the trial end, the customer moves to the plan group's default plan, or the subscription is canceled when there is none. Null when the price has no trial.
592
607
  - `includedBalance` (`number | null`, required)
593
608
  - `includedCredits` (`number | null`, required)
594
609
  - `offerId` (`string | null`, required) — Automatic introductory offer for this price.
@@ -623,6 +638,12 @@ Variants:
623
638
  - `object` (`"portal_session"`, required)
624
639
  - `livemode` (`boolean`, required)
625
640
 
641
+ ### PrepaidPeriodsCheckout
642
+
643
+ - `checkoutUrl` (`string`, required)
644
+ - `object` (`"checkout_session"`, required)
645
+ - `livemode` (`boolean`, required)
646
+
626
647
  ### PreviewChange
627
648
 
628
649
  - `currency` (`string`, required)
@@ -647,6 +668,8 @@ Variants:
647
668
  - `expiresAt` (`string | null`, required)
648
669
  - `isActive` (`boolean`, required)
649
670
  - `redemptionCount` (`number`, required)
671
+ - `firstPurchaseOnly` (`boolean`, required) — Whether the code only applies to a customer's first purchase: one with no paid invoice above zero and no paid subscription.
672
+ - `managedBy` (`ManagedBy`, required) — Integration that manages this record, or null when the merchant does. While an integration manages it, its terms change only in that integration and edits answer 409 managed_by_integration.
650
673
  - `createdAt` (`string`, required)
651
674
  - `updatedAt` (`string`, required)
652
675
  - `object` (`"promo_code"`, required)
@@ -751,6 +774,7 @@ Variants:
751
774
  - `billingDayOfMonth` (`number | null`, required)
752
775
  - `nextBillingDate` (`string | null`, required)
753
776
  - `checkoutUrl` (`string | null`, required)
777
+ - `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.
754
778
  - `createdAt` (`string`, required)
755
779
  - `updatedAt` (`string`, required)
756
780
  - `offerApplications` (`Array<SubscriptionOfferApplication>`, required)
@@ -772,6 +796,19 @@ Variants:
772
796
  - `object` (`"subscription_addon"`, required)
773
797
  - `livemode` (`boolean`, required)
774
798
 
799
+ ### SubscriptionAutoTopUp
800
+
801
+ - `enabled` (`boolean`, required) — Whether credits are bought automatically. Always false when the plan does not sell credits.
802
+ - `threshold` (`number | null`, required) — Credits at or below which a top-up is bought, or null when never configured.
803
+ - `quantity` (`number | null`, required) — Credits each top-up buys, or null when never configured.
804
+ - `maxPerPeriod` (`number | null`, required) — Maximum top-ups per credit renewal period, or null when never configured.
805
+ - `status` (`"active" | "paused" | "off"`, required) — active buys when credits reach 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 succeeds or it is saved enabled again; off buys nothing.
806
+ - `topUpsThisPeriod` (`number`, required) — Top-ups bought in the current credit renewal period.
807
+ - `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.
809
+ - `object` (`"subscription_auto_top_up"`, required)
810
+ - `livemode` (`boolean`, required)
811
+
775
812
  ### SubscriptionOfferApplication
776
813
 
777
814
  - `id` (`string`, required)
@@ -825,6 +862,7 @@ Variants:
825
862
  - `billingDayOfMonth` (`number | null`, required)
826
863
  - `nextBillingDate` (`string | null`, required)
827
864
  - `checkoutUrl` (`string | null`, required)
865
+ - `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.
828
866
  - `createdAt` (`string`, required)
829
867
  - `updatedAt` (`string`, required)
830
868
  - `offerApplications` (`Array<SubscriptionOfferApplication>`, required)
@@ -858,7 +896,7 @@ Variants:
858
896
 
859
897
  ### Transaction
860
898
 
861
- - `paymentContext` (`{ reason: "first_subscription_payment" | "trial_conversion" | "recurring_billing" | "plan_change" | "reactivation" | "subscription_resume" | "one_time_payment" | "overage" | "adjustment"; paymentLinkId: string | null; recovery: { type: "payment_recovery" } | { type: "dunning_retry"; attempt: number; maxAttempts: number } | null } | null`, required) — Charge context captured for new payments. Null for historical payments with no captured context.
899
+ - `paymentContext` (`{ reason: "first_subscription_payment" | "trial_conversion" | "recurring_billing" | "plan_change" | "reactivation" | "subscription_resume" | "one_time_payment" | "overage" | "adjustment" | "addon_activation" | "prepayment"; paymentLinkId: string | null; recovery: { type: "payment_recovery" } | { type: "dunning_retry"; attempt: number; maxAttempts: number } | null } | null`, required) — Charge context captured for new payments. Null for historical payments with no captured context.
862
900
  - `id` (`string`, required)
863
901
  - `invoiceId` (`string | null`, required)
864
902
  - `grossAmount` (`number | null`, required) — Gross amount in USD cents. Null when the provider has not reported an honest USD figure; see presentmentAmount.
@@ -881,7 +919,7 @@ Variants:
881
919
 
882
920
  ### TransactionListItem
883
921
 
884
- - `paymentContext` (`{ reason: "first_subscription_payment" | "trial_conversion" | "recurring_billing" | "plan_change" | "reactivation" | "subscription_resume" | "one_time_payment" | "overage" | "adjustment"; paymentLinkId: string | null; recovery: { type: "payment_recovery" } | { type: "dunning_retry"; attempt: number; maxAttempts: number } | null } | null`, required) — Charge context captured for new payments. Null for historical payments with no captured context.
922
+ - `paymentContext` (`{ reason: "first_subscription_payment" | "trial_conversion" | "recurring_billing" | "plan_change" | "reactivation" | "subscription_resume" | "one_time_payment" | "overage" | "adjustment" | "addon_activation" | "prepayment"; paymentLinkId: string | null; recovery: { type: "payment_recovery" } | { type: "dunning_retry"; attempt: number; maxAttempts: number } | null } | null`, required) — Charge context captured for new payments. Null for historical payments with no captured context.
885
923
  - `id` (`string`, required)
886
924
  - `invoiceId` (`string | null`, required)
887
925
  - `grossAmount` (`number | null`, required) — Gross amount in USD cents. Null when the provider has not reported an honest USD figure; see presentmentAmount.
@@ -928,7 +966,7 @@ Variants:
928
966
  Variants:
929
967
 
930
968
  - `{ 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 }`
931
- - `{ allowed: boolean; subscriptionStatus: string; featureCode: string; quantity: number; reason?: string; message?: string; consumptionModel: "credits"; creditsPerUnit: number; estimatedCredits: number; planCredits: number; purchasedCredits: number; totalCredits: number; 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 }`
932
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 }`
933
971
 
934
972
  ### UsageEvent
@@ -941,7 +979,7 @@ Variants:
941
979
  - `ts` (`string`, required)
942
980
  - `createdAt` (`string`, required)
943
981
  - `properties` (`Array<{ property: string; value: string }>`, required)
944
- - `consumption` (`{ model: "credits" | "balance"; deducted: number; remaining: number; blocked: boolean }`, optional)
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)
945
983
  - `object` (`"usage_event"`, required)
946
984
  - `livemode` (`boolean`, required)
947
985
 
@@ -446,7 +446,7 @@ Commet sends these headers with every webhook request:
446
446
 
447
447
  ## Retry policy
448
448
 
449
- If your endpoint returns a non-2xx status or times out (10 seconds), Commet retries with exponential backoff. The initial delivery counts as the first attempt, followed by up to 7 retries — 8 attempts in total over a window of roughly 8 hours:
449
+ If your endpoint returns a non-2xx status or times out (10 seconds), Commet retries with exponential backoff capped at 1 hour. The initial delivery counts as the first attempt, followed by up to 7 retries — 8 attempts in total over a window of roughly 4 hours:
450
450
 
451
451
  | Retry | Delay after previous attempt |
452
452
  | --------- | ---------------------------- |
@@ -455,8 +455,8 @@ If your endpoint returns a non-2xx status or times out (10 seconds), Commet retr
455
455
  | 3rd retry | 15 minutes |
456
456
  | 4th retry | 30 minutes |
457
457
  | 5th retry | 1 hour |
458
- | 6th retry | 2 hours |
459
- | 7th retry | 4 hours |
458
+ | 6th retry | 1 hour |
459
+ | 7th retry | 1 hour |
460
460
 
461
461
  After 8 failed attempts (the initial delivery plus 7 retries), the delivery is marked as failed and we email your organization's notification recipient with the endpoint URL, event type, and the last response we received (HTTP status or error code).
462
462
 
package/docs/webhooks.md CHANGED
@@ -6,7 +6,7 @@ The complete contract, with every field description and example, is in [webhooks
6
6
 
7
7
  ## subscription.created
8
8
 
9
- Fired when a subscription record is created with status pending_payment. The first charge has not been confirmed yet — do NOT grant access here. Wait for subscription.activated.
9
+ Fired when a subscription record is created, usually with status pending_payment: the first charge has not been confirmed yet — do NOT grant access here; wait for subscription.activated. A trial whose price requires no payment method is created already trialing, together with trial.started.
10
10
 
11
11
  ### Data
12
12
 
@@ -137,7 +137,7 @@ Fired when a subscription is actually terminated. A scheduled cancellation fires
137
137
  - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
138
138
  - `status` (`string`, required) — Always "canceled" for this event. Revoke access when you receive this.
139
139
  - `canceledAt` (`string`, optional) — ISO 8601 datetime when the cancellation was requested or triggered.
140
- - `cancelReason` (`string | null`, required) — The reason for cancellation, if provided. Set to "dunning_exhausted" when all payment retries fail. Historical refund-triggered cancellations may have "refund".
140
+ - `cancelReason` (`string | null`, required) — The reason for cancellation, if provided. Set to "dunning_exhausted" when all payment retries fail, and to "trial_ended_without_payment_method" when a trial without a payment method ends with no card and no default plan. Historical refund-triggered cancellations may have "refund".
141
141
  - `endDate` (`string`, optional) — ISO 8601 datetime when the subscription ended. Matches the billing period end for scheduled cancellations; for immediate terminations it is the moment of termination.
142
142
 
143
143
  ## subscription.updated
@@ -209,7 +209,7 @@ Fired when a plan change (downgrade or shorter interval) is scheduled for the en
209
209
 
210
210
  ## subscription.plan_change_revoked
211
211
 
212
- Fired when a scheduled plan change is replaced by a different one before it executes. The replacement also fires subscription.plan_change_scheduled with the new target plan.
212
+ Fired when a scheduled plan change will no longer take effect: it was revoked through the API, the dashboard or the customer portal, an immediate plan change or an immediate cancellation voided it, or a different change replaced it. A replacement also fires subscription.plan_change_scheduled with the new target plan.
213
213
 
214
214
  ### Data
215
215
 
@@ -235,7 +235,7 @@ Fired when a recurring payment fails on a previously paid subscription and its s
235
235
 
236
236
  ## trial.started
237
237
 
238
- Fired when a subscription enters its trial period after checkout. Grant access here — trialing subscriptions have full access until trialEndsAt.
238
+ Fired when a subscription enters its trial period: after checkout, or right away when the price's trial requires no payment method. Grant access here — trialing subscriptions have full access until trialEndsAt.
239
239
 
240
240
  ### Data
241
241
 
@@ -260,7 +260,7 @@ Fired when a trialing customer converts to a paid subscription before the trial
260
260
 
261
261
  ## trial.expired
262
262
 
263
- Fired when a trial period runs out and the billing cycle activates the subscription. The first regular invoice is generated right after — this is the natural trial-to-paid transition.
263
+ Fired when a trial period runs out. With a payment method the billing cycle activates the subscription and generates the first regular invoice right after — the natural trial-to-paid transition. A trial without a payment method instead moves to the plan group's default plan (subscription.plan_changed) or is canceled with cancelReason trial_ended_without_payment_method (subscription.canceled), without an invoice.
264
264
 
265
265
  ### Data
266
266
 
@@ -286,7 +286,7 @@ Predictive event fired once, 3 days before a trial ends. Use it to remind the cu
286
286
 
287
287
  ## trial.checkout_ready
288
288
 
289
- Fired when a trial checkout link is ready to share with the customer. Completing this checkout saves a payment method and starts the trial (trial.started) — the customer is not charged until the trial ends.
289
+ Fired when a trial checkout link is ready to share with the customer. Completing this checkout saves a payment method and starts the trial (trial.started) — the customer is not charged until the trial ends. Not fired for a trial whose price requires no payment method, which starts without checkout.
290
290
 
291
291
  ### Data
292
292
 
@@ -316,7 +316,7 @@ Fired every time a payment settles successfully — the first payment and every
316
316
 
317
317
  ### Data
318
318
 
319
- - `paymentContext` (`{ reason: "first_subscription_payment" | "trial_conversion" | "recurring_billing" | "plan_change" | "reactivation" | "subscription_resume" | "one_time_payment" | "overage" | "adjustment"; paymentLinkId: string | null; recovery: { type: "payment_recovery" } | { type: "dunning_retry"; attempt: number; maxAttempts: number } | null } | null`, required) — Charge context captured for new payments. Null for historical payments with no captured context.
319
+ - `paymentContext` (`{ reason: "first_subscription_payment" | "trial_conversion" | "recurring_billing" | "plan_change" | "reactivation" | "subscription_resume" | "one_time_payment" | "overage" | "adjustment" | "addon_activation" | "prepayment"; paymentLinkId: string | null; recovery: { type: "payment_recovery" } | { type: "dunning_retry"; attempt: number; maxAttempts: number } | null } | null`, required) — Charge context captured for new payments. Null for historical payments with no captured context.
320
320
  - `invoiceId` (`string`, required) — The invoice ID.
321
321
  - `invoiceNumber` (`string`, required) — The human-readable invoice number.
322
322
  - `invoiceTotal` (`number`, required) — Invoice total in cents (100 = $1.00).
@@ -338,7 +338,7 @@ Fired when an invoice-linked subscription charge fails.
338
338
 
339
339
  ### Data
340
340
 
341
- - `paymentContext` (`{ reason: "first_subscription_payment" | "trial_conversion" | "recurring_billing" | "plan_change" | "reactivation" | "subscription_resume" | "one_time_payment" | "overage" | "adjustment"; paymentLinkId: string | null; recovery: { type: "payment_recovery" } | { type: "dunning_retry"; attempt: number; maxAttempts: number } | null } | null`, required) — Charge context captured for new payments. Null for historical payments with no captured context.
341
+ - `paymentContext` (`{ reason: "first_subscription_payment" | "trial_conversion" | "recurring_billing" | "plan_change" | "reactivation" | "subscription_resume" | "one_time_payment" | "overage" | "adjustment" | "addon_activation" | "prepayment"; paymentLinkId: string | null; recovery: { type: "payment_recovery" } | { type: "dunning_retry"; attempt: number; maxAttempts: number } | null } | null`, required) — Charge context captured for new payments. Null for historical payments with no captured context.
342
342
  - `invoiceId` (`string`, required) — The invoice ID, if available.
343
343
  - `invoiceNumber` (`string`, required) — The human-readable invoice number, if available.
344
344
  - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
@@ -448,7 +448,7 @@ Fired when a payment link is paid. The charge settled and a one-time invoice was
448
448
 
449
449
  ### Data
450
450
 
451
- - `paymentContext` (`{ reason: "first_subscription_payment" | "trial_conversion" | "recurring_billing" | "plan_change" | "reactivation" | "subscription_resume" | "one_time_payment" | "overage" | "adjustment"; paymentLinkId: string | null; recovery: { type: "payment_recovery" } | { type: "dunning_retry"; attempt: number; maxAttempts: number } | null } | null`, required) — Charge context captured for new payments. Null for historical payments with no captured context.
451
+ - `paymentContext` (`{ reason: "first_subscription_payment" | "trial_conversion" | "recurring_billing" | "plan_change" | "reactivation" | "subscription_resume" | "one_time_payment" | "overage" | "adjustment" | "addon_activation" | "prepayment"; paymentLinkId: string | null; recovery: { type: "payment_recovery" } | { type: "dunning_retry"; attempt: number; maxAttempts: number } | null } | null`, required) — Charge context captured for new payments. Null for historical payments with no captured context.
452
452
  - `paymentId` (`string`, required) — The payment link ID.
453
453
  - `status` (`string`, required) — The link status. Always "succeeded" for this event.
454
454
  - `amount` (`number`, required) — The collected amount in cents (100 = $1.00).
@@ -467,7 +467,7 @@ Fired when a payment link charge attempt is declined. The link stays open and ca
467
467
 
468
468
  ### Data
469
469
 
470
- - `paymentContext` (`{ reason: "first_subscription_payment" | "trial_conversion" | "recurring_billing" | "plan_change" | "reactivation" | "subscription_resume" | "one_time_payment" | "overage" | "adjustment"; paymentLinkId: string | null; recovery: { type: "payment_recovery" } | { type: "dunning_retry"; attempt: number; maxAttempts: number } | null } | null`, required) — Charge context captured for new payments. Null for historical payments with no captured context.
470
+ - `paymentContext` (`{ reason: "first_subscription_payment" | "trial_conversion" | "recurring_billing" | "plan_change" | "reactivation" | "subscription_resume" | "one_time_payment" | "overage" | "adjustment" | "addon_activation" | "prepayment"; paymentLinkId: string | null; recovery: { type: "payment_recovery" } | { type: "dunning_retry"; attempt: number; maxAttempts: number } | null } | null`, required) — Charge context captured for new payments. Null for historical payments with no captured context.
471
471
  - `paymentId` (`string`, required) — The payment link ID.
472
472
  - `status` (`string`, required) — The link status. Always "failed" for this event.
473
473
  - `amount` (`number`, required) — The amount that was attempted in cents (100 = $1.00).
@@ -734,7 +734,7 @@ Fired after an active plan grant is durably revoked. The payload is the grant sn
734
734
 
735
735
  ## credits.granted
736
736
 
737
- Fired when non-purchase credits are granted to a subscription: plan-included credits at the start of each billing period, or a manual adjustment from the dashboard. Credit pack purchases fire credits.purchased instead.
737
+ Fired when non-purchase credits are granted to a subscription: plan-included credits at the start of each billing period, or a manual adjustment from the dashboard. Credit purchases through the API, automatic top-ups, or the customer portal fire credits.purchased instead.
738
738
 
739
739
  ### Data
740
740
 
@@ -745,7 +745,7 @@ Fired when non-purchase credits are granted to a subscription: plan-included cre
745
745
 
746
746
  ## credits.purchased
747
747
 
748
- Fired when a customer buys a credit pack through the customer portal and the payment succeeds. Purchased credits never expire — unlike plan credits, they survive period resets. Plan-included credit grants fire credits.granted instead.
748
+ Fired when a customer buys a credit pack or a chosen quantity of credits through the API, an automatic top-up, or the customer portal and the payment succeeds. Purchased credits never expire — unlike plan credits, they survive period resets. Plan-included credit grants fire credits.granted instead.
749
749
 
750
750
  ### Data
751
751
 
@@ -753,7 +753,7 @@ Fired when a customer buys a credit pack through the customer portal and the pay
753
753
  - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
754
754
  - `invoiceId` (`string`, required) — The invoice issued for the purchase.
755
755
  - `invoiceNumber` (`string`, required) — The human-readable invoice number.
756
- - `creditPackName` (`string`, required) — The purchased credit pack's name.
756
+ - `creditPackName` (`string`, required) — The purchased credit pack's name, or Credit purchase for a chosen quantity of credits.
757
757
  - `credits` (`number`, required) — The number of credits purchased.
758
758
 
759
759
  ## credits.low
@@ -780,13 +780,13 @@ Fired when a subscription's credits hit zero. Usage requests that need more cred
780
780
 
781
781
  ## credits.expired
782
782
 
783
- Fired at the period reset when unused plan credits from the previous period are discarded. Plan credits expire at period end; purchased credits never expire and are not affected.
783
+ Fired at a reset when unused plan credits are discarded. On a plan whose unused plan credits expire, every unused plan credit expires at each reset. On a plan that rolls them over, a reset keeps them, up to the plan's maxPlanCredits when it has one, and only the excess expires. A change to another credits plan applies the new plan's terms the same way. Purchased credits never expire and are not affected.
784
784
 
785
785
  ### Data
786
786
 
787
787
  - `subscriptionId` (`string`, required) — The subscription ID.
788
788
  - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
789
- - `expiredCredits` (`number`, required) — The unused plan credits that were discarded.
789
+ - `expiredCredits` (`number`, required) — The plan credits that were discarded.
790
790
 
791
791
  ## balance.topped_up
792
792
 
@@ -3054,7 +3054,9 @@
3054
3054
  "subscription_resume",
3055
3055
  "one_time_payment",
3056
3056
  "overage",
3057
- "adjustment"
3057
+ "adjustment",
3058
+ "addon_activation",
3059
+ "prepayment"
3058
3060
  ],
3059
3061
  "description": "The original reason for the charge. Recovery never replaces this reason."
3060
3062
  },
@@ -3393,7 +3395,9 @@
3393
3395
  "subscription_resume",
3394
3396
  "one_time_payment",
3395
3397
  "overage",
3396
- "adjustment"
3398
+ "adjustment",
3399
+ "addon_activation",
3400
+ "prepayment"
3397
3401
  ],
3398
3402
  "description": "The original reason for the charge. Recovery never replaces this reason."
3399
3403
  },
@@ -4663,7 +4667,9 @@
4663
4667
  "subscription_resume",
4664
4668
  "one_time_payment",
4665
4669
  "overage",
4666
- "adjustment"
4670
+ "adjustment",
4671
+ "addon_activation",
4672
+ "prepayment"
4667
4673
  ],
4668
4674
  "description": "The original reason for the charge. Recovery never replaces this reason."
4669
4675
  },
@@ -4944,7 +4950,9 @@
4944
4950
  "subscription_resume",
4945
4951
  "one_time_payment",
4946
4952
  "overage",
4947
- "adjustment"
4953
+ "adjustment",
4954
+ "addon_activation",
4955
+ "prepayment"
4948
4956
  ],
4949
4957
  "description": "The original reason for the charge. Recovery never replaces this reason."
4950
4958
  },
@@ -10774,7 +10782,9 @@
10774
10782
  "enum": [
10775
10783
  "card",
10776
10784
  "oxxo",
10777
- "mercado_pago"
10785
+ "mercado_pago",
10786
+ "google_pay",
10787
+ "smartpix"
10778
10788
  ]
10779
10789
  },
10780
10790
  "SubPaymentMethod": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commet/node",
3
- "version": "9.6.0",
3
+ "version": "9.8.0",
4
4
  "description": "Commet SDK for Node.js - Billing and usage tracking",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",