@commet/node 9.0.0 → 9.1.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 (294) hide show
  1. package/README.md +2 -0
  2. package/dist/index.d.mts +333 -111
  3. package/dist/index.d.ts +333 -111
  4. package/dist/index.js +162 -40
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +162 -40
  7. package/dist/index.mjs.map +1 -1
  8. package/docs/README.md +20 -0
  9. package/docs/ai-onboarding/ai-onboarding.md +90 -0
  10. package/docs/ai-onboarding/billing-best-practices-skill.md +29 -0
  11. package/docs/ai-onboarding/commet-skill.md +58 -0
  12. package/docs/ai-onboarding/mcp-server.md +207 -0
  13. package/docs/ai-onboarding/meta.json +17 -0
  14. package/docs/ai-onboarding/pricing-models-skill.md +29 -0
  15. package/docs/ai-onboarding/subscription-patterns-skill.md +29 -0
  16. package/docs/api-reference/addons.md +127 -0
  17. package/docs/api-reference/api-keys.md +57 -0
  18. package/docs/api-reference/credit-packs.md +80 -0
  19. package/docs/api-reference/customers.md +274 -0
  20. package/docs/api-reference/feature-access.md +36 -0
  21. package/docs/api-reference/features.md +94 -0
  22. package/docs/api-reference/generated-webhooks.md +120 -0
  23. package/docs/api-reference/index.md +31 -0
  24. package/docs/api-reference/invoices.md +123 -0
  25. package/docs/api-reference/markets.md +92 -0
  26. package/docs/api-reference/meta.json +7 -0
  27. package/docs/api-reference/offers.md +104 -0
  28. package/docs/api-reference/payments.md +106 -0
  29. package/docs/api-reference/payouts.md +66 -0
  30. package/docs/api-reference/plan-groups.md +157 -0
  31. package/docs/api-reference/plans.md +358 -0
  32. package/docs/api-reference/portal.md +30 -0
  33. package/docs/api-reference/promo-codes.md +86 -0
  34. package/docs/api-reference/provisioning.md +19 -0
  35. package/docs/api-reference/quota.md +120 -0
  36. package/docs/api-reference/seats.md +123 -0
  37. package/docs/api-reference/subscriptions.md +387 -0
  38. package/docs/api-reference/test-clock.md +59 -0
  39. package/docs/api-reference/transactions.md +78 -0
  40. package/docs/api-reference/usage.md +83 -0
  41. package/docs/documentation/api-versioning.md +100 -0
  42. package/docs/documentation/better-auth.md +361 -0
  43. package/docs/documentation/choose-a-billing-model.md +38 -0
  44. package/docs/documentation/cli.md +1024 -0
  45. package/docs/documentation/create-api-key.md +47 -0
  46. package/docs/documentation/customers/customer-credits.md +48 -0
  47. package/docs/documentation/customers/customer-portal.md +107 -0
  48. package/docs/documentation/customers/manage-customers.md +346 -0
  49. package/docs/documentation/customers/meta.json +5 -0
  50. package/docs/documentation/error-handling.md +239 -0
  51. package/docs/documentation/examples.md +37 -0
  52. package/docs/documentation/finance/acceptable-use.md +145 -0
  53. package/docs/documentation/finance/finance-overview.md +32 -0
  54. package/docs/documentation/finance/local-currency-taxes.md +40 -0
  55. package/docs/documentation/finance/merchant-of-record.md +48 -0
  56. package/docs/documentation/finance/meta.json +13 -0
  57. package/docs/documentation/finance/payouts-verification.md +186 -0
  58. package/docs/documentation/finance/payouts.md +41 -0
  59. package/docs/documentation/finance/supported-countries.md +28 -0
  60. package/docs/documentation/go/integrate-with-encore.md +229 -0
  61. package/docs/documentation/go/integrate-with-go.md +258 -0
  62. package/docs/documentation/go/meta.json +5 -0
  63. package/docs/documentation/introduction.md +58 -0
  64. package/docs/documentation/invoicing/handle-failed-payments.md +283 -0
  65. package/docs/documentation/invoicing/invoices-and-billing-cycles.md +73 -0
  66. package/docs/documentation/invoicing/manage-invoices.md +340 -0
  67. package/docs/documentation/invoicing/meta.json +9 -0
  68. package/docs/documentation/java/integrate-with-java.md +117 -0
  69. package/docs/documentation/java/meta.json +5 -0
  70. package/docs/documentation/meta.json +36 -0
  71. package/docs/documentation/nodejs/integrate-with-astro.md +129 -0
  72. package/docs/documentation/nodejs/integrate-with-bun.md +113 -0
  73. package/docs/documentation/nodejs/integrate-with-express.md +127 -0
  74. package/docs/documentation/nodejs/integrate-with-hono.md +141 -0
  75. package/docs/documentation/nodejs/integrate-with-nextjs.md +118 -0
  76. package/docs/documentation/nodejs/integrate-with-nuxt.md +125 -0
  77. package/docs/documentation/nodejs/integrate-with-remix.md +136 -0
  78. package/docs/documentation/nodejs/integrate-with-sveltekit.md +127 -0
  79. package/docs/documentation/nodejs/meta.json +14 -0
  80. package/docs/documentation/payments/accept-one-time-payments.md +314 -0
  81. package/docs/documentation/payments/meta.json +10 -0
  82. package/docs/documentation/payments/payment-orchestration.md +43 -0
  83. package/docs/documentation/payments/payment-providers.md +59 -0
  84. package/docs/documentation/payments/transactions-refunds-and-retries.md +199 -0
  85. package/docs/documentation/php/integrate-with-laravel.md +222 -0
  86. package/docs/documentation/php/integrate-with-php.md +103 -0
  87. package/docs/documentation/php/integrate-with-symfony.md +214 -0
  88. package/docs/documentation/php/meta.json +9 -0
  89. package/docs/documentation/plans/add-ons.md +257 -0
  90. package/docs/documentation/plans/balance-and-top-ups.md +169 -0
  91. package/docs/documentation/plans/configure-features.md +335 -0
  92. package/docs/documentation/plans/consumption-models.md +93 -0
  93. package/docs/documentation/plans/create-plans.md +162 -0
  94. package/docs/documentation/plans/credit-packs.md +89 -0
  95. package/docs/documentation/plans/meta.json +14 -0
  96. package/docs/documentation/plans/one-time-payments.md +142 -0
  97. package/docs/documentation/plans/plan-groups.md +31 -0
  98. package/docs/documentation/platform/custom-domains.md +27 -0
  99. package/docs/documentation/platform/dashboard-metrics-and-events.md +25 -0
  100. package/docs/documentation/platform/members-and-permissions.md +21 -0
  101. package/docs/documentation/platform/meta.json +10 -0
  102. package/docs/documentation/platform/organization-settings.md +29 -0
  103. package/docs/documentation/python/integrate-with-django.md +161 -0
  104. package/docs/documentation/python/integrate-with-fastapi.md +164 -0
  105. package/docs/documentation/python/integrate-with-flask.md +153 -0
  106. package/docs/documentation/python/integrate-with-python.md +90 -0
  107. package/docs/documentation/python/meta.json +10 -0
  108. package/docs/documentation/sales/card-promotions.md +41 -0
  109. package/docs/documentation/sales/introductory-offers.md +64 -0
  110. package/docs/documentation/sales/meta.json +13 -0
  111. package/docs/documentation/sales/offers.md +65 -0
  112. package/docs/documentation/sales/promo-codes.md +65 -0
  113. package/docs/documentation/sales/promotional-offers.md +58 -0
  114. package/docs/documentation/sales/regional-prices.md +100 -0
  115. package/docs/documentation/sales/trial-periods.md +88 -0
  116. package/docs/documentation/sdk-reference.md +68 -0
  117. package/docs/documentation/subscriptions/manage-subscriptions.md +505 -0
  118. package/docs/documentation/subscriptions/meta.json +9 -0
  119. package/docs/documentation/subscriptions/plan-grants.md +132 -0
  120. package/docs/documentation/subscriptions/upgrade-and-downgrade-plans.md +35 -0
  121. package/docs/documentation/testing-sandbox.md +251 -0
  122. package/docs/documentation/usage/ai-token-billing.md +294 -0
  123. package/docs/documentation/usage/meta.json +10 -0
  124. package/docs/documentation/usage/quota-management.md +341 -0
  125. package/docs/documentation/usage/seat-management.md +377 -0
  126. package/docs/documentation/usage/track-usage.md +282 -0
  127. package/docs/errors/addon_already_active.md +22 -0
  128. package/docs/errors/addon_has_activations.md +22 -0
  129. package/docs/errors/addon_not_active.md +22 -0
  130. package/docs/errors/addon_not_found.md +22 -0
  131. package/docs/errors/already_has_active_subscription.md +22 -0
  132. package/docs/errors/already_scheduled.md +22 -0
  133. package/docs/errors/api_key_not_found.md +22 -0
  134. package/docs/errors/card_promotions_not_available.md +22 -0
  135. package/docs/errors/charge_failed.md +22 -0
  136. package/docs/errors/charge_in_progress.md +22 -0
  137. package/docs/errors/claim_not_pending.md +22 -0
  138. package/docs/errors/credit_pack_not_found.md +22 -0
  139. package/docs/errors/customer_not_found.md +22 -0
  140. package/docs/errors/duplicate.md +22 -0
  141. package/docs/errors/endpoint_deprecated.md +22 -0
  142. package/docs/errors/endpoint_not_available.md +22 -0
  143. package/docs/errors/feature_already_exists.md +22 -0
  144. package/docs/errors/feature_disabled.md +22 -0
  145. package/docs/errors/feature_in_use.md +22 -0
  146. package/docs/errors/feature_not_found.md +22 -0
  147. package/docs/errors/feature_not_in_plan.md +22 -0
  148. package/docs/errors/forbidden.md +22 -0
  149. package/docs/errors/free_plan_change_not_supported.md +22 -0
  150. package/docs/errors/idempotency_in_progress.md +22 -0
  151. package/docs/errors/idempotency_key_mismatch.md +22 -0
  152. package/docs/errors/idempotency_unavailable.md +22 -0
  153. package/docs/errors/included_limit_reached.md +22 -0
  154. package/docs/errors/index.md +89 -0
  155. package/docs/errors/insufficient_balance.md +22 -0
  156. package/docs/errors/insufficient_credits.md +22 -0
  157. package/docs/errors/insufficient_seats.md +22 -0
  158. package/docs/errors/internal_error.md +22 -0
  159. package/docs/errors/invalid_json.md +22 -0
  160. package/docs/errors/invalid_subscription_status.md +22 -0
  161. package/docs/errors/invoice_not_found.md +22 -0
  162. package/docs/errors/market_group_in_use.md +22 -0
  163. package/docs/errors/market_group_not_found.md +22 -0
  164. package/docs/errors/market_in_use.md +22 -0
  165. package/docs/errors/market_not_found.md +22 -0
  166. package/docs/errors/missing_regional_price.md +22 -0
  167. package/docs/errors/model_not_found.md +22 -0
  168. package/docs/errors/no_active_subscription.md +22 -0
  169. package/docs/errors/no_change_requested.md +22 -0
  170. package/docs/errors/no_outstanding_invoice.md +22 -0
  171. package/docs/errors/no_payment_method.md +22 -0
  172. package/docs/errors/no_prices_configured.md +22 -0
  173. package/docs/errors/not_found.md +22 -0
  174. package/docs/errors/not_scheduled_for_cancellation.md +22 -0
  175. package/docs/errors/offer_not_applicable.md +22 -0
  176. package/docs/errors/offer_not_found.md +22 -0
  177. package/docs/errors/one_time_subscription_not_cancelable.md +22 -0
  178. package/docs/errors/organization_already_claimed.md +22 -0
  179. package/docs/errors/payment_failed.md +22 -0
  180. package/docs/errors/payment_method_not_found.md +22 -0
  181. package/docs/errors/payment_not_cancelable.md +22 -0
  182. package/docs/errors/payment_not_found.md +22 -0
  183. package/docs/errors/payouts_not_available_in_sandbox.md +22 -0
  184. package/docs/errors/plan_change_scheduled.md +22 -0
  185. package/docs/errors/plan_group_not_found.md +22 -0
  186. package/docs/errors/plan_not_found.md +22 -0
  187. package/docs/errors/plan_unavailable.md +22 -0
  188. package/docs/errors/plans_not_in_same_group.md +22 -0
  189. package/docs/errors/price_in_use.md +22 -0
  190. package/docs/errors/price_not_found.md +22 -0
  191. package/docs/errors/pricing_mode_mismatch.md +22 -0
  192. package/docs/errors/promo_code_expired.md +22 -0
  193. package/docs/errors/promo_code_not_found.md +22 -0
  194. package/docs/errors/provider_unsupported.md +22 -0
  195. package/docs/errors/rate_limited.md +22 -0
  196. package/docs/errors/sandbox_only.md +22 -0
  197. package/docs/errors/seat_limit_exceeded.md +22 -0
  198. package/docs/errors/subscription_activation_failed.md +22 -0
  199. package/docs/errors/subscription_already_canceled.md +22 -0
  200. package/docs/errors/subscription_cancel_failed.md +22 -0
  201. package/docs/errors/subscription_creation_failed.md +22 -0
  202. package/docs/errors/subscription_has_open_dispute.md +22 -0
  203. package/docs/errors/subscription_not_active.md +22 -0
  204. package/docs/errors/subscription_not_found.md +22 -0
  205. package/docs/errors/subscription_required.md +22 -0
  206. package/docs/errors/subscription_uncancel_failed.md +22 -0
  207. package/docs/errors/transaction_not_found.md +22 -0
  208. package/docs/errors/unauthorized.md +22 -0
  209. package/docs/errors/validation_error.md +22 -0
  210. package/docs/errors/webhook_not_found.md +22 -0
  211. package/docs/errors.md +34 -0
  212. package/docs/getting-started.md +35 -0
  213. package/docs/knowledge-base/how-do-balance-and-top-ups-work.md +22 -0
  214. package/docs/knowledge-base/how-do-credits-credit-packs-and-customer-credits-differ.md +20 -0
  215. package/docs/knowledge-base/how-do-discounts-work.md +65 -0
  216. package/docs/knowledge-base/how-do-free-plans-work-without-payment.md +88 -0
  217. package/docs/knowledge-base/how-do-monthly-quarterly-and-yearly-billing-work.md +77 -0
  218. package/docs/knowledge-base/how-do-offers-promo-codes-and-card-promotions-work-together.md +20 -0
  219. package/docs/knowledge-base/how-do-trial-periods-work.md +54 -0
  220. package/docs/knowledge-base/how-does-billing-work.md +73 -0
  221. package/docs/knowledge-base/how-does-payment-routing-work.md +17 -0
  222. package/docs/knowledge-base/how-does-quota-based-billing-work.md +106 -0
  223. package/docs/knowledge-base/how-does-seat-based-billing-work.md +88 -0
  224. package/docs/knowledge-base/how-is-proration-calculated-when-changing-plans.md +89 -0
  225. package/docs/knowledge-base/meta.json +29 -0
  226. package/docs/knowledge-base/what-happens-when-a-customer-changes-plans.md +110 -0
  227. package/docs/knowledge-base/what-happens-when-a-payment-fails.md +40 -0
  228. package/docs/knowledge-base/what-happens-when-you-change-your-prices.md +74 -0
  229. package/docs/knowledge-base/what-happens-when-you-refund-or-retry-a-transaction.md +21 -0
  230. package/docs/knowledge-base/what-invoices-do-customers-receive-and-when.md +101 -0
  231. package/docs/manifest.json +1677 -0
  232. package/docs/meta.json +11 -0
  233. package/docs/platform-documentation.md +175 -0
  234. package/docs/schemas.md +995 -0
  235. package/docs/webhooks/addon-activated.md +44 -0
  236. package/docs/webhooks/addon-deactivated.md +40 -0
  237. package/docs/webhooks/balance-depleted.md +37 -0
  238. package/docs/webhooks/balance-low.md +39 -0
  239. package/docs/webhooks/balance-topped-up.md +41 -0
  240. package/docs/webhooks/checkout-ready.md +43 -0
  241. package/docs/webhooks/credits-depleted.md +35 -0
  242. package/docs/webhooks/credits-expired.md +35 -0
  243. package/docs/webhooks/credits-granted.md +37 -0
  244. package/docs/webhooks/credits-low.md +39 -0
  245. package/docs/webhooks/credits-purchased.md +41 -0
  246. package/docs/webhooks/customer-created.md +49 -0
  247. package/docs/webhooks/customer-state-changed.md +134 -0
  248. package/docs/webhooks/customer-updated.md +49 -0
  249. package/docs/webhooks/introduction.md +499 -0
  250. package/docs/webhooks/invoice-created.md +45 -0
  251. package/docs/webhooks/invoice-overdue.md +53 -0
  252. package/docs/webhooks/invoice-upcoming.md +43 -0
  253. package/docs/webhooks/invoice-voided.md +53 -0
  254. package/docs/webhooks/meta.json +78 -0
  255. package/docs/webhooks/payment-dispute-resolved.md +52 -0
  256. package/docs/webhooks/payment-disputed.md +49 -0
  257. package/docs/webhooks/payment-failed.md +37 -0
  258. package/docs/webhooks/payment-link-canceled.md +41 -0
  259. package/docs/webhooks/payment-link-completed.md +47 -0
  260. package/docs/webhooks/payment-link-created.md +41 -0
  261. package/docs/webhooks/payment-link-failed.md +45 -0
  262. package/docs/webhooks/payment-method-attached.md +40 -0
  263. package/docs/webhooks/payment-method-updated.md +38 -0
  264. package/docs/webhooks/payment-received.md +45 -0
  265. package/docs/webhooks/payment-recovered.md +39 -0
  266. package/docs/webhooks/payment-refunded.md +47 -0
  267. package/docs/webhooks/payment-retry-failed.md +39 -0
  268. package/docs/webhooks/payout-available.md +33 -0
  269. package/docs/webhooks/payout-created.md +48 -0
  270. package/docs/webhooks/payout-failed.md +52 -0
  271. package/docs/webhooks/payout-paid.md +48 -0
  272. package/docs/webhooks/quota-exceeded.md +44 -0
  273. package/docs/webhooks/quota-threshold-reached.md +41 -0
  274. package/docs/webhooks/seats-limit-reached.md +39 -0
  275. package/docs/webhooks/seats-updated.md +39 -0
  276. package/docs/webhooks/subscription-activated.md +43 -0
  277. package/docs/webhooks/subscription-canceled.md +57 -0
  278. package/docs/webhooks/subscription-cancellation-revoked.md +37 -0
  279. package/docs/webhooks/subscription-cancellation-scheduled.md +45 -0
  280. package/docs/webhooks/subscription-created.md +35 -0
  281. package/docs/webhooks/subscription-past-due.md +43 -0
  282. package/docs/webhooks/subscription-plan-change-revoked.md +50 -0
  283. package/docs/webhooks/subscription-plan-change-scheduled.md +55 -0
  284. package/docs/webhooks/subscription-plan-changed.md +43 -0
  285. package/docs/webhooks/subscription-reactivated.md +53 -0
  286. package/docs/webhooks/subscription-updated.md +39 -0
  287. package/docs/webhooks/trial-checkout-ready.md +39 -0
  288. package/docs/webhooks/trial-converted.md +39 -0
  289. package/docs/webhooks/trial-expired.md +39 -0
  290. package/docs/webhooks/trial-started.md +46 -0
  291. package/docs/webhooks/trial-will-end.md +41 -0
  292. package/docs/webhooks/usage-recorded.md +41 -0
  293. package/docs/webhooks.md +782 -0
  294. package/package.json +2 -1
@@ -0,0 +1,782 @@
1
+ # Webhooks
2
+
3
+ Generated from Commet API version `2026-07-31`.
4
+
5
+ ## subscription.created
6
+
7
+ 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.
8
+
9
+ ### Data
10
+
11
+ - `subscriptionId` (`string`, required) — The subscription ID.
12
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
13
+ - `planId` (`string`, required) — The plan ID.
14
+ - `planName` (`string`, required) — The plan name.
15
+ - `status` (`string`, required) — Current status. One of: draft, pending_payment, trialing, active, past_due, canceled. Access is granted while trialing, active, or past_due — past_due is a permissive grace window during dunning, where you decide whether to keep serving the customer or block them.
16
+ - `startDate` (`string`, required) — ISO 8601 datetime when the subscription starts.
17
+ - `name` (`string | null`, required) — Optional custom name for the subscription.
18
+
19
+ ## subscription.activated
20
+
21
+ Fired once, when the subscription's first charge succeeds and it becomes active — this is where you grant access. Never re-fired on renewals; use payment.received for per-charge notifications.
22
+
23
+ ### Data
24
+
25
+ - `subscriptionId` (`string`, required) — The subscription ID.
26
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
27
+ - `status` (`string`, required) — Current status. One of: draft, pending_payment, trialing, active, past_due, canceled. Access is granted while trialing, active, or past_due — past_due is a permissive grace window during dunning, where you decide whether to keep serving the customer or block them.
28
+ - `currentPeriodStart` (`string`, optional) — ISO 8601 start of the current billing period.
29
+ - `currentPeriodEnd` (`string`, optional) — ISO 8601 end of the current billing period.
30
+ - `name` (`string | null`, required) — Optional custom name for the subscription.
31
+ - `invoiceId` (`string`, required) — The invoice ID for this payment.
32
+ - `invoiceNumber` (`string`, required) — The human-readable invoice number.
33
+ - `invoiceTotal` (`number`, required) — Invoice total in cents (100 = $1.00).
34
+ - `invoiceCurrency` (`string`, required) — The invoice currency code.
35
+ - `provider` (`"stripe" | "commet" | "dlocal" | null`, required) — The payment provider that processed the activating charge: stripe, commet, or dlocal. Null when the subscription activated without a charge (zero-total or setup-based activation).
36
+
37
+ ## subscription.reactivated
38
+
39
+ Fired when a canceled subscription is reactivated and its reactivation charge succeeds. The subscription returns to active with a fresh invoice and a billing period anchored to the reactivation date. Distinct from subscription.activated (first activation) and payment.recovered (past_due recovery, which keeps the original anchor).
40
+
41
+ ### Data
42
+
43
+ - `subscriptionId` (`string`, required) — The subscription ID.
44
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
45
+ - `status` (`string`, required) — Always "active" for this event. Restore access here.
46
+ - `currentPeriodStart` (`string`, optional) — ISO 8601 start of the new billing period, anchored to the reactivation date.
47
+ - `currentPeriodEnd` (`string`, optional) — ISO 8601 end of the new billing period.
48
+ - `name` (`string | null`, required) — Optional custom name for the subscription.
49
+ - `invoiceId` (`string`, required) — The fresh reactivation invoice ID.
50
+ - `invoiceNumber` (`string`, required) — The human-readable invoice number.
51
+ - `invoiceTotal` (`number`, required) — Invoice total in cents (100 = $1.00).
52
+ - `invoiceCurrency` (`string`, required) — The invoice currency code.
53
+ - `provider` (`"stripe" | "commet" | "dlocal"`, required) — The payment provider that processed the reactivation charge: stripe, commet, or dlocal.
54
+
55
+ ## subscription.canceled
56
+
57
+ Fired when a subscription is actually terminated. A scheduled cancellation fires it at the end of the billing period; immediate cancellations, full refunds (cancelReason refund), and exhausted dunning retries (cancelReason dunning_exhausted) fire it right away. The status is now canceled and access should be revoked. This event is NOT fired when cancellation is scheduled — that triggers subscription.updated instead. See the cancellation lifecycle below.
58
+
59
+ ### Data
60
+
61
+ - `subscriptionId` (`string`, required) — The subscription ID.
62
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
63
+ - `status` (`string`, required) — Always "canceled" for this event. Revoke access when you receive this.
64
+ - `canceledAt` (`string`, optional) — ISO 8601 datetime when the cancellation was requested or triggered.
65
+ - `cancelReason` (`string | null`, required) — The reason for cancellation, if provided. Set by Commet on system-initiated terminations: "refund" (full refund of a subscription invoice) or "dunning_exhausted" (all payment retries failed).
66
+ - `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.
67
+
68
+ ## subscription.updated
69
+
70
+ Fired when subscription details change. The most common trigger is scheduling a cancellation — when a customer cancels, the status stays "active" until the billing period ends, but canceledAt and endDate are set immediately. Use this event to show "your subscription will end on {endDate}" in your UI. Access should NOT be revoked here — wait for subscription.canceled.
71
+
72
+ ### Data
73
+
74
+ - `subscriptionId` (`string`, required) — The subscription ID.
75
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
76
+ - `status` (`string`, required) — Current status. When cancellation is scheduled, this is still "active" — the subscription remains usable until endDate.
77
+ - `canceledAt` (`string`, optional) — ISO 8601 datetime when cancellation was requested. Present when cancellation is scheduled, null otherwise.
78
+ - `cancelReason` (`string | null`, required) — The reason for cancellation, if provided.
79
+ - `endDate` (`string`, optional) — ISO 8601 datetime when the subscription will end. Present when cancellation is scheduled — this is the date access should be revoked (via subscription.canceled).
80
+
81
+ ## subscription.plan_changed
82
+
83
+ Fired when a subscription changes from one plan to another, including upgrades, downgrades, and billing interval changes. Access does not change on this event — the subscription stays active.
84
+
85
+ ### Data
86
+
87
+ - `subscriptionId` (`string`, required) — The subscription ID.
88
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
89
+ - `previousPlan` (`WebhookPlanRef`, required) — The previous plan (id and name).
90
+ - `currentPlan` (`WebhookPlanRef`, required) — The new plan (id and name).
91
+ - `billingInterval` (`string | null`, required) — The billing interval (monthly, yearly).
92
+ - `credit` (`number`, required) — Prorated credit in cents from the previous plan.
93
+ - `charge` (`number`, required) — Prorated charge in cents for the new plan.
94
+ - `totalCharged` (`number`, required) — Total amount charged in cents.
95
+
96
+ ## subscription.cancellation_scheduled
97
+
98
+ Fired when a cancellation is scheduled for the end of the billing period. The subscription stays active until effectiveAt — do NOT revoke access here. subscription.updated also fires for backward compatibility.
99
+
100
+ ### Data
101
+
102
+ - `subscriptionId` (`string`, required) — The subscription ID.
103
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
104
+ - `status` (`string`, required) — Still "active" — the subscription remains usable until effectiveAt.
105
+ - `canceledAt` (`string`, optional) — ISO 8601 datetime when the cancellation was requested.
106
+ - `cancelReason` (`string | null`, required) — The reason for cancellation, if provided.
107
+ - `effectiveAt` (`string`, required) — ISO 8601 datetime when the cancellation will execute (the billing period end). subscription.canceled fires at this moment.
108
+
109
+ ## subscription.cancellation_revoked
110
+
111
+ Fired when a scheduled cancellation is reverted before it executes. The subscription continues on its current plan and billing period as if it had never been canceled.
112
+
113
+ ### Data
114
+
115
+ - `subscriptionId` (`string`, required) — The subscription ID.
116
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
117
+ - `status` (`string`, required) — Current status — typically "active". The scheduled cancellation no longer applies.
118
+ - `currentPeriodEnd` (`string`, optional) — ISO 8601 end of the current billing period, which continues normally.
119
+
120
+ ## subscription.plan_change_scheduled
121
+
122
+ Fired when a plan change (downgrade or shorter interval) is scheduled for the end of the billing period. The subscription stays on the current plan until effectiveAt, when subscription.plan_changed fires.
123
+
124
+ ### Data
125
+
126
+ - `subscriptionId` (`string`, required) — The subscription ID.
127
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
128
+ - `status` (`string`, required) — Current status — the subscription stays usable.
129
+ - `currentPlan` (`WebhookPlanRef`, required) — The plan currently in effect (id and name).
130
+ - `scheduledPlan` (`WebhookPlanRef`, required) — The plan that takes effect at effectiveAt (id and name).
131
+ - `billingInterval` (`string | null`, required) — The current billing interval.
132
+ - `scheduledBillingInterval` (`string | null`, required) — The new billing interval, if the change includes one. Null when only the plan changes.
133
+ - `effectiveAt` (`string`, required) — ISO 8601 datetime when the change executes (the billing period end).
134
+
135
+ ## subscription.plan_change_revoked
136
+
137
+ 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.
138
+
139
+ ### Data
140
+
141
+ - `subscriptionId` (`string`, required) — The subscription ID.
142
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
143
+ - `status` (`string`, required) — Current status — the subscription stays usable.
144
+ - `currentPlan` (`WebhookPlanRef`, required) — The plan currently in effect (id and name).
145
+ - `revokedPlan` (`WebhookPlanRef`, required) — The previously scheduled plan that will no longer take effect (id and name).
146
+ - `billingInterval` (`string | null`, required) — The current billing interval.
147
+ - `revokedBillingInterval` (`string | null`, required) — The previously scheduled billing interval, if the revoked change included one.
148
+
149
+ ## subscription.past_due
150
+
151
+ Fired when a recurring payment fails on a previously paid subscription and its status becomes past_due. past_due is a grace window, not a cutoff: usage and seats keep working while new purchases are blocked, and dunning retries the charge — use this to notify the customer and recover the payment.
152
+
153
+ ### Data
154
+
155
+ - `subscriptionId` (`string`, required) — The subscription ID.
156
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
157
+ - `status` (`string`, required) — Always "past_due" for this event.
158
+ - `invoiceId` (`string`, required) — The invoice whose payment failure triggered the status.
159
+ - `invoiceNumber` (`string`, required) — The human-readable invoice number.
160
+
161
+ ## trial.started
162
+
163
+ Fired when a subscription enters its trial period after checkout. Grant access here — trialing subscriptions have full access until trialEndsAt.
164
+
165
+ ### Data
166
+
167
+ - `subscriptionId` (`string`, required) — The subscription ID.
168
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
169
+ - `status` (`string`, required) — Always "trialing" for this event.
170
+ - `planId` (`string`, required) — The plan ID.
171
+ - `planName` (`string`, required) — The plan name.
172
+ - `trialEndsAt` (`string`, required) — ISO 8601 datetime when the trial ends.
173
+
174
+ ## trial.converted
175
+
176
+ Fired when a trialing customer converts to a paid subscription before the trial ends — today this happens when they change plan during the trial, which charges the full new plan price immediately. Trials that simply run out fire trial.expired instead.
177
+
178
+ ### Data
179
+
180
+ - `subscriptionId` (`string`, required) — The subscription ID.
181
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
182
+ - `status` (`string`, required) — Always "active" for this event.
183
+ - `planId` (`string`, required) — The plan ID the customer converted to.
184
+ - `planName` (`string`, required) — The plan name.
185
+
186
+ ## trial.expired
187
+
188
+ 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.
189
+
190
+ ### Data
191
+
192
+ - `subscriptionId` (`string`, required) — The subscription ID.
193
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
194
+ - `status` (`string`, required) — Current status — "active" once the billing cycle has activated the subscription.
195
+ - `planId` (`string`, required) — The plan ID.
196
+ - `planName` (`string`, required) — The plan name.
197
+ - `trialEndsAt` (`string`, required) — ISO 8601 datetime when the trial ended.
198
+
199
+ ## trial.will_end
200
+
201
+ Predictive event fired once, 3 days before a trial ends. Use it to remind the customer that billing starts soon. Emitted by a daily scan with a deterministic idempotency key, so it never fires twice for the same trial end date.
202
+
203
+ ### Data
204
+
205
+ - `subscriptionId` (`string`, required) — The subscription ID.
206
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
207
+ - `status` (`string`, required) — Always "trialing" for this event.
208
+ - `planId` (`string`, required) — The plan ID.
209
+ - `planName` (`string`, required) — The plan name.
210
+ - `trialEndsAt` (`string`, required) — ISO 8601 datetime when the trial will end.
211
+
212
+ ## trial.checkout_ready
213
+
214
+ 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.
215
+
216
+ ### Data
217
+
218
+ - `subscriptionId` (`string`, required) — The subscription ID.
219
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
220
+ - `planName` (`string`, required) — The plan name.
221
+ - `trialDays` (`number`, required) — The length of the trial in days.
222
+ - `checkoutUrl` (`string`, required) — The hosted checkout URL to share with the customer.
223
+
224
+ ## checkout.ready
225
+
226
+ Fired when a checkout link for a subscription's first invoice is ready to share with the customer. Commet also emails the link — use this event to deliver it through your own channels.
227
+
228
+ ### Data
229
+
230
+ - `subscriptionId` (`string`, required) — The subscription ID.
231
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
232
+ - `invoiceId` (`string`, required) — The invoice this checkout collects.
233
+ - `invoiceNumber` (`string`, required) — The human-readable invoice number.
234
+ - `invoiceTotal` (`number`, required) — Invoice total in cents (100 = $1.00).
235
+ - `invoiceCurrency` (`string`, required) — The invoice currency code.
236
+ - `checkoutUrl` (`string`, required) — The hosted checkout URL to share with the customer.
237
+
238
+ ## payment.received
239
+
240
+ Fired every time a payment settles successfully — the first payment and every renewal alike. subscription.activated fires alongside it only on the first one.
241
+
242
+ ### Data
243
+
244
+ - `invoiceId` (`string`, required) — The invoice ID.
245
+ - `invoiceNumber` (`string`, required) — The human-readable invoice number.
246
+ - `invoiceTotal` (`number`, required) — Invoice total in cents (100 = $1.00).
247
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
248
+ - `subscriptionId` (`string | null`, required) — The subscription ID.
249
+ - `paymentTransactionId` (`string | null`, required) — The payment transaction ID.
250
+ - `provider` (`"stripe" | "commet" | "dlocal" | null`, required) — The payment provider the charge was routed to: stripe, commet, or dlocal. Null for billing-only charges with no Commet ledger row.
251
+ - `grossAmount` (`number | null`, required) — Gross amount in cents before fees.
252
+ - `currency` (`string | null`, required) — The payment currency code.
253
+ - `orgNetAmount` (`number | null`, required) — Net amount after fees in cents.
254
+ - `customerEmail` (`string | null`, required) — The customer email used for this payment.
255
+ - `paidAt` (`string`, optional) — ISO 8601 datetime when the payment was received.
256
+
257
+ ## payment.failed
258
+
259
+ Fired when a recurring charge fails. This event is for recurring charge failures only — card declines during initial checkout do not trigger this event.
260
+
261
+ ### Data
262
+
263
+ - `invoiceId` (`string`, required) — The invoice ID, if available.
264
+ - `invoiceNumber` (`string`, required) — The human-readable invoice number, if available.
265
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
266
+ - `subscriptionId` (`string | null`, required) — The subscription ID, if the invoice is linked to a subscription.
267
+ - `provider` (`"stripe" | "commet" | "dlocal"`, required) — The payment provider the charge was routed to: stripe, commet, or dlocal.
268
+ - `failureCode` (`string`, required) — The failure code from the payment processor.
269
+ - `failureMessage` (`string`, required) — A human-readable failure message.
270
+ - `recoveryUrl` (`string | null`, required) — A ready-to-use link the customer can follow to retry this payment, or null when no recovery path applies. For a first failed charge (pending_payment) it is the checkout URL; for a failed renewal (past_due) it is a signed recovery link — no separate createRecoveryLink call needed.
271
+
272
+ ## payment.recovered
273
+
274
+ Fired when an outstanding invoice that previously failed is successfully paid — automatically on retry or by the customer through the portal. The subscription returns to active at the same time; use this event to close the dunning flow you opened on payment.failed.
275
+
276
+ ### Data
277
+
278
+ - `invoiceId` (`string`, required) — The recovered invoice ID.
279
+ - `invoiceNumber` (`string`, required) — The human-readable invoice number.
280
+ - `invoiceTotal` (`number`, required) — Invoice total in cents (100 = $1.00).
281
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
282
+ - `subscriptionId` (`string | null`, required) — The subscription ID, if the invoice is linked to a subscription.
283
+ - `provider` (`"stripe" | "commet" | "dlocal" | null`, required) — The payment provider that recovered the payment, or null when the invoice was recovered without a processor charge.
284
+
285
+ ## payment.retry_failed
286
+
287
+ Fired when all dunning retries are exhausted and the subscription is canceled. This is the terminal event of the dunning flow — payment.recovered will not follow. Revoke access when you receive this.
288
+
289
+ ### Data
290
+
291
+ - `invoiceId` (`string`, required) — The invoice whose retries were exhausted.
292
+ - `invoiceNumber` (`string`, required) — The human-readable invoice number.
293
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
294
+ - `subscriptionId` (`string`, required) — The subscription ID.
295
+ - `provider` (`"stripe" | "commet" | "dlocal"`, required) — The payment provider the charge was routed to: stripe, commet, or dlocal.
296
+ - `reason` (`string`, required) — Terminal dunning reason, usually the last processor decline code or "dunning_exhausted".
297
+
298
+ ## payment.refunded
299
+
300
+ Fired when a payment is refunded, fully or partially. A full refund of a subscription invoice also cancels the subscription immediately (subscription.canceled fires with reason refund); partial refunds leave the subscription untouched.
301
+
302
+ ### Data
303
+
304
+ - `paymentTransactionId` (`string`, required) — The refunded payment transaction ID.
305
+ - `provider` (`"stripe" | "commet" | "dlocal"`, required) — The payment provider the charge was routed to: stripe, commet, or dlocal.
306
+ - `paymentLinkId` (`string | null`, required) — The payment link the payment originated from, or null when the payment did not come from a payment link.
307
+ - `invoiceId` (`string | null`, required) — The invoice the payment collected, or null for payments without an invoice.
308
+ - `invoiceNumber` (`string | null`, required) — The human-readable invoice number, if available.
309
+ - `customerId` (`string | null`, required) — The customer ID, when the payment is linked to an invoice. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
310
+ - `subscriptionId` (`string | null`, required) — The subscription ID, if the invoice is linked to a subscription.
311
+ - `refundAmount` (`number`, required) — The refunded amount in cents (100 = $1.00).
312
+ - `currency` (`string`, required) — The refund currency code.
313
+
314
+ ## payment.disputed
315
+
316
+ Fired when a cardholder opens a dispute (chargeback) against a payment. The disputed amount is frozen from your payout balance while the dispute is open; Commet, as the Merchant of Record, handles the resolution process. payment.dispute_resolved fires with the outcome.
317
+
318
+ ### Data
319
+
320
+ - `paymentTransactionId` (`string`, required) — The disputed payment transaction ID.
321
+ - `provider` (`"stripe" | "commet" | "dlocal"`, required) — The payment provider the charge was routed to: stripe, commet, or dlocal.
322
+ - `paymentLinkId` (`string | null`, required) — The payment link the payment originated from, or null when the payment did not come from a payment link.
323
+ - `invoiceId` (`string | null`, required) — The invoice the payment collected, or null for payments without an invoice.
324
+ - `invoiceNumber` (`string | null`, required) — The human-readable invoice number, if available.
325
+ - `customerId` (`string | null`, required) — The customer ID, when the payment is linked to an invoice. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
326
+ - `subscriptionId` (`string | null`, required) — The subscription ID, if the invoice is linked to a subscription.
327
+ - `disputeAmount` (`number`, required) — The contested amount in cents (100 = $1.00).
328
+ - `currency` (`string`, required) — The dispute currency code.
329
+ - `disputeReason` (`string | null`, required) — The provider's reason code (e.g. fraudulent, product_not_received), or null when none is given.
330
+
331
+ ## payment.dispute_resolved
332
+
333
+ Fired when a dispute is closed. Carries the same identifiers as payment.disputed plus the outcome: won restores the frozen amount to your balance, lost keeps the chargeback deducted.
334
+
335
+ ### Data
336
+
337
+ - `paymentTransactionId` (`string`, required) — The disputed payment transaction ID.
338
+ - `provider` (`"stripe" | "commet" | "dlocal"`, required) — The payment provider the charge was routed to: stripe, commet, or dlocal.
339
+ - `paymentLinkId` (`string | null`, required) — The payment link the payment originated from, or null when the payment did not come from a payment link.
340
+ - `invoiceId` (`string | null`, required) — The invoice the payment collected, or null for payments without an invoice.
341
+ - `invoiceNumber` (`string | null`, required) — The human-readable invoice number, if available.
342
+ - `customerId` (`string | null`, required) — The customer ID, when the payment is linked to an invoice. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
343
+ - `subscriptionId` (`string | null`, required) — The subscription ID, if the invoice is linked to a subscription.
344
+ - `disputeAmount` (`number`, required) — The contested amount in cents (100 = $1.00).
345
+ - `currency` (`string`, required) — The dispute currency code.
346
+ - `disputeReason` (`string | null`, required) — The provider's reason code, or null when none is given.
347
+ - `outcome` (`string`, required) — The resolution: "won" or "lost".
348
+
349
+ ## payment_link.created
350
+
351
+ Fired when a payment link is created. The link is pending — the customer has not paid yet. Do NOT fulfill here; wait for payment_link.completed.
352
+
353
+ ### Data
354
+
355
+ - `paymentId` (`string`, required) — The payment link ID.
356
+ - `status` (`string`, required) — The link status. Always "pending" for this event.
357
+ - `amount` (`number`, required) — The total amount to collect in cents (100 = $1.00).
358
+ - `currency` (`string`, required) — The payment currency code.
359
+ - `description` (`string`, required) — The payment description shown to the customer.
360
+ - `customerId` (`string | null`, required) — The customer ID, or null when the link is not tied to a customer. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
361
+
362
+ ## payment_link.completed
363
+
364
+ Fired when a payment link is paid. The charge settled and a one-time invoice was generated. Fulfill the purchase on this event.
365
+
366
+ ### Data
367
+
368
+ - `paymentId` (`string`, required) — The payment link ID.
369
+ - `status` (`string`, required) — The link status. Always "succeeded" for this event.
370
+ - `amount` (`number`, required) — The collected amount in cents (100 = $1.00).
371
+ - `currency` (`string`, required) — The payment currency code.
372
+ - `description` (`string`, required) — The payment description shown to the customer.
373
+ - `customerId` (`string | null`, required) — The customer ID, or null when the link is not tied to a customer. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
374
+ - `invoiceId` (`string`, required) — The one-time invoice generated for this payment.
375
+ - `invoiceNumber` (`string`, required) — The human-readable invoice number.
376
+ - `paymentTransactionId` (`string | null`, required) — The payment transaction ID for the settled charge.
377
+
378
+ ## payment_link.failed
379
+
380
+ Fired when a payment link charge attempt is declined. The link stays open and can be paid again — a failed link is retryable.
381
+
382
+ ### Data
383
+
384
+ - `paymentId` (`string`, required) — The payment link ID.
385
+ - `status` (`string`, required) — The link status. Always "failed" for this event.
386
+ - `amount` (`number`, required) — The amount that was attempted in cents (100 = $1.00).
387
+ - `currency` (`string`, required) — The payment currency code.
388
+ - `description` (`string`, required) — The payment description shown to the customer.
389
+ - `customerId` (`string | null`, required) — The customer ID, or null when the link is not tied to a customer. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
390
+ - `failureCode` (`string`, required) — The failure code from the payment processor.
391
+ - `failureMessage` (`string`, required) — A human-readable failure message.
392
+
393
+ ## payment_link.canceled
394
+
395
+ Fired when a pending payment link is canceled before being paid. A canceled link can no longer be paid.
396
+
397
+ ### Data
398
+
399
+ - `paymentId` (`string`, required) — The payment link ID.
400
+ - `status` (`string`, required) — The link status. Always "canceled" for this event.
401
+ - `amount` (`number`, required) — The total amount of the canceled link in cents (100 = $1.00).
402
+ - `currency` (`string`, required) — The payment currency code.
403
+ - `description` (`string`, required) — The payment description shown to the customer.
404
+ - `customerId` (`string | null`, required) — The customer ID, or null when the link is not tied to a customer. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
405
+
406
+ ## invoice.created
407
+
408
+ Fired when a new invoice is generated for a subscription, typically at the start of a billing period.
409
+
410
+ ### Data
411
+
412
+ - `invoiceId` (`string`, required) — The invoice ID.
413
+ - `invoiceNumber` (`string`, required) — The human-readable invoice number.
414
+ - `invoiceStatus` (`string`, required) — The invoice status (e.g. pending, paid).
415
+ - `periodStart` (`string`, required) — ISO 8601 start of the billing period.
416
+ - `periodEnd` (`string`, required) — ISO 8601 end of the billing period.
417
+ - `issueDate` (`string`, required) — ISO 8601 date the invoice was issued.
418
+ - `dueDate` (`string`, required) — ISO 8601 date the invoice is due.
419
+ - `currency` (`string`, required) — The invoice currency code.
420
+ - `subtotal` (`number`, required) — Subtotal in cents (100 = $1.00).
421
+ - `total` (`number`, required) — Total in cents (100 = $1.00).
422
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
423
+ - `subscriptionId` (`string | null`, required) — The subscription ID, if the invoice is linked to a subscription.
424
+
425
+ ## invoice.voided
426
+
427
+ Fired when an invoice is voided — nullified before collection, either manually or automatically when its subscription is canceled. Voiding is terminal: a void invoice is never retried or collected.
428
+
429
+ ### Data
430
+
431
+ - `invoiceId` (`string`, required) — The invoice ID.
432
+ - `invoiceNumber` (`string`, required) — The human-readable invoice number.
433
+ - `invoiceStatus` (`string`, required) — Always "void" for this event.
434
+ - `periodStart` (`string`, required) — ISO 8601 start of the billing period.
435
+ - `periodEnd` (`string`, required) — ISO 8601 end of the billing period.
436
+ - `issueDate` (`string`, required) — ISO 8601 date the invoice was issued.
437
+ - `dueDate` (`string`, required) — ISO 8601 date the invoice was due.
438
+ - `currency` (`string`, required) — The invoice currency code.
439
+ - `subtotal` (`number`, required) — Subtotal in cents (100 = $1.00).
440
+ - `total` (`number`, required) — Total in cents (100 = $1.00).
441
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
442
+ - `subscriptionId` (`string | null`, required) — The subscription ID, if the invoice is linked to a subscription.
443
+
444
+ ## invoice.overdue
445
+
446
+ Fired once when an outstanding invoice passes its due date without payment. The invoice keeps its outstanding status — overdue is a fact about the due date, not a new status. Use it to start your own dunning flow.
447
+
448
+ ### Data
449
+
450
+ - `invoiceId` (`string`, required) — The invoice ID.
451
+ - `invoiceNumber` (`string`, required) — The human-readable invoice number.
452
+ - `invoiceStatus` (`string`, required) — Always "outstanding" for this event.
453
+ - `periodStart` (`string`, required) — ISO 8601 start of the billing period.
454
+ - `periodEnd` (`string`, required) — ISO 8601 end of the billing period.
455
+ - `issueDate` (`string`, required) — ISO 8601 date the invoice was issued.
456
+ - `dueDate` (`string`, required) — ISO 8601 date the invoice was due — now in the past.
457
+ - `currency` (`string`, required) — The invoice currency code.
458
+ - `subtotal` (`number`, required) — Subtotal in cents (100 = $1.00).
459
+ - `total` (`number`, required) — Total in cents (100 = $1.00).
460
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
461
+ - `subscriptionId` (`string | null`, required) — The subscription ID, if the invoice is linked to a subscription.
462
+
463
+ ## invoice.upcoming
464
+
465
+ Predictive event fired once, 3 days before an active subscription renews. Use it to notify the customer before they are charged. Carries no amount — usage-based charges are only final at renewal, when invoice.created delivers the actual invoice.
466
+
467
+ ### Data
468
+
469
+ - `subscriptionId` (`string`, required) — The subscription ID.
470
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
471
+ - `status` (`string`, required) — Always "active" for this event.
472
+ - `planId` (`string`, required) — The plan ID.
473
+ - `planName` (`string`, required) — The plan name.
474
+ - `billingInterval` (`string | null`, required) — The billing interval (monthly, yearly).
475
+ - `currentPeriodEnd` (`string`, required) — ISO 8601 datetime when the current period ends and the renewal invoice is issued.
476
+
477
+ ## payment_method.attached
478
+
479
+ Fired when Commet records a payment method for a subscription: after a paid checkout, when a trial starts with a card on file, or when a zero-total checkout completes. The card object carries display metadata only — full numbers never leave the payment provider.
480
+
481
+ ### Data
482
+
483
+ - `subscriptionId` (`string`, required) — The subscription the payment method was saved for.
484
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
485
+ - `card` (`WebhookCardInfo | null`, required) — Card display metadata: brand, last4, expMonth, expYear. Null when the method is not a card or its details cannot be retrieved.
486
+
487
+ ## payment_method.updated
488
+
489
+ Fired when a customer replaces their default payment method through the customer portal. The new method applies to all of the customer's subscriptions. A payment method update is also a strong recovery signal for past-due subscriptions.
490
+
491
+ ### Data
492
+
493
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
494
+ - `card` (`WebhookCardInfo | null`, required) — Card display metadata for the new method: brand, last4, expMonth, expYear. Null when the method is not a card or its details cannot be retrieved.
495
+
496
+ ## customer.created
497
+
498
+ Fired when a customer is created, via the API (including batch create), SDK, or dashboard. The payload is the customer resource exactly as GET /customers returns it.
499
+
500
+ ### Data
501
+
502
+ - `id` (`string`, required) — The Commet customer ID (cus_...).
503
+ - `externalId` (`string | null`, required) — Your own identifier for this customer, if you provided one.
504
+ - `fullName` (`string | null`, required) — The customer's full name.
505
+ - `email` (`string`, required) — The customer's email.
506
+ - `taxDocument` (`string | null`, required) — The customer's tax identification number, if provided.
507
+ - `documentType` (`string | null`, required) — The local tax document type label inferred from the customer's country (e.g. CUIT, RFC, RUT), or null when no tax document was provided.
508
+ - `timezone` (`string | null`, required) — The customer's timezone.
509
+ - `metadata` (`Record<string, unknown> | null`, required) — Custom key-value metadata you attached to the customer.
510
+ - `createdAt` (`string`, required) — ISO 8601 datetime when the customer was created.
511
+ - `updatedAt` (`string`, required) — ISO 8601 datetime of the last update.
512
+
513
+ ## customer.updated
514
+
515
+ Fired when a customer's details change (email, name, timezone, externalId, or metadata). Carries the same customer resource shape as customer.created with the current values.
516
+
517
+ ### Data
518
+
519
+ - `id` (`string`, required) — The Commet customer ID (cus_...).
520
+ - `externalId` (`string | null`, required) — Your own identifier for this customer, if you provided one.
521
+ - `fullName` (`string | null`, required) — The customer's full name.
522
+ - `email` (`string`, required) — The customer's email.
523
+ - `taxDocument` (`string | null`, required) — The customer's tax identification number, if provided.
524
+ - `documentType` (`string | null`, required) — The local tax document type label inferred from the customer's country (e.g. CUIT, RFC, RUT), or null when no tax document was provided.
525
+ - `timezone` (`string | null`, required) — The customer's timezone.
526
+ - `metadata` (`Record<string, unknown> | null`, required) — Custom key-value metadata you attached to the customer.
527
+ - `createdAt` (`string`, required) — ISO 8601 datetime when the customer was created.
528
+ - `updatedAt` (`string`, required) — ISO 8601 datetime of this update.
529
+
530
+ ## customer.state_changed
531
+
532
+ Aggregate entitlement event answering one question: what can this customer access right now? Fired on every entitlement transition (subscription lifecycle, plan changes, trials, past due, scheduled cancellations) with the customer's CURRENT subscription, plan, features, seats, and credits or balance. Handle this single event to keep access in sync instead of wiring every lifecycle event.
533
+
534
+ ### Data
535
+
536
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
537
+ - `trigger` (`string`, required) — What caused the transition. One of: subscription_created, subscription_activated, subscription_canceled, plan_change, past_due, trial_started, trial_converted, trial_expired, cancellation_scheduled, cancellation_revoked, seats_updated, addon_activated, addon_deactivated, credits_depleted, balance_depleted, quota_exceeded, plan_access_granted, plan_access_ended.
538
+ - `status` (`string`, required) — The customer's current subscription status, or "none" when no live subscription exists. Access is granted while trialing, active, or past_due — past_due is a permissive grace window during dunning.
539
+ - `subscriptionId` (`string | null`, required) — The live subscription ID, or null when status is none.
540
+ - `plan` (`WebhookPlanRef | null`, required) — The current plan (id and name), or null when status is none.
541
+ - `billingInterval` (`string | null`, required) — The current billing interval.
542
+ - `consumptionModel` (`string | null`, required) — The plan's consumption model: metered, credits, or balance.
543
+ - `features` (`Array<{ code: string; name: string; unitName: string | null; allowed: boolean; type: "boolean"; enabled: boolean } | { code: string; name: string; unitName: string | null; allowed: boolean; type: "usage"; consumption: { model: "metered"; period: { start: string; end: string }; unitsUsed: number; includedUnits: number; remainingUnits?: number; unlimited: boolean; overage: { enabled: boolean; units: number; unitPrice?: { amount: number; currency: string; scale: 10000 } } } | { model: "credits"; period: { start: string; end: string }; unitsUsed: number; creditsPerUnit: number; creditsConsumed: number; availableUnits: number } | { model: "balance"; period: { start: string; end: string }; unitsUsed: number; spent: { amount: number; currency: string }; availableUnits?: number; unitPrice?: { amount: number; currency: string; scale: 10000 } } } | { code: string; name: string; unitName: string | null; allowed: boolean; type: "seats"; usage: { period: { start: string; end: string }; unitsUsed: number; includedUnits: number; remainingUnits?: number; unlimited: boolean; overage: { enabled: boolean; units: number; unitPrice?: { amount: number; currency: string; scale: 10000 } } } } | { code: string; name: string; unitName: string | null; allowed: boolean; type: "quota"; usage: { period: { start: string; end: string }; unitsUsed: number; includedUnits: number; remainingUnits?: number; unlimited: boolean; overage: { enabled: boolean; units: number; unitPrice?: { amount: number; currency: string; scale: 10000 } }; billedUnits: number } }>`, required) — Current feature access, discriminated by type. Boolean features expose enabled; usage features expose model-specific consumption; seats and quota expose usage allowances.
544
+ - `seats` (`Array<WebhookSeatSummary>`, required) — Summary of seats-type features: code, current, included, remaining, unlimited.
545
+ - `credits` (`WebhookCreditsBalance | null`, required) — For credits plans: planCredits, purchasedCredits, totalCredits. Null otherwise.
546
+ - `balance` (`WebhookBalance | null`, required) — For balance plans: currentBalance in rate scale (10000 = $1.00). Null otherwise.
547
+
548
+ ## credits.granted
549
+
550
+ 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.
551
+
552
+ ### Data
553
+
554
+ - `subscriptionId` (`string`, required) — The subscription ID.
555
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
556
+ - `credits` (`number`, required) — The number of credits granted.
557
+ - `reason` (`string`, required) — Why the credits were granted: period_reset or manual_adjustment.
558
+
559
+ ## credits.purchased
560
+
561
+ 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.
562
+
563
+ ### Data
564
+
565
+ - `subscriptionId` (`string`, required) — The subscription ID.
566
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
567
+ - `invoiceId` (`string`, required) — The invoice issued for the purchase.
568
+ - `invoiceNumber` (`string`, required) — The human-readable invoice number.
569
+ - `creditPackName` (`string`, required) — The purchased credit pack's name.
570
+ - `credits` (`number`, required) — The number of credits purchased.
571
+
572
+ ## credits.low
573
+
574
+ Fired when a subscription's remaining credits cross below 10% of the credits granted for the current period. Emitted once per billing period, when the crossing happens.
575
+
576
+ ### Data
577
+
578
+ - `subscriptionId` (`string`, required) — The subscription ID.
579
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
580
+ - `remainingCredits` (`number`, required) — Total credits remaining (plan plus purchased).
581
+ - `thresholdCredits` (`number`, required) — The low-credit threshold that was crossed: 10% of the period's granted plan credits.
582
+ - `periodCredits` (`number`, required) — The plan credits granted at the last period reset.
583
+
584
+ ## credits.depleted
585
+
586
+ Fired when a subscription's credits hit zero. Usage requests that need more credits than remain are rejected from this point. Also fires customer.state_changed with trigger credits_depleted.
587
+
588
+ ### Data
589
+
590
+ - `subscriptionId` (`string`, required) — The subscription ID.
591
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
592
+ - `remainingCredits` (`number`, required) — Credits remaining after depletion. Always 0.
593
+
594
+ ## credits.expired
595
+
596
+ 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.
597
+
598
+ ### Data
599
+
600
+ - `subscriptionId` (`string`, required) — The subscription ID.
601
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
602
+ - `expiredCredits` (`number`, required) — The unused plan credits that were discarded.
603
+
604
+ ## balance.topped_up
605
+
606
+ Fired when a customer on a balance plan tops up their prepaid balance through the customer portal and the payment succeeds.
607
+
608
+ ### Data
609
+
610
+ - `subscriptionId` (`string`, required) — The subscription ID.
611
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
612
+ - `invoiceId` (`string`, required) — The invoice issued for the top-up.
613
+ - `invoiceNumber` (`string`, required) — The human-readable invoice number.
614
+ - `amount` (`number`, required) — The topped-up value in rate scale (10000 = $1.00 of the subscription currency).
615
+ - `currency` (`string`, required) — The subscription currency.
616
+
617
+ ## balance.low
618
+
619
+ Fired when a subscription's prepaid balance crosses below 10% of its last refill (period reset, top-up, or manual adjustment). Emitted once per crossing.
620
+
621
+ ### Data
622
+
623
+ - `subscriptionId` (`string`, required) — The subscription ID.
624
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
625
+ - `currentBalance` (`number`, required) — The remaining balance in rate scale (10000 = $1.00 of the subscription currency).
626
+ - `thresholdBalance` (`number`, required) — The low-balance threshold that was crossed: 10% of the last refill, in rate scale.
627
+ - `currency` (`string`, required) — The subscription currency.
628
+
629
+ ## balance.depleted
630
+
631
+ Fired when a subscription's prepaid balance crosses to zero or below. With block-on-exhaustion plans further usage is rejected; otherwise the balance can go negative. Also fires customer.state_changed with trigger balance_depleted.
632
+
633
+ ### Data
634
+
635
+ - `subscriptionId` (`string`, required) — The subscription ID.
636
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
637
+ - `currentBalance` (`number`, required) — The balance after depletion in rate scale. Zero, or negative when overage is allowed.
638
+ - `currency` (`string`, required) — The subscription currency.
639
+
640
+ ## quota.threshold_reached
641
+
642
+ Fired when a metered feature's usage crosses 80% of its included quantity for the current period. Emitted once per feature per billing period, when the crossing happens.
643
+
644
+ ### Data
645
+
646
+ - `subscriptionId` (`string`, required) — The subscription ID.
647
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
648
+ - `featureCode` (`string`, required) — The metered feature code.
649
+ - `currentUsage` (`number`, required) — Total usage in the current period after the crossing.
650
+ - `includedAmount` (`number`, required) — The included quantity for the period.
651
+ - `periodStart` (`string`, required) — ISO 8601 start of the usage period.
652
+
653
+ ## quota.exceeded
654
+
655
+ Fired when a metered feature passes its included quantity. With overage enabled it means overage billing began; with overage disabled it means the hard limit was hit and further usage is rejected (this case also fires customer.state_changed with trigger quota_exceeded). Emitted once per feature per billing period.
656
+
657
+ ### Data
658
+
659
+ - `subscriptionId` (`string`, required) — The subscription ID.
660
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
661
+ - `featureCode` (`string`, required) — The metered feature code.
662
+ - `currentUsage` (`number`, required) — Total usage in the current period.
663
+ - `includedAmount` (`number`, required) — The included quantity for the period.
664
+ - `overageEnabled` (`boolean`, required) — True when overage billing began; false when the hard limit was hit and usage is now blocked.
665
+ - `periodStart` (`string`, required) — ISO 8601 start of the usage period.
666
+
667
+ ## seats.updated
668
+
669
+ Fired when a customer's seat count changes for a seats-type feature — via the SDK seats endpoints or the dashboard. Also fires customer.state_changed with trigger seats_updated.
670
+
671
+ ### Data
672
+
673
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
674
+ - `subscriptionId` (`string | null`, required) — The live subscription ID, or null when the customer has no live subscription.
675
+ - `featureCode` (`string`, required) — The seats feature code.
676
+ - `previousSeats` (`number`, required) — The seat count before the change.
677
+ - `currentSeats` (`number`, required) — The seat count after the change.
678
+
679
+ ## seats.limit_reached
680
+
681
+ Fired when a seat change reaches or passes the included seat limit of the customer's plan. Emitted once per crossing — only when the count moves from below the limit to at or above it.
682
+
683
+ ### Data
684
+
685
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
686
+ - `subscriptionId` (`string`, required) — The subscription ID.
687
+ - `featureCode` (`string`, required) — The seats feature code.
688
+ - `currentSeats` (`number`, required) — The seat count after the change.
689
+ - `includedSeats` (`number`, required) — The included seat limit of the plan.
690
+
691
+ ## addon.activated
692
+
693
+ Fired when an add-on is activated on a subscription — via the API or a customer portal purchase. The prorated activation charge, if any, has already succeeded. Also fires customer.state_changed with trigger addon_activated.
694
+
695
+ ### Data
696
+
697
+ - `subscriptionId` (`string`, required) — The subscription ID.
698
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
699
+ - `addon` (`WebhookAddonRef`, required) — The add-on: id and name.
700
+ - `featureCode` (`string`, required) — The feature the add-on unlocks or extends.
701
+ - `proratedPrice` (`number`, required) — The prorated amount charged at activation in rate scale (10000 = $1.00). Zero when nothing was charged.
702
+ - `currency` (`string`, required) — The subscription currency.
703
+
704
+ ## addon.deactivated
705
+
706
+ Fired when an active add-on is deactivated from a subscription. Also fires customer.state_changed with trigger addon_deactivated.
707
+
708
+ ### Data
709
+
710
+ - `subscriptionId` (`string`, required) — The subscription ID.
711
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
712
+ - `addon` (`WebhookAddonRef`, required) — The add-on: id and name.
713
+ - `featureCode` (`string`, required) — The feature the add-on unlocked or extended.
714
+
715
+ ## usage.recorded
716
+
717
+ Fired for every processed usage event. HIGH VOLUME: this fires once per tracked event, so it is excluded from family select-all in the dashboard — subscribe to it explicitly and make sure your endpoint can absorb your own ingest rate.
718
+
719
+ ### Data
720
+
721
+ - `subscriptionId` (`string`, required) — The subscription ID.
722
+ - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
723
+ - `usageEventId` (`string`, required) — The usage event ID.
724
+ - `featureCode` (`string`, required) — The feature code the usage was tracked against.
725
+ - `value` (`number`, required) — The recorded quantity. For AI model events this is the total token count.
726
+ - `ts` (`string`, required) — ISO 8601 timestamp of the usage event.
727
+
728
+ ## payout.available
729
+
730
+ Organization-level event about YOUR money as the merchant. Fired when payment funds the provider was holding become available to pay out to your bank.
731
+
732
+ ### Data
733
+
734
+ - `availableAmount` (`number`, required) — Your full available payout balance in cents (100 = $1.00) at the time of the event — not just the newly released funds.
735
+ - `currency` (`string`, required) — The payout balance currency. Always "usd".
736
+
737
+ ## payout.created
738
+
739
+ Fired when a payout of your available balance is requested and the transfer toward your bank is initiated. The lifecycle continues with payout.paid or payout.failed.
740
+
741
+ ### Data
742
+
743
+ - `payoutId` (`string`, required) — The payout ID.
744
+ - `amount` (`number`, required) — Gross payout amount in cents (100 = $1.00).
745
+ - `fee` (`number`, required) — Provider transfer fee in cents.
746
+ - `netAmount` (`number`, required) — What reaches your bank in cents (amount minus fee).
747
+ - `currency` (`string`, required) — The payout currency. Always "usd".
748
+ - `status` (`string`, required) — The payout status. "pending" at creation.
749
+ - `destinationBank` (`WebhookBankRef | null`, required) — Destination bank display metadata: bankName and last4. Full account numbers never appear in webhook payloads.
750
+ - `createdAt` (`string`, required) — ISO 8601 datetime when the payout was created.
751
+
752
+ ## payout.paid
753
+
754
+ Fired when the bank settlement of a payout completes — the moment the money actually reaches your bank account, confirmed by the payment provider. Fires exactly once per payout.
755
+
756
+ ### Data
757
+
758
+ - `payoutId` (`string`, required) — The payout ID.
759
+ - `amount` (`number`, required) — Gross payout amount in cents (100 = $1.00).
760
+ - `fee` (`number`, required) — Provider transfer fee in cents.
761
+ - `netAmount` (`number`, required) — What reached your bank in cents (amount minus fee).
762
+ - `currency` (`string`, required) — The payout currency. Always "usd".
763
+ - `status` (`string`, required) — Always "paid" for this event.
764
+ - `destinationBank` (`WebhookBankRef | null`, required) — Destination bank display metadata: bankName and last4.
765
+ - `paidAt` (`string | null`, required) — ISO 8601 datetime when the provider confirmed the deposit arrived.
766
+
767
+ ## payout.failed
768
+
769
+ Fired when the provider reports a payout could not be completed — most commonly a bank rejection (closed account, invalid details). The funds return to your available balance.
770
+
771
+ ### Data
772
+
773
+ - `payoutId` (`string`, required) — The payout ID.
774
+ - `amount` (`number`, required) — Gross payout amount in cents (100 = $1.00).
775
+ - `fee` (`number`, required) — Provider transfer fee in cents.
776
+ - `netAmount` (`number`, required) — What would have reached your bank in cents.
777
+ - `currency` (`string`, required) — The payout currency. Always "usd".
778
+ - `status` (`string`, required) — Always "failed" for this event.
779
+ - `destinationBank` (`WebhookBankRef | null`, required) — Destination bank display metadata: bankName and last4.
780
+ - `failedAt` (`string | null`, required) — ISO 8601 datetime when the failure was recorded.
781
+ - `failureCode` (`string | null`, required) — The provider's failure code, when available.
782
+ - `failureMessage` (`string | null`, required) — A human-readable failure message, when available.