@commet/node 9.8.0 → 9.10.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 (75) hide show
  1. package/dist/index.d.mts +1021 -30
  2. package/dist/index.d.ts +1021 -30
  3. package/dist/index.js +204 -11
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +204 -11
  6. package/dist/index.mjs.map +1 -1
  7. package/docs/ai-onboarding/mcp-server.md +2 -0
  8. package/docs/api-reference/addons.md +3 -1
  9. package/docs/api-reference/credit-packs.md +3 -1
  10. package/docs/api-reference/customers.md +2 -0
  11. package/docs/api-reference/generated-webhooks.md +2 -2
  12. package/docs/api-reference/index.md +3 -3
  13. package/docs/api-reference/plans.md +488 -6
  14. package/docs/api-reference/subscriptions.md +50 -8
  15. package/docs/documentation/api-versioning.md +8 -2
  16. package/docs/documentation/cli.md +64 -49
  17. package/docs/documentation/create-api-key.md +3 -1
  18. package/docs/documentation/customers/customer-portal.md +10 -2
  19. package/docs/documentation/customers/manage-customers.md +2 -1
  20. package/docs/documentation/finance/payouts.md +11 -0
  21. package/docs/documentation/finance/supported-countries.md +5 -5
  22. package/docs/documentation/invoicing/handle-failed-payments.md +9 -9
  23. package/docs/documentation/payments/accept-one-time-payments.md +1 -1
  24. package/docs/documentation/payments/payment-orchestration.md +2 -0
  25. package/docs/documentation/payments/payment-providers.md +46 -0
  26. package/docs/documentation/payments/transactions-refunds-and-retries.md +1 -1
  27. package/docs/documentation/plans/add-ons.md +15 -4
  28. package/docs/documentation/plans/consumption-models.md +44 -9
  29. package/docs/documentation/plans/create-plans.md +5 -1
  30. package/docs/documentation/plans/credit-packs.md +61 -3
  31. package/docs/documentation/plans/one-time-payments.md +3 -3
  32. package/docs/documentation/plans/plan-groups.md +46 -10
  33. package/docs/documentation/plans/plan-versions.md +265 -0
  34. package/docs/documentation/platform/dashboard-metrics-and-events.md +40 -9
  35. package/docs/documentation/sales/connect-dub-affiliates.md +52 -0
  36. package/docs/documentation/sales/introductory-offers.md +7 -13
  37. package/docs/documentation/sales/offers.md +10 -6
  38. package/docs/documentation/sales/promo-codes.md +47 -17
  39. package/docs/documentation/sales/promotional-offers.md +6 -7
  40. package/docs/documentation/sales/regional-prices.md +38 -8
  41. package/docs/documentation/sales/trial-periods.md +67 -40
  42. package/docs/documentation/subscriptions/manage-subscriptions.md +114 -14
  43. package/docs/documentation/subscriptions/pay-in-advance.md +4 -7
  44. package/docs/documentation/subscriptions/upgrade-and-downgrade-plans.md +22 -2
  45. package/docs/documentation/testing-sandbox.md +2 -0
  46. package/docs/documentation/usage/track-usage.md +23 -0
  47. package/docs/errors/addon_has_activations.md +2 -2
  48. package/docs/errors/addon_unavailable.md +22 -0
  49. package/docs/errors/credit_pack_unavailable.md +22 -0
  50. package/docs/errors/index.md +9 -2
  51. package/docs/errors/missing_regional_price.md +3 -3
  52. package/docs/errors/plan_balance_limit_reached.md +22 -0
  53. package/docs/errors/plan_experiment_not_found.md +22 -0
  54. package/docs/errors/plan_version_not_found.md +22 -0
  55. package/docs/errors/subscribers_do_not_fit.md +22 -0
  56. package/docs/errors/version_not_newer.md +22 -0
  57. package/docs/knowledge-base/how-do-credits-credit-packs-and-customer-credits-differ.md +8 -8
  58. package/docs/knowledge-base/how-do-discounts-work.md +7 -5
  59. package/docs/knowledge-base/how-do-free-plans-work-without-payment.md +18 -11
  60. package/docs/knowledge-base/how-do-offers-promo-codes-and-card-promotions-work-together.md +1 -1
  61. package/docs/knowledge-base/how-do-trial-periods-work.md +31 -25
  62. package/docs/knowledge-base/how-does-billing-work.md +26 -27
  63. package/docs/knowledge-base/how-does-quota-based-billing-work.md +12 -22
  64. package/docs/knowledge-base/how-does-seat-based-billing-work.md +12 -22
  65. package/docs/knowledge-base/what-happens-when-a-customer-changes-plans.md +11 -8
  66. package/docs/knowledge-base/what-happens-when-a-payment-fails.md +11 -9
  67. package/docs/knowledge-base/what-happens-when-you-change-your-prices.md +34 -29
  68. package/docs/knowledge-base/what-invoices-do-customers-receive-and-when.md +1 -1
  69. package/docs/manifest.json +201 -2
  70. package/docs/platform-documentation.md +2 -0
  71. package/docs/schemas.md +134 -14
  72. package/docs/webhooks/introduction.md +17 -13
  73. package/docs/webhooks.md +66 -6
  74. package/docs/webhooks.openapi.json +1218 -876
  75. 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": 96,
15
+ "count": 98,
16
16
  "entries": [
17
17
  "documentation/introduction.md",
18
18
  "documentation/create-api-key.md",
@@ -39,6 +39,7 @@
39
39
  "documentation/customers/customer-credits.md",
40
40
  "documentation/customers/customer-portal.md",
41
41
  "documentation/plans/create-plans.md",
42
+ "documentation/plans/plan-versions.md",
42
43
  "documentation/plans/add-ons.md",
43
44
  "documentation/plans/configure-features.md",
44
45
  "documentation/plans/consumption-models.md",
@@ -51,6 +52,7 @@
51
52
  "documentation/sales/promotional-offers.md",
52
53
  "documentation/sales/introductory-offers.md",
53
54
  "documentation/sales/promo-codes.md",
55
+ "documentation/sales/connect-dub-affiliates.md",
54
56
  "documentation/sales/regional-prices.md",
55
57
  "documentation/sales/trial-periods.md",
56
58
  "documentation/subscriptions/manage-subscriptions.md",
@@ -114,7 +116,7 @@
114
116
  },
115
117
  "errorReferences": {
116
118
  "index": "errors/index.md",
117
- "count": 87,
119
+ "count": 94,
118
120
  "entries": [
119
121
  {
120
122
  "code": "validation_error",
@@ -182,6 +184,18 @@
182
184
  "documentation": "errors/plan_not_found.md",
183
185
  "canonicalUrl": "/docs/api-reference/2026-08-27/errors/plan_not_found.md"
184
186
  },
187
+ {
188
+ "code": "plan_version_not_found",
189
+ "type": "not_found_error",
190
+ "documentation": "errors/plan_version_not_found.md",
191
+ "canonicalUrl": "/docs/api-reference/2026-08-27/errors/plan_version_not_found.md"
192
+ },
193
+ {
194
+ "code": "plan_experiment_not_found",
195
+ "type": "not_found_error",
196
+ "documentation": "errors/plan_experiment_not_found.md",
197
+ "canonicalUrl": "/docs/api-reference/2026-08-27/errors/plan_experiment_not_found.md"
198
+ },
185
199
  {
186
200
  "code": "subscription_not_found",
187
201
  "type": "not_found_error",
@@ -248,6 +262,12 @@
248
262
  "documentation": "errors/already_scheduled.md",
249
263
  "canonicalUrl": "/docs/api-reference/2026-08-27/errors/already_scheduled.md"
250
264
  },
265
+ {
266
+ "code": "subscribers_do_not_fit",
267
+ "type": "conflict_error",
268
+ "documentation": "errors/subscribers_do_not_fit.md",
269
+ "canonicalUrl": "/docs/api-reference/2026-08-27/errors/subscribers_do_not_fit.md"
270
+ },
251
271
  {
252
272
  "code": "feature_not_in_plan",
253
273
  "type": "billing_error",
@@ -290,6 +310,12 @@
290
310
  "documentation": "errors/plan_credit_limit_reached.md",
291
311
  "canonicalUrl": "/docs/api-reference/2026-08-27/errors/plan_credit_limit_reached.md"
292
312
  },
313
+ {
314
+ "code": "plan_balance_limit_reached",
315
+ "type": "billing_error",
316
+ "documentation": "errors/plan_balance_limit_reached.md",
317
+ "canonicalUrl": "/docs/api-reference/2026-08-27/errors/plan_balance_limit_reached.md"
318
+ },
293
319
  {
294
320
  "code": "missing_regional_price",
295
321
  "type": "billing_error",
@@ -422,6 +448,12 @@
422
448
  "documentation": "errors/no_change_requested.md",
423
449
  "canonicalUrl": "/docs/api-reference/2026-08-27/errors/no_change_requested.md"
424
450
  },
451
+ {
452
+ "code": "version_not_newer",
453
+ "type": "validation_error",
454
+ "documentation": "errors/version_not_newer.md",
455
+ "canonicalUrl": "/docs/api-reference/2026-08-27/errors/version_not_newer.md"
456
+ },
425
457
  {
426
458
  "code": "plans_not_in_same_group",
427
459
  "type": "validation_error",
@@ -470,6 +502,12 @@
470
502
  "documentation": "errors/addon_has_activations.md",
471
503
  "canonicalUrl": "/docs/api-reference/2026-08-27/errors/addon_has_activations.md"
472
504
  },
505
+ {
506
+ "code": "addon_unavailable",
507
+ "type": "conflict_error",
508
+ "documentation": "errors/addon_unavailable.md",
509
+ "canonicalUrl": "/docs/api-reference/2026-08-27/errors/addon_unavailable.md"
510
+ },
473
511
  {
474
512
  "code": "feature_already_exists",
475
513
  "type": "conflict_error",
@@ -500,6 +538,12 @@
500
538
  "documentation": "errors/credit_pack_not_found.md",
501
539
  "canonicalUrl": "/docs/api-reference/2026-08-27/errors/credit_pack_not_found.md"
502
540
  },
541
+ {
542
+ "code": "credit_pack_unavailable",
543
+ "type": "conflict_error",
544
+ "documentation": "errors/credit_pack_unavailable.md",
545
+ "canonicalUrl": "/docs/api-reference/2026-08-27/errors/credit_pack_unavailable.md"
546
+ },
503
547
  {
504
548
  "code": "plan_group_not_found",
505
549
  "type": "not_found_error",
@@ -1113,6 +1157,78 @@
1113
1157
  "name": "plans",
1114
1158
  "documentation": "api-reference/plans.md",
1115
1159
  "operations": [
1160
+ {
1161
+ "name": "publishDraft",
1162
+ "operationId": "publish-plan-draft",
1163
+ "method": "POST",
1164
+ "path": "/plans/{id}/drafts/{draftId}/publish"
1165
+ },
1166
+ {
1167
+ "name": "getDraft",
1168
+ "operationId": "get-plan-draft",
1169
+ "method": "GET",
1170
+ "path": "/plans/{id}/drafts/{draftId}"
1171
+ },
1172
+ {
1173
+ "name": "updateDraft",
1174
+ "operationId": "update-plan-draft",
1175
+ "method": "PATCH",
1176
+ "path": "/plans/{id}/drafts/{draftId}"
1177
+ },
1178
+ {
1179
+ "name": "deleteDraft",
1180
+ "operationId": "delete-plan-draft",
1181
+ "method": "DELETE",
1182
+ "path": "/plans/{id}/drafts/{draftId}"
1183
+ },
1184
+ {
1185
+ "name": "listDrafts",
1186
+ "operationId": "list-plan-drafts",
1187
+ "method": "GET",
1188
+ "path": "/plans/{id}/drafts"
1189
+ },
1190
+ {
1191
+ "name": "createDraft",
1192
+ "operationId": "create-plan-draft",
1193
+ "method": "POST",
1194
+ "path": "/plans/{id}/drafts"
1195
+ },
1196
+ {
1197
+ "name": "archiveExperiment",
1198
+ "operationId": "archive-plan-experiment",
1199
+ "method": "POST",
1200
+ "path": "/plans/{id}/experiments/{code}/archive"
1201
+ },
1202
+ {
1203
+ "name": "makeExperimentCurrent",
1204
+ "operationId": "make-plan-experiment-current",
1205
+ "method": "POST",
1206
+ "path": "/plans/{id}/experiments/{code}/make-current"
1207
+ },
1208
+ {
1209
+ "name": "getExperiment",
1210
+ "operationId": "get-plan-experiment",
1211
+ "method": "GET",
1212
+ "path": "/plans/{id}/experiments/{code}"
1213
+ },
1214
+ {
1215
+ "name": "createExperimentVersion",
1216
+ "operationId": "create-plan-experiment-version",
1217
+ "method": "POST",
1218
+ "path": "/plans/{id}/experiments/{code}/versions"
1219
+ },
1220
+ {
1221
+ "name": "listExperiments",
1222
+ "operationId": "list-plan-experiments",
1223
+ "method": "GET",
1224
+ "path": "/plans/{id}/experiments"
1225
+ },
1226
+ {
1227
+ "name": "createExperiment",
1228
+ "operationId": "create-plan-experiment",
1229
+ "method": "POST",
1230
+ "path": "/plans/{id}/experiments"
1231
+ },
1116
1232
  {
1117
1233
  "name": "updateFeature",
1118
1234
  "operationId": "update-plan-feature",
@@ -1131,6 +1247,48 @@
1131
1247
  "method": "POST",
1132
1248
  "path": "/plans/{id}/features"
1133
1249
  },
1250
+ {
1251
+ "name": "cancelMove",
1252
+ "operationId": "cancel-plan-move",
1253
+ "method": "POST",
1254
+ "path": "/plans/{id}/moves/{moveId}/cancel"
1255
+ },
1256
+ {
1257
+ "name": "getMove",
1258
+ "operationId": "get-plan-move",
1259
+ "method": "GET",
1260
+ "path": "/plans/{id}/moves/{moveId}"
1261
+ },
1262
+ {
1263
+ "name": "cancelMoveSubscription",
1264
+ "operationId": "cancel-plan-move-subscription",
1265
+ "method": "POST",
1266
+ "path": "/plans/{id}/moves/{moveId}/subscriptions/{subscriptionId}/cancel"
1267
+ },
1268
+ {
1269
+ "name": "listMoves",
1270
+ "operationId": "list-plan-moves",
1271
+ "method": "GET",
1272
+ "path": "/plans/{id}/moves"
1273
+ },
1274
+ {
1275
+ "name": "createMove",
1276
+ "operationId": "create-plan-move",
1277
+ "method": "POST",
1278
+ "path": "/plans/{id}/moves"
1279
+ },
1280
+ {
1281
+ "name": "keepSubscriberOnVersion",
1282
+ "operationId": "keep-plan-subscriber-on-version",
1283
+ "method": "POST",
1284
+ "path": "/plans/{id}/needs-a-change/{subscriptionId}/keep"
1285
+ },
1286
+ {
1287
+ "name": "listSubscribersNeedingAChange",
1288
+ "operationId": "list-plan-subscribers-needing-a-change",
1289
+ "method": "GET",
1290
+ "path": "/plans/{id}/needs-a-change"
1291
+ },
1134
1292
  {
1135
1293
  "name": "setDefaultPrice",
1136
1294
  "operationId": "set-default-plan-price",
@@ -1191,6 +1349,30 @@
1191
1349
  "method": "DELETE",
1192
1350
  "path": "/plans/{id}"
1193
1351
  },
1352
+ {
1353
+ "name": "compareVersions",
1354
+ "operationId": "compare-plan-versions",
1355
+ "method": "GET",
1356
+ "path": "/plans/{id}/versions/{versionId}/changes"
1357
+ },
1358
+ {
1359
+ "name": "getVersion",
1360
+ "operationId": "get-plan-version",
1361
+ "method": "GET",
1362
+ "path": "/plans/{id}/versions/{versionId}"
1363
+ },
1364
+ {
1365
+ "name": "listVersions",
1366
+ "operationId": "list-plan-versions",
1367
+ "method": "GET",
1368
+ "path": "/plans/{id}/versions"
1369
+ },
1370
+ {
1371
+ "name": "createVersion",
1372
+ "operationId": "create-plan-version",
1373
+ "method": "POST",
1374
+ "path": "/plans/{id}/versions"
1375
+ },
1194
1376
  {
1195
1377
  "name": "setVisibility",
1196
1378
  "operationId": "set-plan-visibility",
@@ -1347,6 +1529,12 @@
1347
1529
  "method": "POST",
1348
1530
  "path": "/subscriptions/{id}/change-plan"
1349
1531
  },
1532
+ {
1533
+ "name": "changeVersion",
1534
+ "operationId": "change-subscription-version",
1535
+ "method": "POST",
1536
+ "path": "/subscriptions/{id}/change-version"
1537
+ },
1350
1538
  {
1351
1539
  "name": "purchaseCredits",
1352
1540
  "operationId": "purchase-credits",
@@ -1431,6 +1619,12 @@
1431
1619
  "method": "DELETE",
1432
1620
  "path": "/subscriptions/{id}/scheduled-plan-change"
1433
1621
  },
1622
+ {
1623
+ "name": "revokeScheduledVersionChange",
1624
+ "operationId": "revoke-scheduled-version-change",
1625
+ "method": "DELETE",
1626
+ "path": "/subscriptions/{id}/scheduled-version-change"
1627
+ },
1434
1628
  {
1435
1629
  "name": "uncancel",
1436
1630
  "operationId": "uncancel-subscription",
@@ -1631,6 +1825,8 @@
1631
1825
  "subscription.cancellation_revoked",
1632
1826
  "subscription.plan_change_scheduled",
1633
1827
  "subscription.plan_change_revoked",
1828
+ "subscription.version_changed",
1829
+ "subscription.version_change_canceled",
1634
1830
  "subscription.past_due",
1635
1831
  "trial.started",
1636
1832
  "trial.converted",
@@ -1655,6 +1851,7 @@
1655
1851
  "invoice.upcoming",
1656
1852
  "payment_method.attached",
1657
1853
  "payment_method.updated",
1854
+ "payment_method.detached",
1658
1855
  "customer.created",
1659
1856
  "customer.updated",
1660
1857
  "customer.state_changed",
@@ -1667,9 +1864,11 @@
1667
1864
  "credits.low",
1668
1865
  "credits.depleted",
1669
1866
  "credits.expired",
1867
+ "balance.granted",
1670
1868
  "balance.topped_up",
1671
1869
  "balance.low",
1672
1870
  "balance.depleted",
1871
+ "balance.expired",
1673
1872
  "quota.threshold_reached",
1674
1873
  "quota.exceeded",
1675
1874
  "seats.updated",
@@ -27,6 +27,7 @@ This documentation snapshot is serialized from the source of commet.co/docs and
27
27
  - [documentation/customers/customer-credits.md](./documentation/customers/customer-credits.md)
28
28
  - [documentation/customers/customer-portal.md](./documentation/customers/customer-portal.md)
29
29
  - [documentation/plans/create-plans.md](./documentation/plans/create-plans.md)
30
+ - [documentation/plans/plan-versions.md](./documentation/plans/plan-versions.md)
30
31
  - [documentation/plans/add-ons.md](./documentation/plans/add-ons.md)
31
32
  - [documentation/plans/configure-features.md](./documentation/plans/configure-features.md)
32
33
  - [documentation/plans/consumption-models.md](./documentation/plans/consumption-models.md)
@@ -39,6 +40,7 @@ This documentation snapshot is serialized from the source of commet.co/docs and
39
40
  - [documentation/sales/promotional-offers.md](./documentation/sales/promotional-offers.md)
40
41
  - [documentation/sales/introductory-offers.md](./documentation/sales/introductory-offers.md)
41
42
  - [documentation/sales/promo-codes.md](./documentation/sales/promo-codes.md)
43
+ - [documentation/sales/connect-dub-affiliates.md](./documentation/sales/connect-dub-affiliates.md)
42
44
  - [documentation/sales/regional-prices.md](./documentation/sales/regional-prices.md)
43
45
  - [documentation/sales/trial-periods.md](./documentation/sales/trial-periods.md)
44
46
  - [documentation/subscriptions/manage-subscriptions.md](./documentation/subscriptions/manage-subscriptions.md)
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
 
@@ -168,6 +169,12 @@ Generated from Commet API version `2026-08-27`.
168
169
  - `object` (`"balance_topup"`, required)
169
170
  - `livemode` (`boolean`, required)
170
171
 
172
+ ### BusinessTaxId
173
+
174
+ - `country` (`string`, required)
175
+ - `type` (`string`, required)
176
+ - `value` (`string`, required)
177
+
171
178
  ### ClaimLink
172
179
 
173
180
  - `url` (`string`, required)
@@ -208,6 +215,7 @@ Generated from Commet API version `2026-08-27`.
208
215
  - `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.
209
216
  - `createdAt` (`string`, required)
210
217
  - `updatedAt` (`string`, required)
218
+ - `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.
211
219
  - `offerApplications` (`Array<SubscriptionOfferApplication>`, required)
212
220
  - `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)
213
221
  - `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.
@@ -241,6 +249,7 @@ Generated from Commet API version `2026-08-27`.
241
249
  - `description` (`string | null`, required)
242
250
  - `credits` (`number`, required)
243
251
  - `price` (`number`, required)
252
+ - `planIds` (`Array<string>`, required) — Plans that sell the credit pack.
244
253
  - `isActive` (`boolean`, required)
245
254
  - `createdAt` (`string`, required)
246
255
  - `updatedAt` (`string`, required)
@@ -254,6 +263,7 @@ Generated from Commet API version `2026-08-27`.
254
263
  - `description` (`string | null`, required)
255
264
  - `credits` (`number`, required)
256
265
  - `price` (`number`, required)
266
+ - `planIds` (`Array<string>`, required) — Plans that sell the credit pack.
257
267
  - `currency` (`string`, required)
258
268
  - `object` (`"credit_pack"`, required)
259
269
  - `livemode` (`boolean`, required)
@@ -266,6 +276,7 @@ Generated from Commet API version `2026-08-27`.
266
276
  - `email` (`string`, required)
267
277
  - `taxDocument` (`string | null`, required)
268
278
  - `documentType` (`string | null`, required)
279
+ - `businessTaxId` (`BusinessTaxId | null`, required)
269
280
  - `timezone` (`string | null`, required)
270
281
  - `metadata` (`Record<string, unknown> | null`, required)
271
282
  - `createdAt` (`string`, required)
@@ -414,6 +425,13 @@ Variants:
414
425
  - `object` (`"invoice"`, required)
415
426
  - `livemode` (`boolean`, required)
416
427
 
428
+ ### KeptOnVersion
429
+
430
+ - `subscriptionId` (`string`, required)
431
+ - `keptOnVersion` (`true`, required)
432
+ - `object` (`"kept_on_version"`, required)
433
+ - `livemode` (`boolean`, required)
434
+
417
435
  ### ManagedBy
418
436
 
419
437
  Variants:
@@ -514,9 +532,11 @@ Variants:
514
532
  - `isPublic` (`boolean`, required)
515
533
  - `isDefault` (`boolean`, required)
516
534
  - `isFree` (`boolean`, required)
517
- - `blockOnExhaustion` (`boolean | null`, required)
535
+ - `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
536
  - `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
537
  - `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.
538
+ - `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.
539
+ - `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
540
  - `sortOrder` (`number`, required)
521
541
  - `planGroupId` (`string | null`, required)
522
542
  - `metadata` (`Record<string, unknown> | null`, required)
@@ -525,6 +545,7 @@ Variants:
525
545
  - `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)
526
546
  - `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)
527
547
  - `exchangeRates` (`Array<{ currency: string; exchangeRate: number }>`, required)
548
+ - `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.
528
549
  - `object` (`"plan"`, required)
529
550
  - `livemode` (`boolean`, required)
530
551
 
@@ -536,6 +557,46 @@ Variants:
536
557
  - `{ 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 }`
537
558
  - `{ 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 }`
538
559
 
560
+ ### PlanDraft
561
+
562
+ - `id` (`string`, required) — Public plan draft ID.
563
+ - `fromVersionId` (`string`, required) — The version the draft started from.
564
+ - `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.
565
+ - `createdAt` (`string`, required)
566
+ - `updatedAt` (`string`, required)
567
+ - `object` (`"plan_draft"`, required)
568
+ - `livemode` (`boolean`, required)
569
+
570
+ ### PlanDraftPublication
571
+
572
+ - `preview` (`boolean`, required)
573
+ - `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.
574
+ - `moveId` (`string | null`, required) — The move of subscribers, if any.
575
+ - `subscribers` (`{ moving: number; keptOnVersion: number; needsAChange: number; leftOut: Array<{ subscriptionId: string; code: string; message: string }> } | null`, required)
576
+ - `object` (`"plan_draft_publication"`, required)
577
+ - `livemode` (`boolean`, required)
578
+
579
+ ### PlanExperiment
580
+
581
+ - `id` (`string`, required) — Public plan experiment ID.
582
+ - `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.
583
+ - `status` (`"running" | "won" | "archived"`, required) — running sells its latest version; won became the plan's current version; archived stopped selling.
584
+ - `startedFromVersionId` (`string`, required) — The plan's version that was current when it started.
585
+ - `latestVersionId` (`string`, required) — Its latest version.
586
+ - `sellsVersionId` (`string`, required) — The version its code sells to new buyers today.
587
+ - `subscriptionCount` (`number`, required) — Active, trialing, past due and paused subscriptions on its versions.
588
+ - `createdAt` (`string`, required)
589
+ - `closedAt` (`string | null`, required)
590
+ - `object` (`"plan_experiment"`, required)
591
+ - `livemode` (`boolean`, required)
592
+
593
+ ### PlanExperimentArchive
594
+
595
+ - `experiment` (`{ id: string; code: string; status: "running" | "won" | "archived"; startedFromVersionId: string; latestVersionId: string; sellsVersionId: string; subscriptionCount: number; createdAt: string; closedAt: string | null }`, required)
596
+ - `moveId` (`string | null`, required) — The move of its subscribers, or null when they stay.
597
+ - `object` (`"plan_experiment_archive"`, required)
598
+ - `livemode` (`boolean`, required)
599
+
539
600
  ### PlanFeature
540
601
 
541
602
  - `planId` (`string`, required)
@@ -595,6 +656,22 @@ Variants:
595
656
  - `object` (`"plan_group"`, required)
596
657
  - `livemode` (`boolean`, required)
597
658
 
659
+ ### PlanMove
660
+
661
+ - `id` (`string | null`, required) — Public move ID. Null for a preview, which records nothing.
662
+ - `toVersionId` (`string`, required)
663
+ - `fromVersionIds` (`Array<string>`, required) — The versions its subscribers are moving from.
664
+ - `effective` (`"now" | "period_end"`, required)
665
+ - `preview` (`boolean`, required)
666
+ - `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.
667
+ - `counts` (`{ moving: number; moved: number; needsAChange: number; leftOut: number; canceled: number; keptOnVersion: number }`, required)
668
+ - `subscriptions` (`Array<{ subscriptionId: string; status: "moving" | "moved" | "needs_a_change" | "left_out" | "canceled" | "kept_on_version"; code: string | null; message: string | null }>`, required)
669
+ - `createdAt` (`string | null`, required)
670
+ - `completedAt` (`string | null`, required)
671
+ - `canceledAt` (`string | null`, required)
672
+ - `object` (`"plan_move"`, required)
673
+ - `livemode` (`boolean`, required)
674
+
598
675
  ### PlanPrice
599
676
 
600
677
  - `id` (`string`, required) — Public plan price ID.
@@ -632,6 +709,30 @@ Variants:
632
709
  - `object` (`"plan_regional_pricing"`, required)
633
710
  - `livemode` (`boolean`, required)
634
711
 
712
+ ### PlanVersion
713
+
714
+ - `id` (`string`, required) — Public plan version ID.
715
+ - `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.
716
+ - `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.
717
+ - `experiment` (`{ code: string; version: number } | null`, required) — The experiment this version belongs to, if any.
718
+ - `isCurrent` (`boolean`, required) — Whether new buyers get this version.
719
+ - `parentVersionId` (`string | null`, required) — The version this one was created from.
720
+ - `subscriptionCount` (`number`, required) — Active, trialing, past due and paused subscriptions on it.
721
+ - `maxPlanCredits` (`number | null`, required)
722
+ - `maxPlanBalance` (`number | null`, required)
723
+ - `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)
724
+ - `createdAt` (`string`, required)
725
+ - `object` (`"plan_version"`, required)
726
+ - `livemode` (`boolean`, required)
727
+
728
+ ### PlanVersionComparison
729
+
730
+ - `versionId` (`string`, required) — The version the changes start from.
731
+ - `againstVersionId` (`string`, required) — The version they end at.
732
+ - `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.
733
+ - `object` (`"plan_version_comparison"`, required)
734
+ - `livemode` (`boolean`, required)
735
+
635
736
  ### PortalAccess
636
737
 
637
738
  - `portalUrl` (`string`, required)
@@ -654,6 +755,7 @@ Variants:
654
755
  - `daysRemaining` (`number`, required)
655
756
  - `totalDays` (`number`, required)
656
757
  - `isUpgrade` (`boolean`, required)
758
+ - `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.
657
759
  - `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)
658
760
  - `object` (`"plan_change_preview"`, required)
659
761
  - `livemode` (`boolean`, required)
@@ -755,6 +857,17 @@ Variants:
755
857
  - `object` (`"invoice_delivery"`, required)
756
858
  - `livemode` (`boolean`, required)
757
859
 
860
+ ### SubscriberNeedingAChange
861
+
862
+ - `subscriptionId` (`string`, required)
863
+ - `moveId` (`string`, required) — The move it could not complete.
864
+ - `fromVersionId` (`string`, required) — The version it stays on.
865
+ - `toVersionId` (`string`, required) — The version it could not move to.
866
+ - `code` (`string`, required) — Why it could not move.
867
+ - `message` (`string`, required)
868
+ - `object` (`"subscriber_needing_a_change"`, required)
869
+ - `livemode` (`boolean`, required)
870
+
758
871
  ### Subscription
759
872
 
760
873
  - `id` (`string`, required)
@@ -777,13 +890,15 @@ Variants:
777
890
  - `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.
778
891
  - `createdAt` (`string`, required)
779
892
  - `updatedAt` (`string`, required)
893
+ - `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.
780
894
  - `offerApplications` (`Array<SubscriptionOfferApplication>`, required)
781
895
  - `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)
896
+ - `scheduledVersionChange` (`{ planVersionId: string; label: string; effectiveAt: string } | null`, required) — A move to another version of the plan pending for the next renewal.
782
897
  - `planGrant` (`{ id: string; plan: { id: string; name: string }; expiresAt: string | null }`, optional)
783
898
  - `consumptionModel` (`ConsumptionModel | null`, required)
784
899
  - `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)
900
+ - `credits` (`{ remaining: number; included: number; purchased: number; plan: number; total: number } | null`, required)
901
+ - `balance` (`{ remaining: number; included: number; currency: string; plan: number; purchased: number; total: number } | null`, required)
787
902
  - `priceId` (`string | null`, required)
788
903
  - `object` (`"subscription"`, required)
789
904
  - `livemode` (`boolean`, required)
@@ -798,14 +913,15 @@ Variants:
798
913
 
799
914
  ### SubscriptionAutoTopUp
800
915
 
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.
916
+ - `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.
917
+ - `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.
918
+ - `quantity` (`number | null`, required) — Credits each top-up buys on a credits plan, or null when never configured or on a balance plan.
919
+ - `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.
920
+ - `maxPerPeriod` (`number | null`, required) — Maximum top-ups per renewal period, or null when never configured.
921
+ - `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.
922
+ - `topUpsThisPeriod` (`number`, required) — Top-ups made in the current renewal period.
807
923
  - `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.
924
+ - `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
925
  - `object` (`"subscription_auto_top_up"`, required)
810
926
  - `livemode` (`boolean`, required)
811
927
 
@@ -865,6 +981,7 @@ Variants:
865
981
  - `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.
866
982
  - `createdAt` (`string`, required)
867
983
  - `updatedAt` (`string`, required)
984
+ - `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.
868
985
  - `offerApplications` (`Array<SubscriptionOfferApplication>`, required)
869
986
  - `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)
870
987
  - `priceId` (`string | null`, required)
@@ -966,8 +1083,8 @@ Variants:
966
1083
  Variants:
967
1084
 
968
1085
  - `{ 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 }`
1086
+ - `{ 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 }`
1087
+ - `{ 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
1088
 
972
1089
  ### UsageEvent
973
1090
 
@@ -979,7 +1096,7 @@ Variants:
979
1096
  - `ts` (`string`, required)
980
1097
  - `createdAt` (`string`, required)
981
1098
  - `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)
1099
+ - `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
1100
  - `object` (`"usage_event"`, required)
984
1101
  - `livemode` (`boolean`, required)
985
1102
 
@@ -1027,7 +1144,10 @@ Variants:
1027
1144
 
1028
1145
  ### WebhookBalance
1029
1146
 
1030
- - `currentBalance` (`number`, required)
1147
+ - `currentBalance` (`number`, required) — The available balance, plan plus purchased, in rate scale. Equal to totalBalance.
1148
+ - `planBalance` (`number`, required) — The plan part in rate scale: spent first, replaced or rolled over at each reset, negative while overage is owed.
1149
+ - `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.
1150
+ - `totalBalance` (`number`, required) — planBalance plus purchasedBalance, in rate scale.
1031
1151
 
1032
1152
  ### WebhookBankRef
1033
1153