@commet/node 9.7.0 → 9.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/index.d.mts +413 -52
  2. package/dist/index.d.ts +413 -52
  3. package/dist/index.js +39 -12
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +39 -12
  6. package/dist/index.mjs.map +1 -1
  7. package/docs/ai-onboarding/mcp-server.md +1 -1
  8. package/docs/api-reference/customers.md +6 -2
  9. package/docs/api-reference/generated-webhooks.md +2 -2
  10. package/docs/api-reference/index.md +2 -2
  11. package/docs/api-reference/offers.md +2 -2
  12. package/docs/api-reference/plans.md +16 -3
  13. package/docs/api-reference/promo-codes.md +3 -1
  14. package/docs/api-reference/subscriptions.md +84 -9
  15. package/docs/api-reference/usage.md +0 -4
  16. package/docs/documentation/cli.md +60 -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 +1 -1
  28. package/docs/documentation/plans/consumption-models.md +44 -9
  29. package/docs/documentation/plans/credit-packs.md +49 -1
  30. package/docs/documentation/plans/one-time-payments.md +3 -3
  31. package/docs/documentation/plans/plan-groups.md +46 -10
  32. package/docs/documentation/platform/dashboard-metrics-and-events.md +40 -9
  33. package/docs/documentation/sales/connect-dub-affiliates.md +52 -0
  34. package/docs/documentation/sales/introductory-offers.md +7 -13
  35. package/docs/documentation/sales/offers.md +10 -6
  36. package/docs/documentation/sales/promo-codes.md +47 -17
  37. package/docs/documentation/sales/promotional-offers.md +6 -7
  38. package/docs/documentation/sales/regional-prices.md +16 -0
  39. package/docs/documentation/sales/trial-periods.md +67 -40
  40. package/docs/documentation/subscriptions/manage-subscriptions.md +65 -2
  41. package/docs/documentation/subscriptions/pay-in-advance.md +4 -7
  42. package/docs/documentation/subscriptions/upgrade-and-downgrade-plans.md +20 -2
  43. package/docs/documentation/testing-sandbox.md +2 -0
  44. package/docs/documentation/usage/track-usage.md +23 -0
  45. package/docs/errors/customer_deleted.md +22 -0
  46. package/docs/errors/index.md +5 -0
  47. package/docs/errors/managed_by_integration.md +22 -0
  48. package/docs/errors/no_scheduled_plan_change.md +22 -0
  49. package/docs/errors/plan_balance_limit_reached.md +22 -0
  50. package/docs/errors/plan_credit_limit_reached.md +22 -0
  51. package/docs/knowledge-base/how-do-credits-credit-packs-and-customer-credits-differ.md +8 -8
  52. package/docs/knowledge-base/how-do-discounts-work.md +7 -5
  53. package/docs/knowledge-base/how-do-free-plans-work-without-payment.md +14 -8
  54. package/docs/knowledge-base/how-do-offers-promo-codes-and-card-promotions-work-together.md +1 -1
  55. package/docs/knowledge-base/how-do-trial-periods-work.md +30 -24
  56. package/docs/knowledge-base/how-does-billing-work.md +1 -0
  57. package/docs/knowledge-base/what-happens-when-a-payment-fails.md +11 -9
  58. package/docs/manifest.json +54 -2
  59. package/docs/platform-documentation.md +1 -0
  60. package/docs/schemas.md +51 -9
  61. package/docs/webhooks/introduction.md +14 -12
  62. package/docs/webhooks.md +53 -17
  63. package/docs/webhooks.openapi.json +857 -745
  64. package/package.json +1 -1
@@ -9,7 +9,7 @@
9
9
  "subscription.created": {
10
10
  "post": {
11
11
  "summary": "subscription.created",
12
- "description": "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.",
12
+ "description": "Fired when a subscription record is created, usually with status pending_payment: the first charge has not been confirmed yet — do NOT grant access here; wait for subscription.activated. A trial whose price requires no payment method is created already trialing, together with trial.started.",
13
13
  "tags": [
14
14
  "Webhooks"
15
15
  ],
@@ -71,15 +71,11 @@
71
71
  "description": "ISO 8601 datetime when the subscription starts."
72
72
  },
73
73
  "name": {
74
- "anyOf": [
75
- {
76
- "type": "string"
77
- },
78
- {
79
- "type": "null"
80
- }
81
- ],
82
- "description": "Optional custom name for the subscription."
74
+ "description": "Optional custom name for the subscription.",
75
+ "type": [
76
+ "string",
77
+ "null"
78
+ ]
83
79
  }
84
80
  },
85
81
  "required": [
@@ -201,15 +197,11 @@
201
197
  "type": "string"
202
198
  },
203
199
  "name": {
204
- "anyOf": [
205
- {
206
- "type": "string"
207
- },
208
- {
209
- "type": "null"
210
- }
211
- ],
212
- "description": "Optional custom name for the subscription."
200
+ "description": "Optional custom name for the subscription.",
201
+ "type": [
202
+ "string",
203
+ "null"
204
+ ]
213
205
  },
214
206
  "invoiceId": {
215
207
  "type": "string",
@@ -370,15 +362,11 @@
370
362
  "type": "string"
371
363
  },
372
364
  "name": {
373
- "anyOf": [
374
- {
375
- "type": "string"
376
- },
377
- {
378
- "type": "null"
379
- }
380
- ],
381
- "description": "Optional custom name for the subscription."
365
+ "description": "Optional custom name for the subscription.",
366
+ "type": [
367
+ "string",
368
+ "null"
369
+ ]
382
370
  },
383
371
  "invoiceId": {
384
372
  "type": "string",
@@ -1046,15 +1034,11 @@
1046
1034
  "description": "When access was restored."
1047
1035
  },
1048
1036
  "invoiceId": {
1049
- "anyOf": [
1050
- {
1051
- "type": "string"
1052
- },
1053
- {
1054
- "type": "null"
1055
- }
1056
- ],
1057
- "description": "The resume invoice ID, or null when no charge was required."
1037
+ "description": "The resume invoice ID, or null when no charge was required.",
1038
+ "type": [
1039
+ "string",
1040
+ "null"
1041
+ ]
1058
1042
  }
1059
1043
  },
1060
1044
  "required": [
@@ -1287,15 +1271,11 @@
1287
1271
  "type": "string"
1288
1272
  },
1289
1273
  "cancelReason": {
1290
- "anyOf": [
1291
- {
1292
- "type": "string"
1293
- },
1294
- {
1295
- "type": "null"
1296
- }
1297
- ],
1298
- "description": "The reason for cancellation, if provided. Set to \"dunning_exhausted\" when all payment retries fail. Historical refund-triggered cancellations may have \"refund\"."
1274
+ "description": "The reason for cancellation, if provided. Set to \"dunning_exhausted\" when all payment retries fail, and to \"trial_ended_without_payment_method\" when a trial without a payment method ends with no card and no default plan. Historical refund-triggered cancellations may have \"refund\".",
1275
+ "type": [
1276
+ "string",
1277
+ "null"
1278
+ ]
1299
1279
  },
1300
1280
  "endDate": {
1301
1281
  "description": "ISO 8601 datetime when the subscription ended. Matches the billing period end for scheduled cancellations; for immediate terminations it is the moment of termination.",
@@ -1352,7 +1332,7 @@
1352
1332
  "description": "Fired when a subscription is terminated, at period end or immediately. Revoke access here.",
1353
1333
  "playground": "none"
1354
1334
  },
1355
- "content": "## Cancellation lifecycle\n\nA regular cancellation is scheduled for the end of the current billing period. Two events fire at different moments:\n\n| Moment | Event | status | What to do |\n| --- | --- | --- | --- |\n| Customer requests cancellation | `subscription.updated` | `active` | Show \"ending on \\{endDate\\}\" in your UI. Do NOT revoke access. |\n| Billing period ends | `subscription.canceled` | `canceled` | Revoke access. |\n\n```\nPOST /subscriptions/{id}/cancel\n └→ subscription.updated (status: \"active\", canceledAt: set, endDate: set)\n ... time passes until billing period ends ...\n └→ subscription.canceled (status: \"canceled\")\n```\n\n## Immediate terminations\n\nSome terminations skip the schedule: `subscription.canceled` arrives right away, with no prior `subscription.updated`, and `endDate` is the moment of termination — not a billing period boundary.\n\n- `POST /subscriptions/{id}/cancel` with `immediate: true`. Cancellations of free plans and of subscriptions in `pending_payment` or `past_due` also settle immediately — canceling inside the dunning grace window voids the unpaid renewal.\n- Exhausted dunning retries: fires with `cancelReason: \"dunning_exhausted\"`, alongside `payment.retry_failed`.\n\nRefunding a payment does not cancel its subscription. If you want both outcomes, request a [cancellation](/manage-subscriptions) separately. Older cancellation events triggered by refunds may have `cancelReason: \"refund\"`."
1335
+ "content": "## Cancellation lifecycle\n\nA regular cancellation is scheduled for the end of the current billing period. Two events fire at different moments:\n\n| Moment | Event | status | What to do |\n| --- | --- | --- | --- |\n| Customer requests cancellation | `subscription.updated` | `active` | Show \"ending on \\{endDate\\}\" in your UI. Do NOT revoke access. |\n| Billing period ends | `subscription.canceled` | `canceled` | Revoke access. |\n\n```\nPOST /subscriptions/{id}/cancel\n └→ subscription.updated (status: \"active\", canceledAt: set, endDate: set)\n ... time passes until billing period ends ...\n └→ subscription.canceled (status: \"canceled\")\n```\n\n## Immediate terminations\n\nSome terminations skip the schedule: `subscription.canceled` arrives right away, with no prior `subscription.updated`, and `endDate` is the moment of termination — not a billing period boundary.\n\n- `POST /subscriptions/{id}/cancel` with `immediate: true`. Cancellations of free plans and of subscriptions in `pending_payment` or `past_due` also settle immediately — canceling inside the dunning grace window voids the unpaid renewal.\n- Exhausted dunning retries: fires with `cancelReason: \"dunning_exhausted\"`, alongside `payment.retry_failed`.\n- A trial without a payment method that ends without a card: fires with `cancelReason: \"trial_ended_without_payment_method\"`.\n\nWhen the plan group has a default plan, exhausted dunning retries and a trial that ends without a card move the subscription to that plan instead, and `subscription.plan_changed` fires.\n\nRefunding a payment does not cancel its subscription. If you want both outcomes, request a [cancellation](/manage-subscriptions) separately. Older cancellation events triggered by refunds may have `cancelReason: \"refund\"`."
1356
1336
  }
1357
1337
  }
1358
1338
  },
@@ -1413,15 +1393,11 @@
1413
1393
  "type": "string"
1414
1394
  },
1415
1395
  "cancelReason": {
1416
- "anyOf": [
1417
- {
1418
- "type": "string"
1419
- },
1420
- {
1421
- "type": "null"
1422
- }
1423
- ],
1424
- "description": "The reason for cancellation, if provided."
1396
+ "description": "The reason for cancellation, if provided.",
1397
+ "type": [
1398
+ "string",
1399
+ "null"
1400
+ ]
1425
1401
  },
1426
1402
  "endDate": {
1427
1403
  "description": "ISO 8601 datetime when the subscription will end. Present when cancellation is scheduled — this is the date access should be revoked (via subscription.canceled).",
@@ -1539,15 +1515,11 @@
1539
1515
  "$ref": "#/components/schemas/WebhookPlanRef"
1540
1516
  },
1541
1517
  "billingInterval": {
1542
- "anyOf": [
1543
- {
1544
- "type": "string"
1545
- },
1546
- {
1547
- "type": "null"
1548
- }
1549
- ],
1550
- "description": "The billing interval (monthly, yearly)."
1518
+ "description": "The billing interval (monthly, yearly).",
1519
+ "type": [
1520
+ "string",
1521
+ "null"
1522
+ ]
1551
1523
  },
1552
1524
  "credit": {
1553
1525
  "type": "number",
@@ -1685,15 +1657,11 @@
1685
1657
  "type": "string"
1686
1658
  },
1687
1659
  "cancelReason": {
1688
- "anyOf": [
1689
- {
1690
- "type": "string"
1691
- },
1692
- {
1693
- "type": "null"
1694
- }
1695
- ],
1696
- "description": "The reason for cancellation, if provided."
1660
+ "description": "The reason for cancellation, if provided.",
1661
+ "type": [
1662
+ "string",
1663
+ "null"
1664
+ ]
1697
1665
  },
1698
1666
  "effectiveAt": {
1699
1667
  "type": "string",
@@ -1924,26 +1892,18 @@
1924
1892
  "$ref": "#/components/schemas/WebhookPlanRef"
1925
1893
  },
1926
1894
  "billingInterval": {
1927
- "anyOf": [
1928
- {
1929
- "type": "string"
1930
- },
1931
- {
1932
- "type": "null"
1933
- }
1934
- ],
1935
- "description": "The current billing interval."
1895
+ "description": "The current billing interval.",
1896
+ "type": [
1897
+ "string",
1898
+ "null"
1899
+ ]
1936
1900
  },
1937
1901
  "scheduledBillingInterval": {
1938
- "anyOf": [
1939
- {
1940
- "type": "string"
1941
- },
1942
- {
1943
- "type": "null"
1944
- }
1945
- ],
1946
- "description": "The new billing interval, if the change includes one. Null when only the plan changes."
1902
+ "description": "The new billing interval, if the change includes one. Null when only the plan changes.",
1903
+ "type": [
1904
+ "string",
1905
+ "null"
1906
+ ]
1947
1907
  },
1948
1908
  "effectiveAt": {
1949
1909
  "type": "string",
@@ -2019,7 +1979,7 @@
2019
1979
  "subscription.plan_change_revoked": {
2020
1980
  "post": {
2021
1981
  "summary": "subscription.plan_change_revoked",
2022
- "description": "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.",
1982
+ "description": "Fired when a scheduled plan change will no longer take effect: it was revoked through the API, the dashboard or the customer portal, an immediate plan change or an immediate cancellation voided it, or a different change replaced it. A replacement also fires subscription.plan_change_scheduled with the new target plan.",
2023
1983
  "tags": [
2024
1984
  "Webhooks"
2025
1985
  ],
@@ -2077,26 +2037,18 @@
2077
2037
  "$ref": "#/components/schemas/WebhookPlanRef"
2078
2038
  },
2079
2039
  "billingInterval": {
2080
- "anyOf": [
2081
- {
2082
- "type": "string"
2083
- },
2084
- {
2085
- "type": "null"
2086
- }
2087
- ],
2088
- "description": "The current billing interval."
2040
+ "description": "The current billing interval.",
2041
+ "type": [
2042
+ "string",
2043
+ "null"
2044
+ ]
2089
2045
  },
2090
2046
  "revokedBillingInterval": {
2091
- "anyOf": [
2092
- {
2093
- "type": "string"
2094
- },
2095
- {
2096
- "type": "null"
2097
- }
2098
- ],
2099
- "description": "The previously scheduled billing interval, if the revoked change included one."
2047
+ "description": "The previously scheduled billing interval, if the revoked change included one.",
2048
+ "type": [
2049
+ "string",
2050
+ "null"
2051
+ ]
2100
2052
  }
2101
2053
  },
2102
2054
  "required": [
@@ -2281,7 +2233,7 @@
2281
2233
  "trial.started": {
2282
2234
  "post": {
2283
2235
  "summary": "trial.started",
2284
- "description": "Fired when a subscription enters its trial period after checkout. Grant access here — trialing subscriptions have full access until trialEndsAt.",
2236
+ "description": "Fired when a subscription enters its trial period: after checkout, or right away when the price's trial requires no payment method. Grant access here — trialing subscriptions have full access until trialEndsAt.",
2285
2237
  "tags": [
2286
2238
  "Webhooks"
2287
2239
  ],
@@ -2392,10 +2344,10 @@
2392
2344
  "href": "/webhooks/trial-started",
2393
2345
  "metadata": {
2394
2346
  "title": "trial.started",
2395
- "description": "Fired when a subscription enters its trial period. Grant access here.",
2347
+ "description": "Fired when a subscription enters its trial period, after checkout or at once when the price's trial requires no payment method. Grant access here.",
2396
2348
  "playground": "none"
2397
2349
  },
2398
- "content": "## Trial lifecycle\n\nTrials in Commet collect a payment method at checkout, so every trial has a clear path to revenue:\n\n| Moment | Event | What to do |\n| --- | --- | --- |\n| Checkout completes with trial days | `trial.started` | Grant full access. |\n| 3 days before the trial ends | `trial.will_end` | Remind the customer billing starts soon. |\n| Customer upgrades during the trial | `trial.converted` | Trial ends early, paid plan starts now. |\n| Trial runs out | `trial.expired` | Regular billing begins automatically. |\n\nSubscriptions with `status: \"trialing\"` have full access — treat them like `active` in your entitlement checks."
2350
+ "content": "## Trial lifecycle\n\nA trial either saves a payment method at checkout or, when the price's trial requires none, starts at once without checkout:\n\n| Moment | Event | What to do |\n| --- | --- | --- |\n| The trial checkout completes, or a trial without a payment method starts | `trial.started` | Grant full access. |\n| 3 days before the trial ends | `trial.will_end` | Remind the customer billing starts soon. |\n| Customer upgrades during the trial | `trial.converted` | Trial ends early, paid plan starts now. |\n| Trial runs out | `trial.expired` | With a payment method, regular billing begins. Without one, the subscription moves to the plan group's default plan or is canceled. |\n\nSubscriptions with `status: \"trialing\"` have full access — treat them like `active` in your entitlement checks. While a trial without a payment method has no card, the subscription's `hasPaymentMethod` is `false`."
2399
2351
  }
2400
2352
  }
2401
2353
  },
@@ -2517,7 +2469,7 @@
2517
2469
  "trial.expired": {
2518
2470
  "post": {
2519
2471
  "summary": "trial.expired",
2520
- "description": "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.",
2472
+ "description": "Fired when a trial period runs out. With a payment method the billing cycle activates the subscription and generates the first regular invoice right after — the natural trial-to-paid transition. A trial without a payment method instead moves to the plan group's default plan (subscription.plan_changed) or is canceled with cancelReason trial_ended_without_payment_method (subscription.canceled), without an invoice.",
2521
2473
  "tags": [
2522
2474
  "Webhooks"
2523
2475
  ],
@@ -2628,10 +2580,10 @@
2628
2580
  "href": "/webhooks/trial-expired",
2629
2581
  "metadata": {
2630
2582
  "title": "trial.expired",
2631
- "description": "Fired when a trial period runs out and regular billing begins.",
2583
+ "description": "Fired when a trial period runs out: regular billing begins, or a trial without a card moves to the default plan or is canceled.",
2632
2584
  "playground": "none"
2633
2585
  },
2634
- "content": "## When this fires\n\nThe trial reached `trialEndsAt`. The billing cycle activates the subscription (`status: \"active\"`), starts the first regular billing period, and generates the first invoice — `invoice.created` and payment events follow as the charge is processed.\n\nAccess does not change at this moment: the customer already had full access while trialing. A retryable first-charge failure moves the subscription to `past_due` recovery; a missing payment method or a customer-action-required outcome leaves it in `pending_payment` until checkout is completed."
2586
+ "content": "## When this fires\n\nThe trial reached `trialEndsAt`. With a payment method, the billing cycle activates the subscription (`status: \"active\"`), starts the first regular billing period, and generates the first invoice — `invoice.created` and payment events follow as the charge is processed.\n\nAccess does not change at this moment: the customer already had full access while trialing. A retryable first-charge failure moves the subscription to `past_due` recovery; a missing payment method or a customer-action-required outcome leaves it in `pending_payment` until checkout is completed.\n\nA trial without a payment method that ends without a card creates no invoice. The subscription moves to the plan group's default plan (`subscription.plan_changed`) or, without one, is canceled with `cancelReason: \"trial_ended_without_payment_method\"` (`subscription.canceled`)."
2635
2587
  }
2636
2588
  }
2637
2589
  },
@@ -2759,7 +2711,7 @@
2759
2711
  "trial.checkout_ready": {
2760
2712
  "post": {
2761
2713
  "summary": "trial.checkout_ready",
2762
- "description": "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.",
2714
+ "description": "Fired when a trial checkout link is ready to share with the customer. Completing this checkout saves a payment method and starts the trial (trial.started) — the customer is not charged until the trial ends. Not fired for a trial whose price requires no payment method, which starts without checkout.",
2763
2715
  "tags": [
2764
2716
  "Webhooks"
2765
2717
  ],
@@ -3061,15 +3013,11 @@
3061
3013
  "description": "The original reason for the charge. Recovery never replaces this reason."
3062
3014
  },
3063
3015
  "paymentLinkId": {
3064
- "anyOf": [
3065
- {
3066
- "type": "string"
3067
- },
3068
- {
3069
- "type": "null"
3070
- }
3071
- ],
3072
- "description": "The public payment link ID, independently of the reason, or null when no payment link originated the charge."
3016
+ "description": "The public payment link ID, independently of the reason, or null when no payment link originated the charge.",
3017
+ "type": [
3018
+ "string",
3019
+ "null"
3020
+ ]
3073
3021
  },
3074
3022
  "recovery": {
3075
3023
  "anyOf": [
@@ -3153,26 +3101,18 @@
3153
3101
  "description": "The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId."
3154
3102
  },
3155
3103
  "subscriptionId": {
3156
- "anyOf": [
3157
- {
3158
- "type": "string"
3159
- },
3160
- {
3161
- "type": "null"
3162
- }
3163
- ],
3164
- "description": "The subscription ID."
3104
+ "description": "The subscription ID.",
3105
+ "type": [
3106
+ "string",
3107
+ "null"
3108
+ ]
3165
3109
  },
3166
3110
  "paymentTransactionId": {
3167
- "anyOf": [
3168
- {
3169
- "type": "string"
3170
- },
3171
- {
3172
- "type": "null"
3173
- }
3174
- ],
3175
- "description": "The payment transaction ID."
3111
+ "description": "The payment transaction ID.",
3112
+ "type": [
3113
+ "string",
3114
+ "null"
3115
+ ]
3176
3116
  },
3177
3117
  "provider": {
3178
3118
  "anyOf": [
@@ -3214,48 +3154,32 @@
3214
3154
  "description": "The source of funds for this charge, when reported by the provider. Null when unavailable or unknown."
3215
3155
  },
3216
3156
  "grossAmount": {
3217
- "anyOf": [
3218
- {
3219
- "type": "number"
3220
- },
3221
- {
3222
- "type": "null"
3223
- }
3224
- ],
3225
- "description": "Gross amount in cents before fees."
3157
+ "description": "Gross amount in cents before fees.",
3158
+ "type": [
3159
+ "number",
3160
+ "null"
3161
+ ]
3226
3162
  },
3227
3163
  "currency": {
3228
- "anyOf": [
3229
- {
3230
- "type": "string"
3231
- },
3232
- {
3233
- "type": "null"
3234
- }
3235
- ],
3236
- "description": "The payment currency code."
3164
+ "description": "The payment currency code.",
3165
+ "type": [
3166
+ "string",
3167
+ "null"
3168
+ ]
3237
3169
  },
3238
3170
  "orgNetAmount": {
3239
- "anyOf": [
3240
- {
3241
- "type": "number"
3242
- },
3243
- {
3244
- "type": "null"
3245
- }
3246
- ],
3247
- "description": "Net amount after fees in cents."
3171
+ "description": "Net amount after fees in cents.",
3172
+ "type": [
3173
+ "number",
3174
+ "null"
3175
+ ]
3248
3176
  },
3249
3177
  "customerEmail": {
3250
- "anyOf": [
3251
- {
3252
- "type": "string"
3253
- },
3254
- {
3255
- "type": "null"
3256
- }
3257
- ],
3258
- "description": "The customer email used for this payment."
3178
+ "description": "The customer email used for this payment.",
3179
+ "type": [
3180
+ "string",
3181
+ "null"
3182
+ ]
3259
3183
  },
3260
3184
  "paidAt": {
3261
3185
  "description": "ISO 8601 datetime when the payment was received.",
@@ -3402,15 +3326,11 @@
3402
3326
  "description": "The original reason for the charge. Recovery never replaces this reason."
3403
3327
  },
3404
3328
  "paymentLinkId": {
3405
- "anyOf": [
3406
- {
3407
- "type": "string"
3408
- },
3409
- {
3410
- "type": "null"
3411
- }
3412
- ],
3413
- "description": "The public payment link ID, independently of the reason, or null when no payment link originated the charge."
3329
+ "description": "The public payment link ID, independently of the reason, or null when no payment link originated the charge.",
3330
+ "type": [
3331
+ "string",
3332
+ "null"
3333
+ ]
3414
3334
  },
3415
3335
  "recovery": {
3416
3336
  "anyOf": [
@@ -3490,15 +3410,11 @@
3490
3410
  "description": "The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId."
3491
3411
  },
3492
3412
  "subscriptionId": {
3493
- "anyOf": [
3494
- {
3495
- "type": "string"
3496
- },
3497
- {
3498
- "type": "null"
3499
- }
3500
- ],
3501
- "description": "The subscription ID, if the invoice is linked to a subscription."
3413
+ "description": "The subscription ID, if the invoice is linked to a subscription.",
3414
+ "type": [
3415
+ "string",
3416
+ "null"
3417
+ ]
3502
3418
  },
3503
3419
  "provider": {
3504
3420
  "type": "string",
@@ -3540,15 +3456,11 @@
3540
3456
  "description": "A human-readable failure message."
3541
3457
  },
3542
3458
  "recoveryUrl": {
3543
- "anyOf": [
3544
- {
3545
- "type": "string"
3546
- },
3547
- {
3548
- "type": "null"
3549
- }
3550
- ],
3551
- "description": "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."
3459
+ "description": "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.",
3460
+ "type": [
3461
+ "string",
3462
+ "null"
3463
+ ]
3552
3464
  }
3553
3465
  },
3554
3466
  "required": [
@@ -3678,15 +3590,11 @@
3678
3590
  "description": "The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId."
3679
3591
  },
3680
3592
  "subscriptionId": {
3681
- "anyOf": [
3682
- {
3683
- "type": "string"
3684
- },
3685
- {
3686
- "type": "null"
3687
- }
3688
- ],
3689
- "description": "The subscription ID, if the invoice is linked to a subscription."
3593
+ "description": "The subscription ID, if the invoice is linked to a subscription.",
3594
+ "type": [
3595
+ "string",
3596
+ "null"
3597
+ ]
3690
3598
  },
3691
3599
  "provider": {
3692
3600
  "anyOf": [
@@ -3968,59 +3876,39 @@
3968
3876
  "description": "The payment provider the charge was routed to: stripe, commet, or dlocal."
3969
3877
  },
3970
3878
  "paymentLinkId": {
3971
- "anyOf": [
3972
- {
3973
- "type": "string"
3974
- },
3975
- {
3976
- "type": "null"
3977
- }
3978
- ],
3979
- "description": "The payment link the payment originated from, or null when the payment did not come from a payment link."
3879
+ "description": "The payment link the payment originated from, or null when the payment did not come from a payment link.",
3880
+ "type": [
3881
+ "string",
3882
+ "null"
3883
+ ]
3980
3884
  },
3981
3885
  "invoiceId": {
3982
- "anyOf": [
3983
- {
3984
- "type": "string"
3985
- },
3986
- {
3987
- "type": "null"
3988
- }
3989
- ],
3990
- "description": "The invoice the payment collected, or null for payments without an invoice."
3886
+ "description": "The invoice the payment collected, or null for payments without an invoice.",
3887
+ "type": [
3888
+ "string",
3889
+ "null"
3890
+ ]
3991
3891
  },
3992
3892
  "invoiceNumber": {
3993
- "anyOf": [
3994
- {
3995
- "type": "string"
3996
- },
3997
- {
3998
- "type": "null"
3999
- }
4000
- ],
4001
- "description": "The human-readable invoice number, if available."
3893
+ "description": "The human-readable invoice number, if available.",
3894
+ "type": [
3895
+ "string",
3896
+ "null"
3897
+ ]
4002
3898
  },
4003
3899
  "customerId": {
4004
- "anyOf": [
4005
- {
4006
- "type": "string"
4007
- },
4008
- {
4009
- "type": "null"
4010
- }
4011
- ],
4012
- "description": "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."
3900
+ "description": "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.",
3901
+ "type": [
3902
+ "string",
3903
+ "null"
3904
+ ]
4013
3905
  },
4014
3906
  "subscriptionId": {
4015
- "anyOf": [
4016
- {
4017
- "type": "string"
4018
- },
4019
- {
4020
- "type": "null"
4021
- }
4022
- ],
4023
- "description": "The subscription ID, if the invoice is linked to a subscription."
3907
+ "description": "The subscription ID, if the invoice is linked to a subscription.",
3908
+ "type": [
3909
+ "string",
3910
+ "null"
3911
+ ]
4024
3912
  },
4025
3913
  "refundAmount": {
4026
3914
  "type": "number",
@@ -4147,59 +4035,39 @@
4147
4035
  "description": "The payment provider the charge was routed to: stripe, commet, or dlocal."
4148
4036
  },
4149
4037
  "paymentLinkId": {
4150
- "anyOf": [
4151
- {
4152
- "type": "string"
4153
- },
4154
- {
4155
- "type": "null"
4156
- }
4157
- ],
4158
- "description": "The payment link the payment originated from, or null when the payment did not come from a payment link."
4038
+ "description": "The payment link the payment originated from, or null when the payment did not come from a payment link.",
4039
+ "type": [
4040
+ "string",
4041
+ "null"
4042
+ ]
4159
4043
  },
4160
4044
  "invoiceId": {
4161
- "anyOf": [
4162
- {
4163
- "type": "string"
4164
- },
4165
- {
4166
- "type": "null"
4167
- }
4168
- ],
4169
- "description": "The invoice the payment collected, or null for payments without an invoice."
4045
+ "description": "The invoice the payment collected, or null for payments without an invoice.",
4046
+ "type": [
4047
+ "string",
4048
+ "null"
4049
+ ]
4170
4050
  },
4171
4051
  "invoiceNumber": {
4172
- "anyOf": [
4173
- {
4174
- "type": "string"
4175
- },
4176
- {
4177
- "type": "null"
4178
- }
4179
- ],
4180
- "description": "The human-readable invoice number, if available."
4052
+ "description": "The human-readable invoice number, if available.",
4053
+ "type": [
4054
+ "string",
4055
+ "null"
4056
+ ]
4181
4057
  },
4182
4058
  "customerId": {
4183
- "anyOf": [
4184
- {
4185
- "type": "string"
4186
- },
4187
- {
4188
- "type": "null"
4189
- }
4190
- ],
4191
- "description": "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."
4059
+ "description": "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.",
4060
+ "type": [
4061
+ "string",
4062
+ "null"
4063
+ ]
4192
4064
  },
4193
4065
  "subscriptionId": {
4194
- "anyOf": [
4195
- {
4196
- "type": "string"
4197
- },
4198
- {
4199
- "type": "null"
4200
- }
4201
- ],
4202
- "description": "The subscription ID, if the invoice is linked to a subscription."
4066
+ "description": "The subscription ID, if the invoice is linked to a subscription.",
4067
+ "type": [
4068
+ "string",
4069
+ "null"
4070
+ ]
4203
4071
  },
4204
4072
  "disputeAmount": {
4205
4073
  "type": "number",
@@ -4210,15 +4078,11 @@
4210
4078
  "description": "The dispute currency code."
4211
4079
  },
4212
4080
  "disputeReason": {
4213
- "anyOf": [
4214
- {
4215
- "type": "string"
4216
- },
4217
- {
4218
- "type": "null"
4219
- }
4220
- ],
4221
- "description": "The provider's reason code (e.g. fraudulent, product_not_received), or null when none is given."
4081
+ "description": "The provider's reason code (e.g. fraudulent, product_not_received), or null when none is given.",
4082
+ "type": [
4083
+ "string",
4084
+ "null"
4085
+ ]
4222
4086
  }
4223
4087
  },
4224
4088
  "required": [
@@ -4339,59 +4203,39 @@
4339
4203
  "description": "The payment provider the charge was routed to: stripe, commet, or dlocal."
4340
4204
  },
4341
4205
  "paymentLinkId": {
4342
- "anyOf": [
4343
- {
4344
- "type": "string"
4345
- },
4346
- {
4347
- "type": "null"
4348
- }
4349
- ],
4350
- "description": "The payment link the payment originated from, or null when the payment did not come from a payment link."
4206
+ "description": "The payment link the payment originated from, or null when the payment did not come from a payment link.",
4207
+ "type": [
4208
+ "string",
4209
+ "null"
4210
+ ]
4351
4211
  },
4352
4212
  "invoiceId": {
4353
- "anyOf": [
4354
- {
4355
- "type": "string"
4356
- },
4357
- {
4358
- "type": "null"
4359
- }
4360
- ],
4361
- "description": "The invoice the payment collected, or null for payments without an invoice."
4213
+ "description": "The invoice the payment collected, or null for payments without an invoice.",
4214
+ "type": [
4215
+ "string",
4216
+ "null"
4217
+ ]
4362
4218
  },
4363
4219
  "invoiceNumber": {
4364
- "anyOf": [
4365
- {
4366
- "type": "string"
4367
- },
4368
- {
4369
- "type": "null"
4370
- }
4371
- ],
4372
- "description": "The human-readable invoice number, if available."
4220
+ "description": "The human-readable invoice number, if available.",
4221
+ "type": [
4222
+ "string",
4223
+ "null"
4224
+ ]
4373
4225
  },
4374
4226
  "customerId": {
4375
- "anyOf": [
4376
- {
4377
- "type": "string"
4378
- },
4379
- {
4380
- "type": "null"
4381
- }
4382
- ],
4383
- "description": "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."
4227
+ "description": "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.",
4228
+ "type": [
4229
+ "string",
4230
+ "null"
4231
+ ]
4384
4232
  },
4385
4233
  "subscriptionId": {
4386
- "anyOf": [
4387
- {
4388
- "type": "string"
4389
- },
4390
- {
4391
- "type": "null"
4392
- }
4393
- ],
4394
- "description": "The subscription ID, if the invoice is linked to a subscription."
4234
+ "description": "The subscription ID, if the invoice is linked to a subscription.",
4235
+ "type": [
4236
+ "string",
4237
+ "null"
4238
+ ]
4395
4239
  },
4396
4240
  "disputeAmount": {
4397
4241
  "type": "number",
@@ -4402,15 +4246,11 @@
4402
4246
  "description": "The dispute currency code."
4403
4247
  },
4404
4248
  "disputeReason": {
4405
- "anyOf": [
4406
- {
4407
- "type": "string"
4408
- },
4409
- {
4410
- "type": "null"
4411
- }
4412
- ],
4413
- "description": "The provider's reason code, or null when none is given."
4249
+ "description": "The provider's reason code, or null when none is given.",
4250
+ "type": [
4251
+ "string",
4252
+ "null"
4253
+ ]
4414
4254
  },
4415
4255
  "outcome": {
4416
4256
  "type": "string",
@@ -4544,15 +4384,11 @@
4544
4384
  "description": "The payment description shown to the customer."
4545
4385
  },
4546
4386
  "customerId": {
4547
- "anyOf": [
4548
- {
4549
- "type": "string"
4550
- },
4551
- {
4552
- "type": "null"
4553
- }
4554
- ],
4555
- "description": "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."
4387
+ "description": "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.",
4388
+ "type": [
4389
+ "string",
4390
+ "null"
4391
+ ]
4556
4392
  }
4557
4393
  },
4558
4394
  "required": [
@@ -4674,15 +4510,11 @@
4674
4510
  "description": "The original reason for the charge. Recovery never replaces this reason."
4675
4511
  },
4676
4512
  "paymentLinkId": {
4677
- "anyOf": [
4678
- {
4679
- "type": "string"
4680
- },
4681
- {
4682
- "type": "null"
4683
- }
4684
- ],
4685
- "description": "The public payment link ID, independently of the reason, or null when no payment link originated the charge."
4513
+ "description": "The public payment link ID, independently of the reason, or null when no payment link originated the charge.",
4514
+ "type": [
4515
+ "string",
4516
+ "null"
4517
+ ]
4686
4518
  },
4687
4519
  "recovery": {
4688
4520
  "anyOf": [
@@ -4770,15 +4602,11 @@
4770
4602
  "description": "The payment description shown to the customer."
4771
4603
  },
4772
4604
  "customerId": {
4773
- "anyOf": [
4774
- {
4775
- "type": "string"
4776
- },
4777
- {
4778
- "type": "null"
4779
- }
4780
- ],
4781
- "description": "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."
4605
+ "description": "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.",
4606
+ "type": [
4607
+ "string",
4608
+ "null"
4609
+ ]
4782
4610
  },
4783
4611
  "invoiceId": {
4784
4612
  "type": "string",
@@ -4789,15 +4617,11 @@
4789
4617
  "description": "The human-readable invoice number."
4790
4618
  },
4791
4619
  "paymentTransactionId": {
4792
- "anyOf": [
4793
- {
4794
- "type": "string"
4795
- },
4796
- {
4797
- "type": "null"
4798
- }
4799
- ],
4800
- "description": "The payment transaction ID for the settled charge."
4620
+ "description": "The payment transaction ID for the settled charge.",
4621
+ "type": [
4622
+ "string",
4623
+ "null"
4624
+ ]
4801
4625
  },
4802
4626
  "paymentMethod": {
4803
4627
  "anyOf": [
@@ -4957,15 +4781,11 @@
4957
4781
  "description": "The original reason for the charge. Recovery never replaces this reason."
4958
4782
  },
4959
4783
  "paymentLinkId": {
4960
- "anyOf": [
4961
- {
4962
- "type": "string"
4963
- },
4964
- {
4965
- "type": "null"
4966
- }
4967
- ],
4968
- "description": "The public payment link ID, independently of the reason, or null when no payment link originated the charge."
4784
+ "description": "The public payment link ID, independently of the reason, or null when no payment link originated the charge.",
4785
+ "type": [
4786
+ "string",
4787
+ "null"
4788
+ ]
4969
4789
  },
4970
4790
  "recovery": {
4971
4791
  "anyOf": [
@@ -5053,15 +4873,11 @@
5053
4873
  "description": "The payment description shown to the customer."
5054
4874
  },
5055
4875
  "customerId": {
5056
- "anyOf": [
5057
- {
5058
- "type": "string"
5059
- },
5060
- {
5061
- "type": "null"
5062
- }
5063
- ],
5064
- "description": "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."
4876
+ "description": "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.",
4877
+ "type": [
4878
+ "string",
4879
+ "null"
4880
+ ]
5065
4881
  },
5066
4882
  "failureCode": {
5067
4883
  "type": "string",
@@ -5225,15 +5041,11 @@
5225
5041
  "description": "The payment description shown to the customer."
5226
5042
  },
5227
5043
  "customerId": {
5228
- "anyOf": [
5229
- {
5230
- "type": "string"
5231
- },
5232
- {
5233
- "type": "null"
5234
- }
5235
- ],
5236
- "description": "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."
5044
+ "description": "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.",
5045
+ "type": [
5046
+ "string",
5047
+ "null"
5048
+ ]
5237
5049
  }
5238
5050
  },
5239
5051
  "required": [
@@ -5377,15 +5189,11 @@
5377
5189
  "description": "The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId."
5378
5190
  },
5379
5191
  "subscriptionId": {
5380
- "anyOf": [
5381
- {
5382
- "type": "string"
5383
- },
5384
- {
5385
- "type": "null"
5386
- }
5387
- ],
5388
- "description": "The subscription ID, if the invoice is linked to a subscription."
5192
+ "description": "The subscription ID, if the invoice is linked to a subscription.",
5193
+ "type": [
5194
+ "string",
5195
+ "null"
5196
+ ]
5389
5197
  }
5390
5198
  },
5391
5199
  "required": [
@@ -5541,15 +5349,11 @@
5541
5349
  "description": "The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId."
5542
5350
  },
5543
5351
  "subscriptionId": {
5544
- "anyOf": [
5545
- {
5546
- "type": "string"
5547
- },
5548
- {
5549
- "type": "null"
5550
- }
5551
- ],
5552
- "description": "The subscription ID, if the invoice is linked to a subscription."
5352
+ "description": "The subscription ID, if the invoice is linked to a subscription.",
5353
+ "type": [
5354
+ "string",
5355
+ "null"
5356
+ ]
5553
5357
  }
5554
5358
  },
5555
5359
  "required": [
@@ -5705,15 +5509,11 @@
5705
5509
  "description": "The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId."
5706
5510
  },
5707
5511
  "subscriptionId": {
5708
- "anyOf": [
5709
- {
5710
- "type": "string"
5711
- },
5712
- {
5713
- "type": "null"
5714
- }
5715
- ],
5716
- "description": "The subscription ID, if the invoice is linked to a subscription."
5512
+ "description": "The subscription ID, if the invoice is linked to a subscription.",
5513
+ "type": [
5514
+ "string",
5515
+ "null"
5516
+ ]
5717
5517
  }
5718
5518
  },
5719
5519
  "required": [
@@ -5845,15 +5645,11 @@
5845
5645
  "description": "The plan name."
5846
5646
  },
5847
5647
  "billingInterval": {
5848
- "anyOf": [
5849
- {
5850
- "type": "string"
5851
- },
5852
- {
5853
- "type": "null"
5854
- }
5855
- ],
5856
- "description": "The billing interval (monthly, yearly)."
5648
+ "description": "The billing interval (monthly, yearly).",
5649
+ "type": [
5650
+ "string",
5651
+ "null"
5652
+ ]
5857
5653
  },
5858
5654
  "currentPeriodEnd": {
5859
5655
  "type": "string",
@@ -6163,10 +5959,10 @@
6163
5959
  }
6164
5960
  }
6165
5961
  },
6166
- "customer.created": {
5962
+ "payment_method.detached": {
6167
5963
  "post": {
6168
- "summary": "customer.created",
6169
- "description": "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.",
5964
+ "summary": "payment_method.detached",
5965
+ "description": "Fired when a saved payment method is removed from a customer: the customer unlinked it at the payment provider (for example, revoking a Mercado Pago authorization), or removed it through the customer portal. Removing a method never changes the customer's subscriptions; a renewal that finds no usable method follows the usual failed-payment recovery.",
6170
5966
  "tags": [
6171
5967
  "Webhooks"
6172
5968
  ],
@@ -6182,7 +5978,7 @@
6182
5978
  },
6183
5979
  "event": {
6184
5980
  "type": "string",
6185
- "const": "customer.created"
5981
+ "const": "payment_method.detached"
6186
5982
  },
6187
5983
  "timestamp": {
6188
5984
  "type": "string"
@@ -6203,68 +5999,203 @@
6203
5999
  "data": {
6204
6000
  "type": "object",
6205
6001
  "properties": {
6206
- "id": {
6002
+ "customerId": {
6207
6003
  "type": "string",
6208
- "description": "The Commet customer ID (cus_...)."
6004
+ "description": "The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId."
6209
6005
  },
6210
- "externalId": {
6006
+ "paymentMethod": {
6211
6007
  "anyOf": [
6212
6008
  {
6213
- "type": "string"
6009
+ "$ref": "#/components/schemas/PaymentMethod"
6214
6010
  },
6215
6011
  {
6216
6012
  "type": "null"
6217
6013
  }
6218
6014
  ],
6219
- "description": "Your own identifier for this customer, if you provided one."
6015
+ "description": "The payment method: card, oxxo, or mercado_pago. Null when unknown."
6220
6016
  },
6221
- "fullName": {
6017
+ "card": {
6222
6018
  "anyOf": [
6223
6019
  {
6224
- "type": "string"
6020
+ "$ref": "#/components/schemas/WebhookCardInfo"
6225
6021
  },
6226
6022
  {
6227
6023
  "type": "null"
6228
6024
  }
6229
6025
  ],
6230
- "description": "The customer's full name."
6026
+ "description": "Card display metadata of the removed method: brand, last4, expMonth, expYear. Null when the method is not a card or its details cannot be retrieved."
6027
+ },
6028
+ "reason": {
6029
+ "type": "string",
6030
+ "enum": [
6031
+ "unlinked_at_provider",
6032
+ "removed_by_customer"
6033
+ ],
6034
+ "description": "Why the method was removed: `unlinked_at_provider` when the customer revoked it at the payment provider, `removed_by_customer` when the customer removed it through the customer portal."
6035
+ }
6036
+ },
6037
+ "required": [
6038
+ "customerId",
6039
+ "paymentMethod",
6040
+ "card",
6041
+ "reason"
6042
+ ],
6043
+ "additionalProperties": false
6044
+ }
6045
+ },
6046
+ "required": [
6047
+ "id",
6048
+ "event",
6049
+ "timestamp",
6050
+ "organizationId",
6051
+ "mode",
6052
+ "apiVersion",
6053
+ "data"
6054
+ ],
6055
+ "additionalProperties": false
6056
+ },
6057
+ "example": {
6058
+ "event": "payment_method.detached",
6059
+ "timestamp": "2026-06-23T14:30:00.000Z",
6060
+ "organizationId": "8f14e45f-ceea-4e7a-9c3d-1c2b3a4d5e6f",
6061
+ "mode": "live",
6062
+ "apiVersion": "2026-08-27",
6063
+ "data": {
6064
+ "customerId": "user_123",
6065
+ "paymentMethod": "mercado_pago",
6066
+ "card": null,
6067
+ "reason": "unlinked_at_provider"
6068
+ }
6069
+ }
6070
+ }
6071
+ }
6072
+ },
6073
+ "responses": {
6074
+ "200": {
6075
+ "description": "Return any 2xx status code to acknowledge receipt of the event."
6076
+ }
6077
+ },
6078
+ "x-mint": {
6079
+ "href": "/webhooks/payment-method-detached",
6080
+ "metadata": {
6081
+ "playground": "none"
6082
+ }
6083
+ }
6084
+ }
6085
+ },
6086
+ "customer.created": {
6087
+ "post": {
6088
+ "summary": "customer.created",
6089
+ "description": "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.",
6090
+ "tags": [
6091
+ "Webhooks"
6092
+ ],
6093
+ "requestBody": {
6094
+ "required": true,
6095
+ "content": {
6096
+ "application/json": {
6097
+ "schema": {
6098
+ "type": "object",
6099
+ "properties": {
6100
+ "id": {
6101
+ "type": "string"
6102
+ },
6103
+ "event": {
6104
+ "type": "string",
6105
+ "const": "customer.created"
6106
+ },
6107
+ "timestamp": {
6108
+ "type": "string"
6109
+ },
6110
+ "organizationId": {
6111
+ "type": "string"
6112
+ },
6113
+ "mode": {
6114
+ "type": "string",
6115
+ "enum": [
6116
+ "live",
6117
+ "sandbox"
6118
+ ]
6119
+ },
6120
+ "apiVersion": {
6121
+ "type": "string"
6122
+ },
6123
+ "data": {
6124
+ "type": "object",
6125
+ "properties": {
6126
+ "id": {
6127
+ "type": "string",
6128
+ "description": "The Commet customer ID (cus_...)."
6129
+ },
6130
+ "externalId": {
6131
+ "description": "Your own identifier for this customer, if you provided one.",
6132
+ "type": [
6133
+ "string",
6134
+ "null"
6135
+ ]
6136
+ },
6137
+ "fullName": {
6138
+ "description": "The customer's full name.",
6139
+ "type": [
6140
+ "string",
6141
+ "null"
6142
+ ]
6231
6143
  },
6232
6144
  "email": {
6233
6145
  "type": "string",
6234
6146
  "description": "The customer's email."
6235
6147
  },
6236
6148
  "taxDocument": {
6237
- "anyOf": [
6238
- {
6239
- "type": "string"
6240
- },
6241
- {
6242
- "type": "null"
6243
- }
6244
- ],
6245
- "description": "The customer's tax identification number, if provided."
6149
+ "description": "The customer's tax identification number, if provided.",
6150
+ "type": [
6151
+ "string",
6152
+ "null"
6153
+ ]
6246
6154
  },
6247
6155
  "documentType": {
6156
+ "description": "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.",
6157
+ "type": [
6158
+ "string",
6159
+ "null"
6160
+ ]
6161
+ },
6162
+ "businessTaxId": {
6248
6163
  "anyOf": [
6249
6164
  {
6250
- "type": "string"
6165
+ "type": "object",
6166
+ "properties": {
6167
+ "country": {
6168
+ "type": "string",
6169
+ "description": "ISO-2 country the tax ID belongs to."
6170
+ },
6171
+ "type": {
6172
+ "type": "string",
6173
+ "description": "Tax ID type (e.g. eu_vat, pe_ruc)."
6174
+ },
6175
+ "value": {
6176
+ "type": "string",
6177
+ "description": "The normalized tax ID."
6178
+ }
6179
+ },
6180
+ "required": [
6181
+ "country",
6182
+ "type",
6183
+ "value"
6184
+ ],
6185
+ "additionalProperties": false
6251
6186
  },
6252
6187
  {
6253
6188
  "type": "null"
6254
6189
  }
6255
6190
  ],
6256
- "description": "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."
6191
+ "description": "The business tax ID saved for the customer (EU VAT number, Peruvian RUC), or null when the customer has none."
6257
6192
  },
6258
6193
  "timezone": {
6259
- "anyOf": [
6260
- {
6261
- "type": "string"
6262
- },
6263
- {
6264
- "type": "null"
6265
- }
6266
- ],
6267
- "description": "The customer's timezone."
6194
+ "description": "The customer's timezone.",
6195
+ "type": [
6196
+ "string",
6197
+ "null"
6198
+ ]
6268
6199
  },
6269
6200
  "metadata": {
6270
6201
  "anyOf": [
@@ -6297,6 +6228,7 @@
6297
6228
  "email",
6298
6229
  "taxDocument",
6299
6230
  "documentType",
6231
+ "businessTaxId",
6300
6232
  "timezone",
6301
6233
  "metadata",
6302
6234
  "createdAt",
@@ -6329,6 +6261,7 @@
6329
6261
  "email": "ada@acme.com",
6330
6262
  "taxDocument": "20-12345678-9",
6331
6263
  "documentType": "CUIT",
6264
+ "businessTaxId": null,
6332
6265
  "timezone": "UTC",
6333
6266
  "metadata": {
6334
6267
  "plan_intent": "pro"
@@ -6401,63 +6334,74 @@
6401
6334
  "description": "The Commet customer ID (cus_...)."
6402
6335
  },
6403
6336
  "externalId": {
6404
- "anyOf": [
6405
- {
6406
- "type": "string"
6407
- },
6408
- {
6409
- "type": "null"
6410
- }
6411
- ],
6412
- "description": "Your own identifier for this customer, if you provided one."
6337
+ "description": "Your own identifier for this customer, if you provided one.",
6338
+ "type": [
6339
+ "string",
6340
+ "null"
6341
+ ]
6413
6342
  },
6414
6343
  "fullName": {
6415
- "anyOf": [
6416
- {
6417
- "type": "string"
6418
- },
6419
- {
6420
- "type": "null"
6421
- }
6422
- ],
6423
- "description": "The customer's full name."
6344
+ "description": "The customer's full name.",
6345
+ "type": [
6346
+ "string",
6347
+ "null"
6348
+ ]
6424
6349
  },
6425
6350
  "email": {
6426
6351
  "type": "string",
6427
6352
  "description": "The customer's email."
6428
6353
  },
6429
6354
  "taxDocument": {
6430
- "anyOf": [
6431
- {
6432
- "type": "string"
6433
- },
6434
- {
6435
- "type": "null"
6436
- }
6437
- ],
6438
- "description": "The customer's tax identification number, if provided."
6355
+ "description": "The customer's tax identification number, if provided.",
6356
+ "type": [
6357
+ "string",
6358
+ "null"
6359
+ ]
6439
6360
  },
6440
6361
  "documentType": {
6362
+ "description": "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.",
6363
+ "type": [
6364
+ "string",
6365
+ "null"
6366
+ ]
6367
+ },
6368
+ "businessTaxId": {
6441
6369
  "anyOf": [
6442
6370
  {
6443
- "type": "string"
6371
+ "type": "object",
6372
+ "properties": {
6373
+ "country": {
6374
+ "type": "string",
6375
+ "description": "ISO-2 country the tax ID belongs to."
6376
+ },
6377
+ "type": {
6378
+ "type": "string",
6379
+ "description": "Tax ID type (e.g. eu_vat, pe_ruc)."
6380
+ },
6381
+ "value": {
6382
+ "type": "string",
6383
+ "description": "The normalized tax ID."
6384
+ }
6385
+ },
6386
+ "required": [
6387
+ "country",
6388
+ "type",
6389
+ "value"
6390
+ ],
6391
+ "additionalProperties": false
6444
6392
  },
6445
6393
  {
6446
6394
  "type": "null"
6447
6395
  }
6448
6396
  ],
6449
- "description": "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."
6397
+ "description": "The business tax ID saved for the customer (EU VAT number, Peruvian RUC), or null when the customer has none."
6450
6398
  },
6451
6399
  "timezone": {
6452
- "anyOf": [
6453
- {
6454
- "type": "string"
6455
- },
6456
- {
6457
- "type": "null"
6458
- }
6459
- ],
6460
- "description": "The customer's timezone."
6400
+ "description": "The customer's timezone.",
6401
+ "type": [
6402
+ "string",
6403
+ "null"
6404
+ ]
6461
6405
  },
6462
6406
  "metadata": {
6463
6407
  "anyOf": [
@@ -6490,6 +6434,7 @@
6490
6434
  "email",
6491
6435
  "taxDocument",
6492
6436
  "documentType",
6437
+ "businessTaxId",
6493
6438
  "timezone",
6494
6439
  "metadata",
6495
6440
  "createdAt",
@@ -6522,6 +6467,7 @@
6522
6467
  "email": "ada.lovelace@acme.com",
6523
6468
  "taxDocument": "20-12345678-9",
6524
6469
  "documentType": "CUIT",
6470
+ "businessTaxId": null,
6525
6471
  "timezone": "Europe/London",
6526
6472
  "metadata": {
6527
6473
  "plan_intent": "pro"
@@ -6602,15 +6548,11 @@
6602
6548
  "description": "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."
6603
6549
  },
6604
6550
  "subscriptionId": {
6605
- "anyOf": [
6606
- {
6607
- "type": "string"
6608
- },
6609
- {
6610
- "type": "null"
6611
- }
6612
- ],
6613
- "description": "The live subscription ID, or null when status is none."
6551
+ "description": "The live subscription ID, or null when status is none.",
6552
+ "type": [
6553
+ "string",
6554
+ "null"
6555
+ ]
6614
6556
  },
6615
6557
  "plan": {
6616
6558
  "anyOf": [
@@ -6624,26 +6566,18 @@
6624
6566
  "description": "The current plan (id and name), or null when status is none."
6625
6567
  },
6626
6568
  "billingInterval": {
6627
- "anyOf": [
6628
- {
6629
- "type": "string"
6630
- },
6631
- {
6632
- "type": "null"
6633
- }
6634
- ],
6635
- "description": "The current billing interval."
6569
+ "description": "The current billing interval.",
6570
+ "type": [
6571
+ "string",
6572
+ "null"
6573
+ ]
6636
6574
  },
6637
6575
  "consumptionModel": {
6638
- "anyOf": [
6639
- {
6640
- "type": "string"
6641
- },
6642
- {
6643
- "type": "null"
6644
- }
6645
- ],
6646
- "description": "The plan's consumption model: metered, credits, or balance."
6576
+ "description": "The plan's consumption model: metered, credits, or balance.",
6577
+ "type": [
6578
+ "string",
6579
+ "null"
6580
+ ]
6647
6581
  },
6648
6582
  "features": {
6649
6583
  "type": "array",
@@ -6661,15 +6595,11 @@
6661
6595
  "description": "Display name of the feature."
6662
6596
  },
6663
6597
  "unitName": {
6664
- "anyOf": [
6665
- {
6666
- "type": "string"
6667
- },
6668
- {
6669
- "type": "null"
6670
- }
6671
- ],
6672
- "description": "Display name for one product unit, or null when not applicable."
6598
+ "description": "Display name for one product unit, or null when not applicable.",
6599
+ "type": [
6600
+ "string",
6601
+ "null"
6602
+ ]
6673
6603
  },
6674
6604
  "allowed": {
6675
6605
  "type": "boolean",
@@ -6706,15 +6636,11 @@
6706
6636
  "description": "Display name of the feature."
6707
6637
  },
6708
6638
  "unitName": {
6709
- "anyOf": [
6710
- {
6711
- "type": "string"
6712
- },
6713
- {
6714
- "type": "null"
6715
- }
6716
- ],
6717
- "description": "Display name for one product unit, or null when not applicable."
6639
+ "description": "Display name for one product unit, or null when not applicable.",
6640
+ "type": [
6641
+ "string",
6642
+ "null"
6643
+ ]
6718
6644
  },
6719
6645
  "allowed": {
6720
6646
  "type": "boolean",
@@ -7009,15 +6935,11 @@
7009
6935
  "description": "Display name of the feature."
7010
6936
  },
7011
6937
  "unitName": {
7012
- "anyOf": [
7013
- {
7014
- "type": "string"
7015
- },
7016
- {
7017
- "type": "null"
7018
- }
7019
- ],
7020
- "description": "Display name for one product unit, or null when not applicable."
6938
+ "description": "Display name for one product unit, or null when not applicable.",
6939
+ "type": [
6940
+ "string",
6941
+ "null"
6942
+ ]
7021
6943
  },
7022
6944
  "allowed": {
7023
6945
  "type": "boolean",
@@ -7145,15 +7067,11 @@
7145
7067
  "description": "Display name of the feature."
7146
7068
  },
7147
7069
  "unitName": {
7148
- "anyOf": [
7149
- {
7150
- "type": "string"
7151
- },
7152
- {
7153
- "type": "null"
7154
- }
7155
- ],
7156
- "description": "Display name for one product unit, or null when not applicable."
7070
+ "description": "Display name for one product unit, or null when not applicable.",
7071
+ "type": [
7072
+ "string",
7073
+ "null"
7074
+ ]
7157
7075
  },
7158
7076
  "allowed": {
7159
7077
  "type": "boolean",
@@ -7305,7 +7223,7 @@
7305
7223
  "type": "null"
7306
7224
  }
7307
7225
  ],
7308
- "description": "For balance plans: currentBalance in rate scale (10000 = $1.00). Null otherwise."
7226
+ "description": "For balance plans, in rate scale (10000 = 1.00 of the subscription currency): currentBalance (the available total), planBalance, purchasedBalance and totalBalance. Null otherwise."
7309
7227
  }
7310
7228
  },
7311
7229
  "required": [
@@ -8457,7 +8375,7 @@
8457
8375
  "credits.granted": {
8458
8376
  "post": {
8459
8377
  "summary": "credits.granted",
8460
- "description": "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.",
8378
+ "description": "Fired when non-purchase credits are granted to a subscription: plan-included credits at the start of each billing period, or a manual adjustment from the dashboard. Credit purchases through the API, automatic top-ups, or the customer portal fire credits.purchased instead.",
8461
8379
  "tags": [
8462
8380
  "Webhooks"
8463
8381
  ],
@@ -8559,14 +8477,14 @@
8559
8477
  "description": "Non-purchase credits were granted to a subscription.",
8560
8478
  "playground": "none"
8561
8479
  },
8562
- "content": "## When this fires\n\nPlan-included credits are granted at the start of every billing period (`reason: \"period_reset\"`), and manual adjustments from the dashboard grant purchased credits (`reason: \"manual_adjustment\"`). Credit pack purchases are a separate flow and fire `credits.purchased` instead.\n\nThe idempotency key is derived from the billing operation that granted the credits, so engine retries never send a duplicate.\n\nUse it to reset in-app usage meters at the start of a period or to confirm a support-driven credit grant reached the customer."
8480
+ "content": "## When this fires\n\nPlan-included credits are granted at the start of every billing period (`reason: \"period_reset\"`), and manual adjustments from the dashboard grant purchased credits (`reason: \"manual_adjustment\"`). Purchases through the API, automatic top-ups, or the customer portal fire `credits.purchased` instead.\n\nThe idempotency key is derived from the billing operation that granted the credits, so engine retries never send a duplicate.\n\nUse it to reset in-app usage meters at the start of a period or to confirm a support-driven credit grant reached the customer."
8563
8481
  }
8564
8482
  }
8565
8483
  },
8566
8484
  "credits.purchased": {
8567
8485
  "post": {
8568
8486
  "summary": "credits.purchased",
8569
- "description": "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.",
8487
+ "description": "Fired when a customer buys a credit pack or a chosen quantity of credits through the API, an automatic top-up, or the customer portal and the payment succeeds. Purchased credits never expire — unlike plan credits, they survive period resets. Plan-included credit grants fire credits.granted instead.",
8570
8488
  "tags": [
8571
8489
  "Webhooks"
8572
8490
  ],
@@ -8621,7 +8539,7 @@
8621
8539
  },
8622
8540
  "creditPackName": {
8623
8541
  "type": "string",
8624
- "description": "The purchased credit pack's name."
8542
+ "description": "The purchased credit pack's name, or Credit purchase for a chosen quantity of credits."
8625
8543
  },
8626
8544
  "credits": {
8627
8545
  "type": "number",
@@ -8674,20 +8592,135 @@
8674
8592
  }
8675
8593
  },
8676
8594
  "x-mint": {
8677
- "href": "/webhooks/credits-purchased",
8595
+ "href": "/webhooks/credits-purchased",
8596
+ "metadata": {
8597
+ "title": "credits.purchased",
8598
+ "description": "A credit pack or a chosen quantity of credits was purchased.",
8599
+ "playground": "none"
8600
+ },
8601
+ "content": "## When this fires\n\nWhen a customer buys a credit pack or a chosen quantity of credits through the API, an automatic top-up, or the customer portal, and the payment succeeds. Purchased credits never expire — unlike plan credits, they survive period resets.\n\nPlan-included credits granted at each period reset fire `credits.granted` instead.\n\nUse it to confirm top-up purchases in your own UI or analytics."
8602
+ }
8603
+ }
8604
+ },
8605
+ "credits.low": {
8606
+ "post": {
8607
+ "summary": "credits.low",
8608
+ "description": "Fired when a subscription's available credits (plan plus purchased) cross below 10% of their last refill: a period reset, a purchase or a manual adjustment. Emitted once per crossing, the same rule as balance.low.",
8609
+ "tags": [
8610
+ "Webhooks"
8611
+ ],
8612
+ "requestBody": {
8613
+ "required": true,
8614
+ "content": {
8615
+ "application/json": {
8616
+ "schema": {
8617
+ "type": "object",
8618
+ "properties": {
8619
+ "id": {
8620
+ "type": "string"
8621
+ },
8622
+ "event": {
8623
+ "type": "string",
8624
+ "const": "credits.low"
8625
+ },
8626
+ "timestamp": {
8627
+ "type": "string"
8628
+ },
8629
+ "organizationId": {
8630
+ "type": "string"
8631
+ },
8632
+ "mode": {
8633
+ "type": "string",
8634
+ "enum": [
8635
+ "live",
8636
+ "sandbox"
8637
+ ]
8638
+ },
8639
+ "apiVersion": {
8640
+ "type": "string"
8641
+ },
8642
+ "data": {
8643
+ "type": "object",
8644
+ "properties": {
8645
+ "subscriptionId": {
8646
+ "type": "string",
8647
+ "description": "The subscription ID."
8648
+ },
8649
+ "customerId": {
8650
+ "type": "string",
8651
+ "description": "The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId."
8652
+ },
8653
+ "remainingCredits": {
8654
+ "type": "number",
8655
+ "description": "Total credits remaining (plan plus purchased)."
8656
+ },
8657
+ "thresholdCredits": {
8658
+ "type": "number",
8659
+ "description": "The low-credit threshold that was crossed: 10% of the last refill."
8660
+ },
8661
+ "periodCredits": {
8662
+ "type": "number",
8663
+ "description": "The credits added by the last refill: a period reset, a purchase or a manual adjustment."
8664
+ }
8665
+ },
8666
+ "required": [
8667
+ "subscriptionId",
8668
+ "customerId",
8669
+ "remainingCredits",
8670
+ "thresholdCredits",
8671
+ "periodCredits"
8672
+ ],
8673
+ "additionalProperties": false
8674
+ }
8675
+ },
8676
+ "required": [
8677
+ "id",
8678
+ "event",
8679
+ "timestamp",
8680
+ "organizationId",
8681
+ "mode",
8682
+ "apiVersion",
8683
+ "data"
8684
+ ],
8685
+ "additionalProperties": false
8686
+ },
8687
+ "example": {
8688
+ "event": "credits.low",
8689
+ "timestamp": "2026-06-23T14:30:00.000Z",
8690
+ "organizationId": "8f14e45f-ceea-4e7a-9c3d-1c2b3a4d5e6f",
8691
+ "mode": "live",
8692
+ "apiVersion": "2026-08-27",
8693
+ "data": {
8694
+ "subscriptionId": "sub_1a2b3c4d",
8695
+ "customerId": "user_123",
8696
+ "remainingCredits": 42,
8697
+ "thresholdCredits": 50,
8698
+ "periodCredits": 500
8699
+ }
8700
+ }
8701
+ }
8702
+ }
8703
+ },
8704
+ "responses": {
8705
+ "200": {
8706
+ "description": "Return any 2xx status code to acknowledge receipt of the event."
8707
+ }
8708
+ },
8709
+ "x-mint": {
8710
+ "href": "/webhooks/credits-low",
8678
8711
  "metadata": {
8679
- "title": "credits.purchased",
8680
- "description": "A credit pack purchase was completed.",
8712
+ "title": "credits.low",
8713
+ "description": "Remaining credits dropped below 10% of the period grant.",
8681
8714
  "playground": "none"
8682
8715
  },
8683
- "content": "## When this fires\n\nWhen 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.\n\nPlan-included credits granted at each period reset fire `credits.granted` instead.\n\nUse it to confirm top-up purchases in your own UI or analytics."
8716
+ "content": "## When this fires\n\nThe async usage processor watches every credit deduction. When a batch of usage moves the remaining credits (plan plus purchased) from above to at-or-below 10% of the credits granted at the last period reset, this event fires once. It does not re-fire while the balance stays low, and the next period reset re-arms it.\n\nIf a single burst of usage jumps straight past zero, only `credits.depleted` fires.\n\nUse it to prompt the customer to buy a credit pack before they hit zero."
8684
8717
  }
8685
8718
  }
8686
8719
  },
8687
- "credits.low": {
8720
+ "credits.depleted": {
8688
8721
  "post": {
8689
- "summary": "credits.low",
8690
- "description": "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.",
8722
+ "summary": "credits.depleted",
8723
+ "description": "Fired each time a subscription's available credits cross to zero or below. Usage that needs more credits than remain is rejected from this point, unless the plan allows overage, which is billed at its price per credit at the next renewal. Also fires customer.state_changed with trigger credits_depleted.",
8691
8724
  "tags": [
8692
8725
  "Webhooks"
8693
8726
  ],
@@ -8703,7 +8736,7 @@
8703
8736
  },
8704
8737
  "event": {
8705
8738
  "type": "string",
8706
- "const": "credits.low"
8739
+ "const": "credits.depleted"
8707
8740
  },
8708
8741
  "timestamp": {
8709
8742
  "type": "string"
@@ -8734,23 +8767,13 @@
8734
8767
  },
8735
8768
  "remainingCredits": {
8736
8769
  "type": "number",
8737
- "description": "Total credits remaining (plan plus purchased)."
8738
- },
8739
- "thresholdCredits": {
8740
- "type": "number",
8741
- "description": "The low-credit threshold that was crossed: 10% of the period's granted plan credits."
8742
- },
8743
- "periodCredits": {
8744
- "type": "number",
8745
- "description": "The plan credits granted at the last period reset."
8770
+ "description": "Credits remaining after depletion. Always 0."
8746
8771
  }
8747
8772
  },
8748
8773
  "required": [
8749
8774
  "subscriptionId",
8750
8775
  "customerId",
8751
- "remainingCredits",
8752
- "thresholdCredits",
8753
- "periodCredits"
8776
+ "remainingCredits"
8754
8777
  ],
8755
8778
  "additionalProperties": false
8756
8779
  }
@@ -8767,7 +8790,7 @@
8767
8790
  "additionalProperties": false
8768
8791
  },
8769
8792
  "example": {
8770
- "event": "credits.low",
8793
+ "event": "credits.depleted",
8771
8794
  "timestamp": "2026-06-23T14:30:00.000Z",
8772
8795
  "organizationId": "8f14e45f-ceea-4e7a-9c3d-1c2b3a4d5e6f",
8773
8796
  "mode": "live",
@@ -8775,9 +8798,7 @@
8775
8798
  "data": {
8776
8799
  "subscriptionId": "sub_1a2b3c4d",
8777
8800
  "customerId": "user_123",
8778
- "remainingCredits": 42,
8779
- "thresholdCredits": 50,
8780
- "periodCredits": 500
8801
+ "remainingCredits": 0
8781
8802
  }
8782
8803
  }
8783
8804
  }
@@ -8789,20 +8810,20 @@
8789
8810
  }
8790
8811
  },
8791
8812
  "x-mint": {
8792
- "href": "/webhooks/credits-low",
8813
+ "href": "/webhooks/credits-depleted",
8793
8814
  "metadata": {
8794
- "title": "credits.low",
8795
- "description": "Remaining credits dropped below 10% of the period grant.",
8815
+ "title": "credits.depleted",
8816
+ "description": "A subscription ran out of credits.",
8796
8817
  "playground": "none"
8797
8818
  },
8798
- "content": "## When this fires\n\nThe async usage processor watches every credit deduction. When a batch of usage moves the remaining credits (plan plus purchased) from above to at-or-below 10% of the credits granted at the last period reset, this event fires once. It does not re-fire while the balance stays low, and the next period reset re-arms it.\n\nIf a single burst of usage jumps straight past zero, only `credits.depleted` fires.\n\nUse it to prompt the customer to buy a credit pack before they hit zero."
8819
+ "content": "## When this fires\n\nThe async usage processor fires this once when a deduction moves the credit balance from positive to zero. From this point, usage requests that need more credits than remain are rejected with `insufficient_credits`.\n\n`customer.state_changed` fires alongside it with trigger `credits_depleted`, carrying the customer's full current entitlement state.\n\nUse it to block gated features in your app and drive the customer to a credit pack purchase."
8799
8820
  }
8800
8821
  }
8801
8822
  },
8802
- "credits.depleted": {
8823
+ "credits.expired": {
8803
8824
  "post": {
8804
- "summary": "credits.depleted",
8805
- "description": "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.",
8825
+ "summary": "credits.expired",
8826
+ "description": "Fired at a reset when unused plan credits are discarded. On a plan whose unused plan credits expire, every unused plan credit expires at each reset. On a plan that rolls them over, a reset keeps them, up to the plan's maxPlanCredits when it has one, and only the excess expires. A change to another credits plan applies the new plan's terms the same way. Purchased credits never expire and are not affected.",
8806
8827
  "tags": [
8807
8828
  "Webhooks"
8808
8829
  ],
@@ -8818,7 +8839,7 @@
8818
8839
  },
8819
8840
  "event": {
8820
8841
  "type": "string",
8821
- "const": "credits.depleted"
8842
+ "const": "credits.expired"
8822
8843
  },
8823
8844
  "timestamp": {
8824
8845
  "type": "string"
@@ -8847,15 +8868,15 @@
8847
8868
  "type": "string",
8848
8869
  "description": "The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId."
8849
8870
  },
8850
- "remainingCredits": {
8871
+ "expiredCredits": {
8851
8872
  "type": "number",
8852
- "description": "Credits remaining after depletion. Always 0."
8873
+ "description": "The plan credits that were discarded."
8853
8874
  }
8854
8875
  },
8855
8876
  "required": [
8856
8877
  "subscriptionId",
8857
8878
  "customerId",
8858
- "remainingCredits"
8879
+ "expiredCredits"
8859
8880
  ],
8860
8881
  "additionalProperties": false
8861
8882
  }
@@ -8872,7 +8893,7 @@
8872
8893
  "additionalProperties": false
8873
8894
  },
8874
8895
  "example": {
8875
- "event": "credits.depleted",
8896
+ "event": "credits.expired",
8876
8897
  "timestamp": "2026-06-23T14:30:00.000Z",
8877
8898
  "organizationId": "8f14e45f-ceea-4e7a-9c3d-1c2b3a4d5e6f",
8878
8899
  "mode": "live",
@@ -8880,7 +8901,7 @@
8880
8901
  "data": {
8881
8902
  "subscriptionId": "sub_1a2b3c4d",
8882
8903
  "customerId": "user_123",
8883
- "remainingCredits": 0
8904
+ "expiredCredits": 120
8884
8905
  }
8885
8906
  }
8886
8907
  }
@@ -8892,20 +8913,20 @@
8892
8913
  }
8893
8914
  },
8894
8915
  "x-mint": {
8895
- "href": "/webhooks/credits-depleted",
8916
+ "href": "/webhooks/credits-expired",
8896
8917
  "metadata": {
8897
- "title": "credits.depleted",
8898
- "description": "A subscription ran out of credits.",
8918
+ "title": "credits.expired",
8919
+ "description": "Unused plan credits expired at the period reset.",
8899
8920
  "playground": "none"
8900
8921
  },
8901
- "content": "## When this fires\n\nThe async usage processor fires this once when a deduction moves the credit balance from positive to zero. From this point, usage requests that need more credits than remain are rejected with `insufficient_credits`.\n\n`customer.state_changed` fires alongside it with trigger `credits_depleted`, carrying the customer's full current entitlement state.\n\nUse it to block gated features in your app and drive the customer to a credit pack purchase."
8922
+ "content": "## When this fires\n\nPlan credits expire at the end of each billing period: the period reset discards whatever remained and grants the new period's credits (which fires `credits.granted`). This event reports the discarded amount. Purchased credits never expire and are not affected.\n\nIt only fires when there was something to discard — a customer who used all plan credits gets no `credits.expired`.\n\nUse it for end-of-period usage summaries (\"you left 120 credits on the table\")."
8902
8923
  }
8903
8924
  }
8904
8925
  },
8905
- "credits.expired": {
8926
+ "balance.granted": {
8906
8927
  "post": {
8907
- "summary": "credits.expired",
8908
- "description": "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.",
8928
+ "summary": "balance.granted",
8929
+ "description": "Fired when non-purchase balance is granted to a subscription: the plan balance at the start of each billing period, or a manual adjustment from the dashboard or the API, which goes to the purchased balance. Balance top-ups fire balance.topped_up instead.",
8909
8930
  "tags": [
8910
8931
  "Webhooks"
8911
8932
  ],
@@ -8921,7 +8942,7 @@
8921
8942
  },
8922
8943
  "event": {
8923
8944
  "type": "string",
8924
- "const": "credits.expired"
8945
+ "const": "balance.granted"
8925
8946
  },
8926
8947
  "timestamp": {
8927
8948
  "type": "string"
@@ -8950,15 +8971,25 @@
8950
8971
  "type": "string",
8951
8972
  "description": "The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId."
8952
8973
  },
8953
- "expiredCredits": {
8974
+ "amount": {
8954
8975
  "type": "number",
8955
- "description": "The unused plan credits that were discarded."
8976
+ "description": "The balance granted in rate scale (10000 = 1.00 of the subscription currency)."
8977
+ },
8978
+ "currency": {
8979
+ "type": "string",
8980
+ "description": "The subscription currency."
8981
+ },
8982
+ "reason": {
8983
+ "type": "string",
8984
+ "description": "Why the balance was granted: period_reset or manual_adjustment."
8956
8985
  }
8957
8986
  },
8958
8987
  "required": [
8959
8988
  "subscriptionId",
8960
8989
  "customerId",
8961
- "expiredCredits"
8990
+ "amount",
8991
+ "currency",
8992
+ "reason"
8962
8993
  ],
8963
8994
  "additionalProperties": false
8964
8995
  }
@@ -8975,7 +9006,7 @@
8975
9006
  "additionalProperties": false
8976
9007
  },
8977
9008
  "example": {
8978
- "event": "credits.expired",
9009
+ "event": "balance.granted",
8979
9010
  "timestamp": "2026-06-23T14:30:00.000Z",
8980
9011
  "organizationId": "8f14e45f-ceea-4e7a-9c3d-1c2b3a4d5e6f",
8981
9012
  "mode": "live",
@@ -8983,7 +9014,9 @@
8983
9014
  "data": {
8984
9015
  "subscriptionId": "sub_1a2b3c4d",
8985
9016
  "customerId": "user_123",
8986
- "expiredCredits": 120
9017
+ "amount": 100000,
9018
+ "currency": "usd",
9019
+ "reason": "period_reset"
8987
9020
  }
8988
9021
  }
8989
9022
  }
@@ -8995,20 +9028,17 @@
8995
9028
  }
8996
9029
  },
8997
9030
  "x-mint": {
8998
- "href": "/webhooks/credits-expired",
9031
+ "href": "/webhooks/balance-granted",
8999
9032
  "metadata": {
9000
- "title": "credits.expired",
9001
- "description": "Unused plan credits expired at the period reset.",
9002
9033
  "playground": "none"
9003
- },
9004
- "content": "## When this fires\n\nPlan credits expire at the end of each billing period: the period reset discards whatever remained and grants the new period's credits (which fires `credits.granted`). This event reports the discarded amount. Purchased credits never expire and are not affected.\n\nIt only fires when there was something to discard — a customer who used all plan credits gets no `credits.expired`.\n\nUse it for end-of-period usage summaries (\"you left 120 credits on the table\")."
9034
+ }
9005
9035
  }
9006
9036
  }
9007
9037
  },
9008
9038
  "balance.topped_up": {
9009
9039
  "post": {
9010
9040
  "summary": "balance.topped_up",
9011
- "description": "Fired when a customer on a balance plan tops up their prepaid balance through the customer portal and the payment succeeds.",
9041
+ "description": "Fired when a balance top-up succeeds: through the API, an automatic top-up or the customer portal. The amount goes to the purchased balance, which is spent after the plan balance and kept until the subscription ends.",
9012
9042
  "tags": [
9013
9043
  "Webhooks"
9014
9044
  ],
@@ -9350,6 +9380,112 @@
9350
9380
  }
9351
9381
  }
9352
9382
  },
9383
+ "balance.expired": {
9384
+ "post": {
9385
+ "summary": "balance.expired",
9386
+ "description": "Fired at a reset when unused plan balance is discarded. On a plan whose unused plan balance expires, all of it expires at each reset. On a plan that rolls it over, a reset keeps it, up to the plan's maxPlanBalance when it has one, and only the excess expires. An overage debt invoiced at the renewal counts as nothing left over. Purchased balance never expires and is not affected.",
9387
+ "tags": [
9388
+ "Webhooks"
9389
+ ],
9390
+ "requestBody": {
9391
+ "required": true,
9392
+ "content": {
9393
+ "application/json": {
9394
+ "schema": {
9395
+ "type": "object",
9396
+ "properties": {
9397
+ "id": {
9398
+ "type": "string"
9399
+ },
9400
+ "event": {
9401
+ "type": "string",
9402
+ "const": "balance.expired"
9403
+ },
9404
+ "timestamp": {
9405
+ "type": "string"
9406
+ },
9407
+ "organizationId": {
9408
+ "type": "string"
9409
+ },
9410
+ "mode": {
9411
+ "type": "string",
9412
+ "enum": [
9413
+ "live",
9414
+ "sandbox"
9415
+ ]
9416
+ },
9417
+ "apiVersion": {
9418
+ "type": "string"
9419
+ },
9420
+ "data": {
9421
+ "type": "object",
9422
+ "properties": {
9423
+ "subscriptionId": {
9424
+ "type": "string",
9425
+ "description": "The subscription ID."
9426
+ },
9427
+ "customerId": {
9428
+ "type": "string",
9429
+ "description": "The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId."
9430
+ },
9431
+ "expiredAmount": {
9432
+ "type": "number",
9433
+ "description": "The plan balance that was discarded, in rate scale (10000 = 1.00 of the subscription currency)."
9434
+ },
9435
+ "currency": {
9436
+ "type": "string",
9437
+ "description": "The subscription currency."
9438
+ }
9439
+ },
9440
+ "required": [
9441
+ "subscriptionId",
9442
+ "customerId",
9443
+ "expiredAmount",
9444
+ "currency"
9445
+ ],
9446
+ "additionalProperties": false
9447
+ }
9448
+ },
9449
+ "required": [
9450
+ "id",
9451
+ "event",
9452
+ "timestamp",
9453
+ "organizationId",
9454
+ "mode",
9455
+ "apiVersion",
9456
+ "data"
9457
+ ],
9458
+ "additionalProperties": false
9459
+ },
9460
+ "example": {
9461
+ "event": "balance.expired",
9462
+ "timestamp": "2026-06-23T14:30:00.000Z",
9463
+ "organizationId": "8f14e45f-ceea-4e7a-9c3d-1c2b3a4d5e6f",
9464
+ "mode": "live",
9465
+ "apiVersion": "2026-08-27",
9466
+ "data": {
9467
+ "subscriptionId": "sub_1a2b3c4d",
9468
+ "customerId": "user_123",
9469
+ "expiredAmount": 40000,
9470
+ "currency": "usd"
9471
+ }
9472
+ }
9473
+ }
9474
+ }
9475
+ },
9476
+ "responses": {
9477
+ "200": {
9478
+ "description": "Return any 2xx status code to acknowledge receipt of the event."
9479
+ }
9480
+ },
9481
+ "x-mint": {
9482
+ "href": "/webhooks/balance-expired",
9483
+ "metadata": {
9484
+ "playground": "none"
9485
+ }
9486
+ }
9487
+ }
9488
+ },
9353
9489
  "quota.threshold_reached": {
9354
9490
  "post": {
9355
9491
  "summary": "quota.threshold_reached",
@@ -9643,15 +9779,11 @@
9643
9779
  "description": "The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId."
9644
9780
  },
9645
9781
  "subscriptionId": {
9646
- "anyOf": [
9647
- {
9648
- "type": "string"
9649
- },
9650
- {
9651
- "type": "null"
9652
- }
9653
- ],
9654
- "description": "The live subscription ID, or null when the customer has no live subscription."
9782
+ "description": "The live subscription ID, or null when the customer has no live subscription.",
9783
+ "type": [
9784
+ "string",
9785
+ "null"
9786
+ ]
9655
9787
  },
9656
9788
  "featureCode": {
9657
9789
  "type": "string",
@@ -10508,15 +10640,11 @@
10508
10640
  "description": "Destination bank display metadata: bankName and last4."
10509
10641
  },
10510
10642
  "paidAt": {
10511
- "anyOf": [
10512
- {
10513
- "type": "string"
10514
- },
10515
- {
10516
- "type": "null"
10517
- }
10518
- ],
10519
- "description": "ISO 8601 datetime when the provider confirmed the deposit arrived."
10643
+ "description": "ISO 8601 datetime when the provider confirmed the deposit arrived.",
10644
+ "type": [
10645
+ "string",
10646
+ "null"
10647
+ ]
10520
10648
  }
10521
10649
  },
10522
10650
  "required": [
@@ -10658,37 +10786,25 @@
10658
10786
  "description": "Destination bank display metadata: bankName and last4."
10659
10787
  },
10660
10788
  "failedAt": {
10661
- "anyOf": [
10662
- {
10663
- "type": "string"
10664
- },
10665
- {
10666
- "type": "null"
10667
- }
10668
- ],
10669
- "description": "ISO 8601 datetime when the failure was recorded."
10789
+ "description": "ISO 8601 datetime when the failure was recorded.",
10790
+ "type": [
10791
+ "string",
10792
+ "null"
10793
+ ]
10670
10794
  },
10671
10795
  "failureCode": {
10672
- "anyOf": [
10673
- {
10674
- "type": "string"
10675
- },
10676
- {
10677
- "type": "null"
10678
- }
10679
- ],
10680
- "description": "The provider's failure code, when available."
10796
+ "description": "The provider's failure code, when available.",
10797
+ "type": [
10798
+ "string",
10799
+ "null"
10800
+ ]
10681
10801
  },
10682
10802
  "failureMessage": {
10683
- "anyOf": [
10684
- {
10685
- "type": "string"
10686
- },
10687
- {
10688
- "type": "null"
10689
- }
10690
- ],
10691
- "description": "A human-readable failure message, when available."
10803
+ "description": "A human-readable failure message, when available.",
10804
+ "type": [
10805
+ "string",
10806
+ "null"
10807
+ ]
10692
10808
  }
10693
10809
  },
10694
10810
  "required": [
@@ -10828,43 +10944,27 @@
10828
10944
  "type": "string"
10829
10945
  },
10830
10946
  "current": {
10831
- "anyOf": [
10832
- {
10833
- "type": "number"
10834
- },
10835
- {
10836
- "type": "null"
10837
- }
10947
+ "type": [
10948
+ "number",
10949
+ "null"
10838
10950
  ]
10839
10951
  },
10840
10952
  "included": {
10841
- "anyOf": [
10842
- {
10843
- "type": "number"
10844
- },
10845
- {
10846
- "type": "null"
10847
- }
10953
+ "type": [
10954
+ "number",
10955
+ "null"
10848
10956
  ]
10849
10957
  },
10850
10958
  "remaining": {
10851
- "anyOf": [
10852
- {
10853
- "type": "number"
10854
- },
10855
- {
10856
- "type": "null"
10857
- }
10959
+ "type": [
10960
+ "number",
10961
+ "null"
10858
10962
  ]
10859
10963
  },
10860
10964
  "unlimited": {
10861
- "anyOf": [
10862
- {
10863
- "type": "boolean"
10864
- },
10865
- {
10866
- "type": "null"
10867
- }
10965
+ "type": [
10966
+ "boolean",
10967
+ "null"
10868
10968
  ]
10869
10969
  }
10870
10970
  },
@@ -10901,11 +11001,27 @@
10901
11001
  "type": "object",
10902
11002
  "properties": {
10903
11003
  "currentBalance": {
10904
- "type": "number"
11004
+ "type": "number",
11005
+ "description": "The available balance, plan plus purchased, in rate scale. Equal to totalBalance."
11006
+ },
11007
+ "planBalance": {
11008
+ "type": "number",
11009
+ "description": "The plan part in rate scale: spent first, replaced or rolled over at each reset, negative while overage is owed."
11010
+ },
11011
+ "purchasedBalance": {
11012
+ "type": "number",
11013
+ "description": "The purchased part in rate scale: top-ups and manual adjustments, spent after the plan part and kept until the subscription ends."
11014
+ },
11015
+ "totalBalance": {
11016
+ "type": "number",
11017
+ "description": "planBalance plus purchasedBalance, in rate scale."
10905
11018
  }
10906
11019
  },
10907
11020
  "required": [
10908
- "currentBalance"
11021
+ "currentBalance",
11022
+ "planBalance",
11023
+ "purchasedBalance",
11024
+ "totalBalance"
10909
11025
  ],
10910
11026
  "additionalProperties": false
10911
11027
  },
@@ -11044,13 +11160,9 @@
11044
11160
  "type": "object",
11045
11161
  "properties": {
11046
11162
  "bankName": {
11047
- "anyOf": [
11048
- {
11049
- "type": "string"
11050
- },
11051
- {
11052
- "type": "null"
11053
- }
11163
+ "type": [
11164
+ "string",
11165
+ "null"
11054
11166
  ]
11055
11167
  },
11056
11168
  "last4": {