@commet/node 9.3.0 → 9.5.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 (295) hide show
  1. package/dist/index.d.mts +366 -17
  2. package/dist/index.d.ts +366 -17
  3. package/dist/index.js +31 -7
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +31 -7
  6. package/dist/index.mjs.map +1 -1
  7. package/docs/ai-onboarding/ai-onboarding.md +2 -3
  8. package/docs/ai-onboarding/billing-best-practices-skill.md +2 -3
  9. package/docs/ai-onboarding/commet-skill.md +4 -5
  10. package/docs/ai-onboarding/mcp-server.md +8 -9
  11. package/docs/ai-onboarding/pricing-models-skill.md +2 -3
  12. package/docs/ai-onboarding/subscription-patterns-skill.md +2 -3
  13. package/docs/api-reference/addons.md +1 -1
  14. package/docs/api-reference/api-keys.md +3 -2
  15. package/docs/api-reference/credit-packs.md +1 -1
  16. package/docs/api-reference/customers.md +1 -1
  17. package/docs/api-reference/feature-access.md +1 -1
  18. package/docs/api-reference/features.md +1 -1
  19. package/docs/api-reference/generated-webhooks.md +3 -3
  20. package/docs/api-reference/index.md +2 -2
  21. package/docs/api-reference/invoices.md +1 -1
  22. package/docs/api-reference/markets.md +1 -1
  23. package/docs/api-reference/offers.md +1 -1
  24. package/docs/api-reference/payments.md +1 -1
  25. package/docs/api-reference/payouts.md +1 -1
  26. package/docs/api-reference/plan-groups.md +1 -1
  27. package/docs/api-reference/plans.md +1 -1
  28. package/docs/api-reference/portal.md +1 -1
  29. package/docs/api-reference/promo-codes.md +2 -2
  30. package/docs/api-reference/provisioning.md +1 -1
  31. package/docs/api-reference/quota.md +1 -1
  32. package/docs/api-reference/seats.md +1 -1
  33. package/docs/api-reference/subscriptions.md +81 -2
  34. package/docs/api-reference/test-clock.md +1 -1
  35. package/docs/api-reference/transactions.md +1 -1
  36. package/docs/api-reference/usage.md +1 -1
  37. package/docs/documentation/api-versioning.md +1 -2
  38. package/docs/documentation/better-auth.md +0 -1
  39. package/docs/documentation/choose-a-billing-model.md +54 -26
  40. package/docs/documentation/cli.md +1 -2
  41. package/docs/documentation/create-api-key.md +100 -25
  42. package/docs/documentation/customers/customer-credits.md +0 -1
  43. package/docs/documentation/customers/customer-portal.md +14 -2
  44. package/docs/documentation/customers/manage-customers.md +1 -2
  45. package/docs/documentation/error-handling.md +1 -2
  46. package/docs/documentation/examples.md +0 -1
  47. package/docs/documentation/finance/acceptable-use.md +0 -1
  48. package/docs/documentation/finance/finance-overview.md +0 -1
  49. package/docs/documentation/finance/local-currency-taxes.md +0 -1
  50. package/docs/documentation/finance/merchant-of-record.md +0 -1
  51. package/docs/documentation/finance/payouts-verification.md +6 -3
  52. package/docs/documentation/finance/payouts.md +0 -1
  53. package/docs/documentation/finance/supported-countries.md +0 -1
  54. package/docs/documentation/go/integrate-with-encore.md +7 -8
  55. package/docs/documentation/go/integrate-with-go.md +8 -9
  56. package/docs/documentation/introduction.md +62 -41
  57. package/docs/documentation/invoicing/handle-failed-payments.md +9 -4
  58. package/docs/documentation/invoicing/invoices-and-billing-cycles.md +0 -1
  59. package/docs/documentation/invoicing/manage-invoices.md +0 -1
  60. package/docs/documentation/java/integrate-with-java.md +6 -7
  61. package/docs/documentation/nodejs/integrate-with-astro.md +6 -7
  62. package/docs/documentation/nodejs/integrate-with-bun.md +6 -7
  63. package/docs/documentation/nodejs/integrate-with-express.md +7 -8
  64. package/docs/documentation/nodejs/integrate-with-hono.md +7 -8
  65. package/docs/documentation/nodejs/integrate-with-nextjs.md +6 -7
  66. package/docs/documentation/nodejs/integrate-with-nuxt.md +6 -7
  67. package/docs/documentation/nodejs/integrate-with-remix.md +6 -7
  68. package/docs/documentation/nodejs/integrate-with-sveltekit.md +6 -7
  69. package/docs/documentation/payments/accept-one-time-payments.md +0 -1
  70. package/docs/documentation/payments/payment-orchestration.md +0 -1
  71. package/docs/documentation/payments/payment-providers.md +0 -1
  72. package/docs/documentation/payments/transactions-refunds-and-retries.md +8 -1
  73. package/docs/documentation/php/integrate-with-laravel.md +8 -9
  74. package/docs/documentation/php/integrate-with-php.md +6 -7
  75. package/docs/documentation/php/integrate-with-symfony.md +7 -8
  76. package/docs/documentation/plans/add-ons.md +0 -1
  77. package/docs/documentation/plans/balance-and-top-ups.md +0 -1
  78. package/docs/documentation/plans/configure-features.md +0 -1
  79. package/docs/documentation/plans/consumption-models.md +0 -1
  80. package/docs/documentation/plans/create-plans.md +0 -1
  81. package/docs/documentation/plans/credit-packs.md +0 -1
  82. package/docs/documentation/plans/one-time-payments.md +0 -1
  83. package/docs/documentation/plans/plan-groups.md +0 -1
  84. package/docs/documentation/platform/custom-domains.md +0 -1
  85. package/docs/documentation/platform/dashboard-metrics-and-events.md +0 -1
  86. package/docs/documentation/platform/members-and-permissions.md +0 -1
  87. package/docs/documentation/platform/organization-settings.md +0 -1
  88. package/docs/documentation/python/integrate-with-django.md +8 -9
  89. package/docs/documentation/python/integrate-with-fastapi.md +8 -9
  90. package/docs/documentation/python/integrate-with-flask.md +8 -9
  91. package/docs/documentation/python/integrate-with-python.md +6 -7
  92. package/docs/documentation/sales/card-promotions.md +0 -1
  93. package/docs/documentation/sales/introductory-offers.md +0 -1
  94. package/docs/documentation/sales/offers.md +0 -1
  95. package/docs/documentation/sales/promo-codes.md +19 -5
  96. package/docs/documentation/sales/promotional-offers.md +1 -2
  97. package/docs/documentation/sales/regional-prices.md +0 -1
  98. package/docs/documentation/sales/trial-periods.md +8 -8
  99. package/docs/documentation/sdk-reference.md +9 -10
  100. package/docs/documentation/subscriptions/manage-subscriptions.md +114 -12
  101. package/docs/documentation/subscriptions/plan-grants.md +0 -1
  102. package/docs/documentation/subscriptions/upgrade-and-downgrade-plans.md +0 -1
  103. package/docs/documentation/testing-sandbox.md +0 -1
  104. package/docs/documentation/usage/ai-token-billing.md +0 -1
  105. package/docs/documentation/usage/quota-management.md +0 -1
  106. package/docs/documentation/usage/seat-management.md +0 -1
  107. package/docs/documentation/usage/track-usage.md +0 -1
  108. package/docs/errors/addon_already_active.md +1 -1
  109. package/docs/errors/addon_has_activations.md +1 -1
  110. package/docs/errors/addon_not_active.md +1 -1
  111. package/docs/errors/addon_not_found.md +1 -1
  112. package/docs/errors/already_has_active_subscription.md +1 -1
  113. package/docs/errors/already_scheduled.md +1 -1
  114. package/docs/errors/api_key_not_found.md +1 -1
  115. package/docs/errors/card_promotions_not_available.md +1 -1
  116. package/docs/errors/charge_failed.md +1 -1
  117. package/docs/errors/charge_in_progress.md +1 -1
  118. package/docs/errors/claim_not_pending.md +1 -1
  119. package/docs/errors/credit_pack_not_found.md +1 -1
  120. package/docs/errors/customer_not_found.md +1 -1
  121. package/docs/errors/duplicate.md +1 -1
  122. package/docs/errors/endpoint_deprecated.md +1 -1
  123. package/docs/errors/endpoint_not_available.md +1 -1
  124. package/docs/errors/feature_already_exists.md +1 -1
  125. package/docs/errors/feature_disabled.md +1 -1
  126. package/docs/errors/feature_in_use.md +1 -1
  127. package/docs/errors/feature_not_found.md +1 -1
  128. package/docs/errors/feature_not_in_plan.md +1 -1
  129. package/docs/errors/forbidden.md +1 -1
  130. package/docs/errors/free_plan_change_not_supported.md +1 -1
  131. package/docs/errors/idempotency_in_progress.md +1 -1
  132. package/docs/errors/idempotency_key_mismatch.md +1 -1
  133. package/docs/errors/idempotency_unavailable.md +1 -1
  134. package/docs/errors/included_limit_reached.md +1 -1
  135. package/docs/errors/index.md +1 -1
  136. package/docs/errors/insufficient_balance.md +1 -1
  137. package/docs/errors/insufficient_credits.md +1 -1
  138. package/docs/errors/insufficient_seats.md +1 -1
  139. package/docs/errors/internal_error.md +1 -1
  140. package/docs/errors/invalid_json.md +1 -1
  141. package/docs/errors/invalid_subscription_status.md +1 -1
  142. package/docs/errors/invoice_not_found.md +1 -1
  143. package/docs/errors/market_group_in_use.md +1 -1
  144. package/docs/errors/market_group_not_found.md +1 -1
  145. package/docs/errors/market_in_use.md +1 -1
  146. package/docs/errors/market_not_found.md +1 -1
  147. package/docs/errors/missing_regional_price.md +1 -1
  148. package/docs/errors/model_not_found.md +1 -1
  149. package/docs/errors/no_active_subscription.md +1 -1
  150. package/docs/errors/no_change_requested.md +1 -1
  151. package/docs/errors/no_outstanding_invoice.md +1 -1
  152. package/docs/errors/no_payment_method.md +1 -1
  153. package/docs/errors/no_prices_configured.md +1 -1
  154. package/docs/errors/not_found.md +1 -1
  155. package/docs/errors/not_scheduled_for_cancellation.md +1 -1
  156. package/docs/errors/offer_not_applicable.md +1 -1
  157. package/docs/errors/offer_not_found.md +1 -1
  158. package/docs/errors/one_time_subscription_not_cancelable.md +1 -1
  159. package/docs/errors/organization_already_claimed.md +1 -1
  160. package/docs/errors/payment_failed.md +1 -1
  161. package/docs/errors/payment_method_not_found.md +1 -1
  162. package/docs/errors/payment_not_cancelable.md +1 -1
  163. package/docs/errors/payment_not_found.md +1 -1
  164. package/docs/errors/payouts_not_available_in_sandbox.md +1 -1
  165. package/docs/errors/plan_change_scheduled.md +1 -1
  166. package/docs/errors/plan_group_not_found.md +1 -1
  167. package/docs/errors/plan_not_found.md +1 -1
  168. package/docs/errors/plan_unavailable.md +1 -1
  169. package/docs/errors/plans_not_in_same_group.md +1 -1
  170. package/docs/errors/price_in_use.md +1 -1
  171. package/docs/errors/price_not_found.md +1 -1
  172. package/docs/errors/pricing_mode_mismatch.md +1 -1
  173. package/docs/errors/promo_code_expired.md +1 -1
  174. package/docs/errors/promo_code_not_found.md +1 -1
  175. package/docs/errors/provider_unsupported.md +1 -1
  176. package/docs/errors/rate_limited.md +1 -1
  177. package/docs/errors/sandbox_only.md +1 -1
  178. package/docs/errors/seat_limit_exceeded.md +1 -1
  179. package/docs/errors/subscription_activation_failed.md +1 -1
  180. package/docs/errors/subscription_already_canceled.md +1 -1
  181. package/docs/errors/subscription_cancel_failed.md +1 -1
  182. package/docs/errors/subscription_creation_failed.md +1 -1
  183. package/docs/errors/subscription_has_open_dispute.md +1 -1
  184. package/docs/errors/subscription_not_active.md +1 -1
  185. package/docs/errors/subscription_not_found.md +1 -1
  186. package/docs/errors/subscription_required.md +1 -1
  187. package/docs/errors/subscription_uncancel_failed.md +1 -1
  188. package/docs/errors/transaction_not_found.md +1 -1
  189. package/docs/errors/unauthorized.md +1 -1
  190. package/docs/errors/validation_error.md +1 -1
  191. package/docs/errors/webhook_not_found.md +1 -1
  192. package/docs/knowledge-base/how-do-balance-and-top-ups-work.md +0 -1
  193. package/docs/knowledge-base/how-do-credits-credit-packs-and-customer-credits-differ.md +0 -1
  194. package/docs/knowledge-base/how-do-discounts-work.md +0 -1
  195. package/docs/knowledge-base/how-do-free-plans-work-without-payment.md +0 -1
  196. package/docs/knowledge-base/how-do-monthly-quarterly-and-yearly-billing-work.md +0 -1
  197. package/docs/knowledge-base/how-do-offers-promo-codes-and-card-promotions-work-together.md +0 -1
  198. package/docs/knowledge-base/how-do-trial-periods-work.md +0 -1
  199. package/docs/knowledge-base/how-does-billing-work.md +0 -1
  200. package/docs/knowledge-base/how-does-payment-routing-work.md +0 -1
  201. package/docs/knowledge-base/how-does-quota-based-billing-work.md +0 -1
  202. package/docs/knowledge-base/how-does-seat-based-billing-work.md +0 -1
  203. package/docs/knowledge-base/how-is-proration-calculated-when-changing-plans.md +0 -1
  204. package/docs/knowledge-base/what-happens-when-a-customer-changes-plans.md +0 -1
  205. package/docs/knowledge-base/what-happens-when-a-payment-fails.md +0 -1
  206. package/docs/knowledge-base/what-happens-when-you-change-your-prices.md +0 -1
  207. package/docs/knowledge-base/what-happens-when-you-refund-or-retry-a-transaction.md +1 -2
  208. package/docs/knowledge-base/what-invoices-do-customers-receive-and-when.md +0 -1
  209. package/docs/manifest.json +186 -235
  210. package/docs/platform-documentation.md +69 -149
  211. package/docs/schemas.md +35 -1
  212. package/docs/webhooks/introduction.md +0 -1
  213. package/docs/webhooks.md +98 -7
  214. package/docs/webhooks.openapi.json +11058 -0
  215. package/package.json +1 -1
  216. package/docs/ai-onboarding/meta.json +0 -17
  217. package/docs/api-reference/meta.json +0 -7
  218. package/docs/documentation/customers/meta.json +0 -5
  219. package/docs/documentation/finance/meta.json +0 -13
  220. package/docs/documentation/go/meta.json +0 -5
  221. package/docs/documentation/invoicing/meta.json +0 -9
  222. package/docs/documentation/java/meta.json +0 -5
  223. package/docs/documentation/meta.json +0 -36
  224. package/docs/documentation/nodejs/meta.json +0 -14
  225. package/docs/documentation/payments/meta.json +0 -10
  226. package/docs/documentation/php/meta.json +0 -9
  227. package/docs/documentation/plans/meta.json +0 -14
  228. package/docs/documentation/platform/meta.json +0 -10
  229. package/docs/documentation/python/meta.json +0 -10
  230. package/docs/documentation/sales/meta.json +0 -13
  231. package/docs/documentation/subscriptions/meta.json +0 -9
  232. package/docs/documentation/usage/meta.json +0 -10
  233. package/docs/knowledge-base/meta.json +0 -29
  234. package/docs/meta.json +0 -11
  235. package/docs/webhooks/addon-activated.md +0 -44
  236. package/docs/webhooks/addon-deactivated.md +0 -40
  237. package/docs/webhooks/balance-depleted.md +0 -37
  238. package/docs/webhooks/balance-low.md +0 -39
  239. package/docs/webhooks/balance-topped-up.md +0 -41
  240. package/docs/webhooks/checkout-ready.md +0 -43
  241. package/docs/webhooks/credits-depleted.md +0 -35
  242. package/docs/webhooks/credits-expired.md +0 -35
  243. package/docs/webhooks/credits-granted.md +0 -37
  244. package/docs/webhooks/credits-low.md +0 -39
  245. package/docs/webhooks/credits-purchased.md +0 -41
  246. package/docs/webhooks/customer-created.md +0 -49
  247. package/docs/webhooks/customer-state-changed.md +0 -134
  248. package/docs/webhooks/customer-updated.md +0 -49
  249. package/docs/webhooks/invoice-created.md +0 -45
  250. package/docs/webhooks/invoice-overdue.md +0 -53
  251. package/docs/webhooks/invoice-upcoming.md +0 -43
  252. package/docs/webhooks/invoice-voided.md +0 -53
  253. package/docs/webhooks/meta.json +0 -83
  254. package/docs/webhooks/payment-dispute-resolved.md +0 -52
  255. package/docs/webhooks/payment-disputed.md +0 -49
  256. package/docs/webhooks/payment-failed.md +0 -37
  257. package/docs/webhooks/payment-link-canceled.md +0 -41
  258. package/docs/webhooks/payment-link-completed.md +0 -47
  259. package/docs/webhooks/payment-link-created.md +0 -41
  260. package/docs/webhooks/payment-link-failed.md +0 -45
  261. package/docs/webhooks/payment-method-attached.md +0 -40
  262. package/docs/webhooks/payment-method-updated.md +0 -38
  263. package/docs/webhooks/payment-received.md +0 -45
  264. package/docs/webhooks/payment-recovered.md +0 -39
  265. package/docs/webhooks/payment-refunded.md +0 -47
  266. package/docs/webhooks/payment-retry-failed.md +0 -39
  267. package/docs/webhooks/payout-available.md +0 -33
  268. package/docs/webhooks/payout-created.md +0 -48
  269. package/docs/webhooks/payout-failed.md +0 -52
  270. package/docs/webhooks/payout-paid.md +0 -48
  271. package/docs/webhooks/plan-grant-created.md +0 -74
  272. package/docs/webhooks/plan-grant-expired.md +0 -86
  273. package/docs/webhooks/plan-grant-revoked.md +0 -86
  274. package/docs/webhooks/plan-grant-updated.md +0 -86
  275. package/docs/webhooks/quota-exceeded.md +0 -44
  276. package/docs/webhooks/quota-threshold-reached.md +0 -41
  277. package/docs/webhooks/seats-limit-reached.md +0 -39
  278. package/docs/webhooks/seats-updated.md +0 -39
  279. package/docs/webhooks/subscription-activated.md +0 -43
  280. package/docs/webhooks/subscription-canceled.md +0 -57
  281. package/docs/webhooks/subscription-cancellation-revoked.md +0 -37
  282. package/docs/webhooks/subscription-cancellation-scheduled.md +0 -45
  283. package/docs/webhooks/subscription-created.md +0 -35
  284. package/docs/webhooks/subscription-past-due.md +0 -43
  285. package/docs/webhooks/subscription-plan-change-revoked.md +0 -50
  286. package/docs/webhooks/subscription-plan-change-scheduled.md +0 -55
  287. package/docs/webhooks/subscription-plan-changed.md +0 -43
  288. package/docs/webhooks/subscription-reactivated.md +0 -53
  289. package/docs/webhooks/subscription-updated.md +0 -39
  290. package/docs/webhooks/trial-checkout-ready.md +0 -39
  291. package/docs/webhooks/trial-converted.md +0 -39
  292. package/docs/webhooks/trial-expired.md +0 -39
  293. package/docs/webhooks/trial-started.md +0 -46
  294. package/docs/webhooks/trial-will-end.md +0 -41
  295. package/docs/webhooks/usage-recorded.md +0 -41
@@ -1,5 +1,4 @@
1
1
  ---
2
- lastModified: 2026-07-31
3
2
  title: Introductory Offers
4
3
  description: Apply an existing Offer automatically to eligible new subscriptions.
5
4
  ---
@@ -1,5 +1,4 @@
1
1
  ---
2
- lastModified: 2026-07-31
3
2
  title: Offers
4
3
  description: Define reusable trials and temporary pricing terms independently from plans and distribution.
5
4
  ---
@@ -1,5 +1,4 @@
1
1
  ---
2
- lastModified: 2026-07-31
3
2
  title: Promo Codes
4
3
  description: Distribute an existing Offer through a customer-entered checkout code.
5
4
  ---
@@ -8,18 +7,29 @@ A Promo Code is a distribution channel. The referenced Offer owns the economic t
8
7
 
9
8
  ## Create a compatible Offer
10
9
 
11
- A Promo Code can reference an Offer with exactly one `percentage` or `amount_off` phase.
10
+ A Promo Code can reference an Offer with ordered `percentage`, `amount_off`, or `fixed_price` phases. It can start with one `free_trial` phase when a discount follows it. Each discount phase before the last must have a finite duration.
12
11
 
13
12
  ```typescript
14
13
  const launchOffer = await commet.offers.create({
15
- name: 'Launch 50',
14
+ name: 'Launch discount',
16
15
  phases: [
17
16
  { type: 'percentage', durationCycles: 2, percentage: 5000 },
17
+ { type: 'percentage', durationCycles: 3, percentage: 2000 },
18
18
  ],
19
19
  })
20
20
  ```
21
21
 
22
- Trial, multi-phase, and `fixed_price` Offers can still be applied directly with `offerId`, but cannot be distributed through a Promo Code.
22
+ For a trial followed by a discount, put the trial first:
23
+
24
+ ```typescript
25
+ const trialOffer = await commet.offers.create({
26
+ name: 'Early access',
27
+ phases: [
28
+ { type: 'free_trial', durationDays: 14 },
29
+ { type: 'percentage', durationCycles: 3, percentage: 2000 },
30
+ ],
31
+ })
32
+ ```
23
33
 
24
34
  ## Create the code
25
35
 
@@ -41,12 +51,16 @@ The Promo Code owns:
41
51
  - the redemption limit;
42
52
  - expiration and active state.
43
53
 
44
- Updating the Offer changes future redemptions. Existing Offer Applications keep their accepted terms.
54
+ Updating the Offer changes future redemptions of codes that reference it. Each completed checkout counts one redemption and keeps an immutable Offer Application with the phases accepted at that checkout. Editing the Offer does not change earlier redemptions or their renewals.
55
+
56
+ Clients pinned before `2026-07-24` receive only the first phase in the legacy Promo Code discount fields when that phase is `percentage` or `amount_off`. Codes starting with `free_trial` or `fixed_price` cannot be represented and are absent from those older Promo Code endpoints. Use the current Offer API to inspect the complete sequence.
45
57
 
46
58
  ## Checkout behavior
47
59
 
48
60
  The customer enters the code during checkout. Commet validates the code, resolves the referenced Offer in the checkout currency, and records an Offer Application with source `promo_code`.
49
61
 
62
+ When the Offer starts with a trial, a new subscription checkout collects a payment method without charging. Applying that code to a pending first-payment checkout replaces it with a trial setup checkout. Trial codes cannot start a trial on an existing subscription's plan change. One redemption is recorded when setup completes; the first paid invoice follows the trial and uses the next phase. Renewals do not count as new redemptions.
63
+
50
64
  If an eligible automatic Introductory Offer applies, the code is rejected with `intro_offer_active`. A Promo Code also cannot be combined with an explicit `offerId`.
51
65
 
52
66
  ```typescript
@@ -1,5 +1,4 @@
1
1
  ---
2
- lastModified: 2026-08-21
3
2
  title: Promotional Offers
4
3
  description: Apply any compatible Offer directly for campaigns, retention, and experiments.
5
4
  ---
@@ -65,7 +64,7 @@ The same operation on a subscription with a pending payment checkout quotes or r
65
64
 
66
65
  Use direct `offerId` when your application decides who receives the terms. Use a Promo Code when the customer should enter a code and the campaign needs redemption restrictions.
67
66
 
68
- A Promo Code can reference only an Offer with one `percentage` or `amount_off` phase. Multi-phase, trial, and `fixed_price` Offers remain available for direct application.
67
+ A Promo Code can distribute multiple discount phases, including `fixed_price`, and can begin with a trial when a discount follows it. A trial-only Offer remains available for direct application.
69
68
 
70
69
  ## Related
71
70
 
@@ -1,5 +1,4 @@
1
1
  ---
2
- lastModified: 2026-07-31
3
2
  title: Markets and Regional Pricing
4
3
  description: Combine currency pricing, reusable country Markets, and selectable price variants.
5
4
  ---
@@ -1,5 +1,4 @@
1
1
  ---
2
- lastModified: 2026-07-31
3
2
  title: Trial Periods
4
3
  description: Use free-trial Offer phases for automatic onboarding or explicit campaigns.
5
4
  ---
@@ -8,14 +7,15 @@ A trial is a `free_trial` phase in an Offer. It is not a separate discount syste
8
7
 
9
8
  The phase records how long payment is delayed. The application channel decides who receives it:
10
9
 
11
- | Channel | Trial behavior |
12
- | ---------------------- | ---------------------------------------------------------------------- |
13
- | Introductory placement | Applied automatically to an eligible new subscription |
14
- | Direct `offerId` | Applied explicitly by your application |
15
- | `customTrialDays` | Creates customer-specific trial terms without a reusable catalog Offer |
16
- | `skipTrial: true` | Bypasses the automatic trial |
10
+ | Channel | Trial behavior |
11
+ | ---------------------- | ------------------------------------------------------------------------------------------ |
12
+ | Introductory placement | Applied automatically to an eligible new subscription |
13
+ | Direct `offerId` | Applied explicitly by your application |
14
+ | Promo Code | Customer enters a code for an Offer that starts with a trial and continues with a discount |
15
+ | `customTrialDays` | Creates customer-specific trial terms without a reusable catalog Offer |
16
+ | `skipTrial: true` | Bypasses the automatic trial |
17
17
 
18
- Promo Codes cannot distribute trial phases.
18
+ Promo Code trials require at least one discount phase after the trial. A code can be pre-applied at subscription creation or entered in a pending payment checkout, which then changes to a trial setup checkout.
19
19
 
20
20
  ## Reusable trial
21
21
 
@@ -1,5 +1,4 @@
1
1
  ---
2
- lastModified: 2026-08-16
3
2
  title: SDK Reference
4
3
  description: Configuration, environments, and pagination
5
4
  ---
@@ -20,14 +19,14 @@ The installed package includes version-matched agent documentation at `node_modu
20
19
 
21
20
  ## Options
22
21
 
23
- | Option | Type | Default | Description |
24
- | ------------ | ------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
25
- | `apiKey` | string | required | Your API key (starts with `ck_`). The org that owns the key decides whether calls run against sandbox or live data. |
26
- | `apiVersion` | string | version the SDK release was built against | API version pin, sent as the `Commet-Version` header on every request. See [API versioning](/docs/api-versioning). |
27
- | `debug` | boolean | `false` | Log requests/responses |
28
- | `timeout` | number | `30000` | Request timeout (ms) |
29
- | `retries` | number | `3` | Max retry attempts |
30
- | `telemetry` | boolean | `true` | Send anonymous client info (SDK version, runtime, platform) with requests. Set to `false` to disable. |
22
+ | Option | Type | Default | Description |
23
+ | ------------ | ------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
24
+ | `apiKey` | string | required | Your full-access (`ck_`) or restricted (`rk_`) API key. The org that owns it decides whether calls run against sandbox or live data. |
25
+ | `apiVersion` | string | version the SDK release was built against | API version pin, sent as the `Commet-Version` header on every request. See [API versioning](/docs/api-versioning). |
26
+ | `debug` | boolean | `false` | Log requests/responses |
27
+ | `timeout` | number | `30000` | Request timeout (ms) |
28
+ | `retries` | number | `3` | Max retry attempts |
29
+ | `telemetry` | boolean | `true` | Send anonymous client info (SDK version, runtime, platform) with requests. Set to `false` to disable. |
31
30
 
32
31
  ## Sandbox vs live
33
32
 
@@ -55,7 +54,7 @@ List endpoints use cursor-based pagination.
55
54
  const page = await commet.customers.list({ limit: 25 })
56
55
 
57
56
  if (page.hasMore) {
58
- const nextPage = await commet.customers.list({
57
+ const nextPage = await commet.customers.list({
59
58
  limit: 25,
60
59
  cursor: page.nextCursor,
61
60
  })
@@ -1,7 +1,6 @@
1
1
  ---
2
- lastModified: 2026-08-17
3
2
  title: Manage Subscriptions
4
- description: Create, retrieve, cancel, uncancel, and reactivate subscriptions with SDK v9.
3
+ description: Create, retrieve, pause, resume, cancel, and reactivate subscriptions.
5
4
  ---
6
5
 
7
6
  Install the Commet Skill so your coding agent can implement the current subscription lifecycle and verify the result.
@@ -16,16 +15,15 @@ Subscriptions connect a customer to a plan and drive checkout, invoices, feature
16
15
 
17
16
  The persisted statuses are:
18
17
 
19
- | Status | Meaning |
20
- | ----------------- | ------------------------------------- |
21
- | `draft` | Created but not ready for billing |
22
- | `pending_payment` | Waiting for checkout |
23
- | `trialing` | Trial access is active |
24
- | `active` | Billing normally |
25
- | `past_due` | Renewal failed and dunning is active |
26
- | `canceled` | Billing and subscription access ended |
27
-
28
- Commet does not expose a paused or expired subscription status.
18
+ | Status | Meaning |
19
+ | ----------------- | --------------------------------------- |
20
+ | `draft` | Created but not ready for billing |
21
+ | `pending_payment` | Waiting for checkout |
22
+ | `trialing` | Trial access is active |
23
+ | `active` | Billing normally |
24
+ | `past_due` | Renewal failed and dunning is active |
25
+ | `paused` | Access and renewals paused until resume |
26
+ | `canceled` | Billing and subscription access ended |
29
27
 
30
28
  ## Create
31
29
 
@@ -116,6 +114,8 @@ Omitting `priceId` preserves default price and Market resolution. Omitting `offe
116
114
 
117
115
  A compatible `pending_payment` checkout may be reused. An incompatible pending selection can be replaced without duplicating a paid subscription.
118
116
 
117
+ Omitting a `promoCode` or `offerId` that the pending checkout carries, including an Offer assigned through `PUT /subscriptions/{id}/offer`, replaces it with a new subscription and checkout without that benefit. Redirect to the returned `checkoutUrl`; the previous link stops working. To keep the Offer, send it again or assign it to the returned subscription ID.
118
+
119
119
  ## Retrieve current or historical state
120
120
 
121
121
  **TypeScript**
@@ -237,6 +237,106 @@ $subscription = $commet->subscriptions->get(id: 'sub_xxx');
237
237
 
238
238
  Use `get` with a public subscription ID to retrieve any persisted status, including `pending_payment`, `past_due`, and `canceled`.
239
239
 
240
+ ## Pause and resume
241
+
242
+ A pause temporarily stops subscription access and renewals without canceling the subscription. You can pause a paid recurring subscription in `active` or `trialing` status. Free, one-time, pending-payment, past-due, and canceled subscriptions are not eligible. Resolve any scheduled cancellation, scheduled plan change, or pending plan-change checkout before creating a pause.
243
+
244
+ ### Choose when to pause
245
+
246
+ | Mode | Access and billing | What happens on resume |
247
+ | ------------ | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
248
+ | `immediate` | Access stops immediately. The unused portion of the current paid or trial period is preserved. | Restores the remaining period without a new charge. Renewal moves to the end of that remaining time. |
249
+ | `period_end` | Access continues until the current billing or trial period ends. The next renewal is skipped. | Charges a new period using the saved payment method. Access returns after successful settlement. |
250
+
251
+ For example, an immediate pause with 10 paid days remaining preserves those 10 days. Resuming after a week still leaves 10 days before renewal.
252
+
253
+ While paused, the subscription does not generate renewal invoices. A period-end pause may still produce a final invoice for pending usage, overage, or seat/quota adjustments from the period that ended. It does not charge advance capacity for the next period.
254
+
255
+ ### Set the duration
256
+
257
+ Set `durationDays` to a positive integer for an automatic resume attempt, or `null` for an indefinite pause that requires manual resume. The duration starts when the pause becomes effective, not when a future pause is scheduled.
258
+
259
+ In the Dashboard, open the subscription detail and choose **Pause**. Choose when the pause starts, then select a suggested duration or enter a number of days, weeks, or calendar months. Leave the duration empty for an indefinite pause. The dialog shows the effective date and the automatic resume attempt date before you confirm. Customers can edit an existing pause, cancel a scheduled pause, and resume a paused subscription in the [Customer Portal](/docs/customer-portal), but cannot create pauses; Commet Admin exposes them in the subscription detail. Dashboard mutations require permission to edit subscriptions.
260
+
261
+ Editing a pause derives an equivalent duration from its stored dates: weekly subscriptions prefer whole weeks; other subscriptions prefer whole calendar months, then weeks or days. Durations are always measured from the original effective date; a month ending on a shorter month uses its last day. The current pause shows its effective date and resume date. Use its actions to edit the duration, revoke a scheduled pause, or resume an effective pause.
262
+
263
+ ### Create a pause
264
+
265
+ This request schedules a seven-day pause at period end:
266
+
267
+ ```bash
268
+ curl -X POST https://commet.co/api/v1/subscriptions/sub_xxx/pause \
269
+ -H "x-api-key: $COMMET_API_KEY" \
270
+ -H "commet-version: 2026-08-27" \
271
+ -H "Content-Type: application/json" \
272
+ -d '{"mode":"period_end","durationDays":7}'
273
+ ```
274
+
275
+ Use `"mode":"immediate"` to pause now, or `"durationDays":null` to leave the resume date open.
276
+
277
+ Creation returns the updated subscription. A future pause has `pause.status: "scheduled"` while the subscription remains `active` or `trialing`. Once effective, the subscription is `paused` and `pause.status` is `"active"`. The `pause` object includes `mode`, `effectiveAt`, and `resumeAt`; it is `null` when there is no current or scheduled pause.
278
+
279
+ ### Edit or revoke a pause
280
+
281
+ Change the duration of a scheduled or effective pause:
282
+
283
+ ```bash
284
+ curl -X PATCH https://commet.co/api/v1/subscriptions/sub_xxx/pause \
285
+ -H "x-api-key: $COMMET_API_KEY" \
286
+ -H "commet-version: 2026-08-27" \
287
+ -H "Content-Type: application/json" \
288
+ -d '{"durationDays":14}'
289
+ ```
290
+
291
+ This sets the total duration to 14 days from the original effective date; it does not add 14 days from today. Send `null` to make the pause indefinite. This operation does not change its mode.
292
+
293
+ Revoke a pause before it becomes effective:
294
+
295
+ ```bash
296
+ curl -X DELETE https://commet.co/api/v1/subscriptions/sub_xxx/pause \
297
+ -H "x-api-key: $COMMET_API_KEY" \
298
+ -H "commet-version: 2026-08-27"
299
+ ```
300
+
301
+ The subscription keeps its current period and access. An effective pause must be resumed instead.
302
+
303
+ ### Resume and handle payment outcomes
304
+
305
+ Use `resume` for a paused subscription; `reactivate` is a separate operation for canceled or past-due subscriptions.
306
+
307
+ ```bash
308
+ curl -X POST https://commet.co/api/v1/subscriptions/sub_xxx/resume \
309
+ -H "x-api-key: $COMMET_API_KEY" \
310
+ -H "commet-version: 2026-08-27"
311
+ ```
312
+
313
+ The response includes `subscriptionId`, `invoiceId`, and `status`. An immediate resume has no new invoice, so `invoiceId` is `null`.
314
+
315
+ | Response | Meaning |
316
+ | ----------------------------- | ------------------------------------------------------------------------------------------------------ |
317
+ | `200`, `status: "succeeded"` | Resume completed. Access is restored. |
318
+ | `200`, `status: "processing"` | The resume payment or settlement is still pending. Do not restore access based on this response alone. |
319
+ | `402`, `charge_failed` | The payment was declined. The subscription stays paused. |
320
+ | `422`, `no_payment_method` | A period-end resume needs a saved payment method. |
321
+ | `500`, `internal_error` | An internal failure prevented completion; this is distinct from a declined payment. |
322
+
323
+ A declined resume keeps its invoice outstanding. Automatic payment retries follow days 1, 3, 5, and 7 from the original failure and reuse that invoice. The subscription stays paused during retries. If all retries fail, it is canceled and the resume invoice becomes uncollectible. Manual resume attempts do not consume automatic retry slots.
324
+
325
+ A period-end resume uses the current base price when its new invoice is created. An outstanding resume invoice keeps its original amounts and included credits or balance on retry, even if the catalog changes again. Accepted Introductory Offers and discounts preserve their unconsumed terms; resume does not grant a new Introductory Offer or redeem a promo code again.
326
+
327
+ See the [Pause API reference](/docs/api-reference/subscriptions/pause-subscription) and [Resume API reference](/docs/api-reference/subscriptions/resume-subscription) for the complete schemas.
328
+
329
+ ### Keep access in sync
330
+
331
+ Use [Feature Access](/docs/api-reference/features/get-feature-access) to authorize requests against the current subscription state. Subscribe to these webhooks for asynchronous updates in your application:
332
+
333
+ - [`subscription.pause_scheduled`](/docs/webhooks/subscription-pause-scheduled): a future pause was scheduled; access has not stopped yet.
334
+ - [`subscription.pause_updated`](/docs/webhooks/subscription-pause-updated): the pause duration changed.
335
+ - [`subscription.pause_revoked`](/docs/webhooks/subscription-pause-revoked): the scheduled pause was removed.
336
+ - [`subscription.paused`](/docs/webhooks/subscription-paused): the pause became effective and subscription access stopped.
337
+ - [`subscription.resumed`](/docs/webhooks/subscription-resumed): resume completed and subscription access returned.
338
+ - [`subscription.resume_failed`](/docs/webhooks/subscription-resume-failed): resume payment failed and the subscription remains paused.
339
+
240
340
  ## Cancel
241
341
 
242
342
  **TypeScript**
@@ -300,6 +400,8 @@ $subscription = $commet->subscriptions->cancel(id: 'sub_xxx');
300
400
 
301
401
  A normal paid active subscription schedules cancellation at period end unless `immediate: true` is sent. Free, pending-payment, and past-due relationships cancel immediately. Cancellation does not erase the stored subscription balance.
302
402
 
403
+ Canceling a paused subscription is immediate and discards its preserved time. Pending usage, overage, or seat adjustments may still produce a final invoice. To cancel while a future pause is scheduled, revoke that pause first.
404
+
303
405
  ## Reverse a scheduled cancellation
304
406
 
305
407
  **TypeScript**
@@ -1,5 +1,4 @@
1
1
  ---
2
- lastModified: 2026-08-17
3
2
  title: Grant Temporary Plan Access
4
3
  description: Temporarily expand a subscription's features and limits without changing its plan, price, invoice, or billing cycle.
5
4
  ---
@@ -1,5 +1,4 @@
1
1
  ---
2
- lastModified: 2026-08-17
3
2
  title: Upgrade and Downgrade Plans
4
3
  description: How customers change plans through the Customer Portal and dashboard.
5
4
  ---
@@ -1,5 +1,4 @@
1
1
  ---
2
- lastModified: 2026-08-12
3
2
  title: Testing
4
3
  description: Test safely with sandbox environment
5
4
  ---
@@ -1,5 +1,4 @@
1
1
  ---
2
- lastModified: 2026-07-28
3
2
  title: AI Token Billing
4
3
  description: Automatically measure and charge for AI token usage with model-aware pricing and configurable margins.
5
4
  ---
@@ -1,5 +1,4 @@
1
1
  ---
2
- lastModified: 2026-07-28
3
2
  title: Quota Management
4
3
  description: Manage durable quota balances with the Commet SDK.
5
4
  ---
@@ -1,5 +1,4 @@
1
1
  ---
2
- lastModified: 2026-07-28
3
2
  title: Seat Management
4
3
  description: Manage seat-based licenses with the Commet SDK.
5
4
  ---
@@ -1,5 +1,4 @@
1
1
  ---
2
- lastModified: 2026-07-28
3
2
  title: Track Usage
4
3
  description: Record metered consumption with the current Commet SDKs.
5
4
  ---
@@ -4,7 +4,7 @@ The add-on is already active on this subscription.
4
4
 
5
5
  - **Error type:** `conflict_error`
6
6
  - **`code`:** `addon_already_active`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do
@@ -4,7 +4,7 @@ The add-on cannot be deleted while subscriptions use it.
4
4
 
5
5
  - **Error type:** `conflict_error`
6
6
  - **`code`:** `addon_has_activations`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do
@@ -4,7 +4,7 @@ The add-on is not active on this subscription.
4
4
 
5
5
  - **Error type:** `billing_error`
6
6
  - **`code`:** `addon_not_active`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do
@@ -4,7 +4,7 @@ The requested add-on does not exist in this organization.
4
4
 
5
5
  - **Error type:** `not_found_error`
6
6
  - **`code`:** `addon_not_found`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do
@@ -4,7 +4,7 @@ The customer already has a draft, trialing, active, or past-due subscription tha
4
4
 
5
5
  - **Error type:** `conflict_error`
6
6
  - **`code`:** `already_has_active_subscription`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do
@@ -4,7 +4,7 @@ The requested subscription action is already scheduled.
4
4
 
5
5
  - **Error type:** `conflict_error`
6
6
  - **`code`:** `already_scheduled`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do
@@ -4,7 +4,7 @@ The requested API key does not exist in this organization.
4
4
 
5
5
  - **Error type:** `not_found_error`
6
6
  - **`code`:** `api_key_not_found`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do
@@ -4,7 +4,7 @@ Card promotions are not available for this organization.
4
4
 
5
5
  - **Error type:** `conflict_error`
6
6
  - **`code`:** `card_promotions_not_available`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do
@@ -4,7 +4,7 @@ The charge required by the subscription operation failed.
4
4
 
5
5
  - **Error type:** `billing_error`
6
6
  - **`code`:** `charge_failed`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do
@@ -4,7 +4,7 @@ A charge or payment retry is already running for the subscription.
4
4
 
5
5
  - **Error type:** `conflict_error`
6
6
  - **`code`:** `charge_in_progress`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do
@@ -4,7 +4,7 @@ The organization has no pending claim to complete.
4
4
 
5
5
  - **Error type:** `not_found_error`
6
6
  - **`code`:** `claim_not_pending`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do
@@ -4,7 +4,7 @@ The requested credit pack does not exist in this organization.
4
4
 
5
5
  - **Error type:** `not_found_error`
6
6
  - **`code`:** `credit_pack_not_found`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do
@@ -4,7 +4,7 @@ The requested customer does not exist in this organization.
4
4
 
5
5
  - **Error type:** `not_found_error`
6
6
  - **`code`:** `customer_not_found`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do
@@ -4,7 +4,7 @@ The request conflicts with an existing resource, unique value, or previously rec
4
4
 
5
5
  - **Error type:** `conflict_error`
6
6
  - **`code`:** `duplicate`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do
@@ -4,7 +4,7 @@ The endpoint has been retired and returns HTTP 410 Gone.
4
4
 
5
5
  - **Error type:** `not_found_error`
6
6
  - **`code`:** `endpoint_deprecated`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do
@@ -4,7 +4,7 @@ This endpoint is not available in the resolved API version.
4
4
 
5
5
  - **Error type:** `not_found_error`
6
6
  - **`code`:** `endpoint_not_available`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do
@@ -4,7 +4,7 @@ A feature with the same code or name already exists, or the feature is already a
4
4
 
5
5
  - **Error type:** `conflict_error`
6
6
  - **`code`:** `feature_already_exists`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do
@@ -4,7 +4,7 @@ The requested feature is disabled for the customer's subscription.
4
4
 
5
5
  - **Error type:** `billing_error`
6
6
  - **`code`:** `feature_disabled`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do
@@ -4,7 +4,7 @@ The feature cannot be deleted while a plan or add-on uses it.
4
4
 
5
5
  - **Error type:** `conflict_error`
6
6
  - **`code`:** `feature_in_use`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do
@@ -4,7 +4,7 @@ The requested feature, seat feature, or quota feature does not exist in this org
4
4
 
5
5
  - **Error type:** `not_found_error`
6
6
  - **`code`:** `feature_not_found`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do
@@ -4,7 +4,7 @@ The requested feature is not included in the customer's plan or subscription.
4
4
 
5
5
  - **Error type:** `billing_error`
6
6
  - **`code`:** `feature_not_in_plan`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do
@@ -4,7 +4,7 @@ The caller is authenticated but cannot perform this operation in the current org
4
4
 
5
5
  - **Error type:** `authentication_error`
6
6
  - **`code`:** `forbidden`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do
@@ -4,7 +4,7 @@ This plan-change operation does not support the selected free plan.
4
4
 
5
5
  - **Error type:** `validation_error`
6
6
  - **`code`:** `free_plan_change_not_supported`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do
@@ -4,7 +4,7 @@ A request with this Idempotency-Key is still being processed.
4
4
 
5
5
  - **Error type:** `conflict_error`
6
6
  - **`code`:** `idempotency_in_progress`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do
@@ -4,7 +4,7 @@ The Idempotency-Key was already used with a different request payload or operati
4
4
 
5
5
  - **Error type:** `conflict_error`
6
6
  - **`code`:** `idempotency_key_mismatch`
7
- - **API version:** `2026-07-31`
7
+ - **API version:** `2026-08-27`
8
8
 
9
9
 
10
10
  ## What to do