@commet/node 9.0.0 → 9.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (294) hide show
  1. package/README.md +2 -0
  2. package/dist/index.d.mts +332 -110
  3. package/dist/index.d.ts +332 -110
  4. package/dist/index.js +162 -40
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +162 -40
  7. package/dist/index.mjs.map +1 -1
  8. package/docs/README.md +20 -0
  9. package/docs/ai-onboarding/ai-onboarding.md +90 -0
  10. package/docs/ai-onboarding/billing-best-practices-skill.md +29 -0
  11. package/docs/ai-onboarding/commet-skill.md +58 -0
  12. package/docs/ai-onboarding/mcp-server.md +207 -0
  13. package/docs/ai-onboarding/meta.json +17 -0
  14. package/docs/ai-onboarding/pricing-models-skill.md +29 -0
  15. package/docs/ai-onboarding/subscription-patterns-skill.md +29 -0
  16. package/docs/api-reference/addons.md +127 -0
  17. package/docs/api-reference/api-keys.md +57 -0
  18. package/docs/api-reference/credit-packs.md +80 -0
  19. package/docs/api-reference/customers.md +274 -0
  20. package/docs/api-reference/feature-access.md +36 -0
  21. package/docs/api-reference/features.md +94 -0
  22. package/docs/api-reference/generated-webhooks.md +120 -0
  23. package/docs/api-reference/index.md +31 -0
  24. package/docs/api-reference/invoices.md +123 -0
  25. package/docs/api-reference/markets.md +92 -0
  26. package/docs/api-reference/meta.json +7 -0
  27. package/docs/api-reference/offers.md +104 -0
  28. package/docs/api-reference/payments.md +106 -0
  29. package/docs/api-reference/payouts.md +66 -0
  30. package/docs/api-reference/plan-groups.md +157 -0
  31. package/docs/api-reference/plans.md +358 -0
  32. package/docs/api-reference/portal.md +30 -0
  33. package/docs/api-reference/promo-codes.md +86 -0
  34. package/docs/api-reference/provisioning.md +19 -0
  35. package/docs/api-reference/quota.md +120 -0
  36. package/docs/api-reference/seats.md +123 -0
  37. package/docs/api-reference/subscriptions.md +387 -0
  38. package/docs/api-reference/test-clock.md +59 -0
  39. package/docs/api-reference/transactions.md +78 -0
  40. package/docs/api-reference/usage.md +83 -0
  41. package/docs/documentation/api-versioning.md +100 -0
  42. package/docs/documentation/better-auth.md +361 -0
  43. package/docs/documentation/choose-a-billing-model.md +38 -0
  44. package/docs/documentation/cli.md +1024 -0
  45. package/docs/documentation/create-api-key.md +47 -0
  46. package/docs/documentation/customers/customer-credits.md +48 -0
  47. package/docs/documentation/customers/customer-portal.md +107 -0
  48. package/docs/documentation/customers/manage-customers.md +346 -0
  49. package/docs/documentation/customers/meta.json +5 -0
  50. package/docs/documentation/error-handling.md +239 -0
  51. package/docs/documentation/examples.md +37 -0
  52. package/docs/documentation/finance/acceptable-use.md +145 -0
  53. package/docs/documentation/finance/finance-overview.md +32 -0
  54. package/docs/documentation/finance/local-currency-taxes.md +40 -0
  55. package/docs/documentation/finance/merchant-of-record.md +48 -0
  56. package/docs/documentation/finance/meta.json +13 -0
  57. package/docs/documentation/finance/payouts-verification.md +186 -0
  58. package/docs/documentation/finance/payouts.md +41 -0
  59. package/docs/documentation/finance/supported-countries.md +28 -0
  60. package/docs/documentation/go/integrate-with-encore.md +229 -0
  61. package/docs/documentation/go/integrate-with-go.md +258 -0
  62. package/docs/documentation/go/meta.json +5 -0
  63. package/docs/documentation/introduction.md +58 -0
  64. package/docs/documentation/invoicing/handle-failed-payments.md +283 -0
  65. package/docs/documentation/invoicing/invoices-and-billing-cycles.md +73 -0
  66. package/docs/documentation/invoicing/manage-invoices.md +340 -0
  67. package/docs/documentation/invoicing/meta.json +9 -0
  68. package/docs/documentation/java/integrate-with-java.md +117 -0
  69. package/docs/documentation/java/meta.json +5 -0
  70. package/docs/documentation/meta.json +36 -0
  71. package/docs/documentation/nodejs/integrate-with-astro.md +129 -0
  72. package/docs/documentation/nodejs/integrate-with-bun.md +113 -0
  73. package/docs/documentation/nodejs/integrate-with-express.md +127 -0
  74. package/docs/documentation/nodejs/integrate-with-hono.md +141 -0
  75. package/docs/documentation/nodejs/integrate-with-nextjs.md +118 -0
  76. package/docs/documentation/nodejs/integrate-with-nuxt.md +125 -0
  77. package/docs/documentation/nodejs/integrate-with-remix.md +136 -0
  78. package/docs/documentation/nodejs/integrate-with-sveltekit.md +127 -0
  79. package/docs/documentation/nodejs/meta.json +14 -0
  80. package/docs/documentation/payments/accept-one-time-payments.md +314 -0
  81. package/docs/documentation/payments/meta.json +10 -0
  82. package/docs/documentation/payments/payment-orchestration.md +43 -0
  83. package/docs/documentation/payments/payment-providers.md +59 -0
  84. package/docs/documentation/payments/transactions-refunds-and-retries.md +199 -0
  85. package/docs/documentation/php/integrate-with-laravel.md +222 -0
  86. package/docs/documentation/php/integrate-with-php.md +103 -0
  87. package/docs/documentation/php/integrate-with-symfony.md +214 -0
  88. package/docs/documentation/php/meta.json +9 -0
  89. package/docs/documentation/plans/add-ons.md +257 -0
  90. package/docs/documentation/plans/balance-and-top-ups.md +169 -0
  91. package/docs/documentation/plans/configure-features.md +335 -0
  92. package/docs/documentation/plans/consumption-models.md +93 -0
  93. package/docs/documentation/plans/create-plans.md +162 -0
  94. package/docs/documentation/plans/credit-packs.md +89 -0
  95. package/docs/documentation/plans/meta.json +14 -0
  96. package/docs/documentation/plans/one-time-payments.md +142 -0
  97. package/docs/documentation/plans/plan-groups.md +31 -0
  98. package/docs/documentation/platform/custom-domains.md +27 -0
  99. package/docs/documentation/platform/dashboard-metrics-and-events.md +25 -0
  100. package/docs/documentation/platform/members-and-permissions.md +21 -0
  101. package/docs/documentation/platform/meta.json +10 -0
  102. package/docs/documentation/platform/organization-settings.md +29 -0
  103. package/docs/documentation/python/integrate-with-django.md +161 -0
  104. package/docs/documentation/python/integrate-with-fastapi.md +164 -0
  105. package/docs/documentation/python/integrate-with-flask.md +153 -0
  106. package/docs/documentation/python/integrate-with-python.md +90 -0
  107. package/docs/documentation/python/meta.json +10 -0
  108. package/docs/documentation/sales/card-promotions.md +41 -0
  109. package/docs/documentation/sales/introductory-offers.md +64 -0
  110. package/docs/documentation/sales/meta.json +13 -0
  111. package/docs/documentation/sales/offers.md +65 -0
  112. package/docs/documentation/sales/promo-codes.md +65 -0
  113. package/docs/documentation/sales/promotional-offers.md +58 -0
  114. package/docs/documentation/sales/regional-prices.md +100 -0
  115. package/docs/documentation/sales/trial-periods.md +88 -0
  116. package/docs/documentation/sdk-reference.md +68 -0
  117. package/docs/documentation/subscriptions/manage-subscriptions.md +505 -0
  118. package/docs/documentation/subscriptions/meta.json +9 -0
  119. package/docs/documentation/subscriptions/plan-grants.md +124 -0
  120. package/docs/documentation/subscriptions/upgrade-and-downgrade-plans.md +37 -0
  121. package/docs/documentation/testing-sandbox.md +251 -0
  122. package/docs/documentation/usage/ai-token-billing.md +294 -0
  123. package/docs/documentation/usage/meta.json +10 -0
  124. package/docs/documentation/usage/quota-management.md +341 -0
  125. package/docs/documentation/usage/seat-management.md +377 -0
  126. package/docs/documentation/usage/track-usage.md +282 -0
  127. package/docs/errors/addon_already_active.md +22 -0
  128. package/docs/errors/addon_has_activations.md +22 -0
  129. package/docs/errors/addon_not_active.md +22 -0
  130. package/docs/errors/addon_not_found.md +22 -0
  131. package/docs/errors/already_has_active_subscription.md +22 -0
  132. package/docs/errors/already_scheduled.md +22 -0
  133. package/docs/errors/api_key_not_found.md +22 -0
  134. package/docs/errors/card_promotions_not_available.md +22 -0
  135. package/docs/errors/charge_failed.md +22 -0
  136. package/docs/errors/charge_in_progress.md +22 -0
  137. package/docs/errors/claim_not_pending.md +22 -0
  138. package/docs/errors/credit_pack_not_found.md +22 -0
  139. package/docs/errors/customer_not_found.md +22 -0
  140. package/docs/errors/duplicate.md +22 -0
  141. package/docs/errors/endpoint_deprecated.md +22 -0
  142. package/docs/errors/endpoint_not_available.md +22 -0
  143. package/docs/errors/feature_already_exists.md +22 -0
  144. package/docs/errors/feature_disabled.md +22 -0
  145. package/docs/errors/feature_in_use.md +22 -0
  146. package/docs/errors/feature_not_found.md +22 -0
  147. package/docs/errors/feature_not_in_plan.md +22 -0
  148. package/docs/errors/forbidden.md +22 -0
  149. package/docs/errors/free_plan_change_not_supported.md +22 -0
  150. package/docs/errors/idempotency_in_progress.md +22 -0
  151. package/docs/errors/idempotency_key_mismatch.md +22 -0
  152. package/docs/errors/idempotency_unavailable.md +22 -0
  153. package/docs/errors/included_limit_reached.md +22 -0
  154. package/docs/errors/index.md +89 -0
  155. package/docs/errors/insufficient_balance.md +22 -0
  156. package/docs/errors/insufficient_credits.md +22 -0
  157. package/docs/errors/insufficient_seats.md +22 -0
  158. package/docs/errors/internal_error.md +22 -0
  159. package/docs/errors/invalid_json.md +22 -0
  160. package/docs/errors/invalid_subscription_status.md +22 -0
  161. package/docs/errors/invoice_not_found.md +22 -0
  162. package/docs/errors/market_group_in_use.md +22 -0
  163. package/docs/errors/market_group_not_found.md +22 -0
  164. package/docs/errors/market_in_use.md +22 -0
  165. package/docs/errors/market_not_found.md +22 -0
  166. package/docs/errors/missing_regional_price.md +22 -0
  167. package/docs/errors/model_not_found.md +22 -0
  168. package/docs/errors/no_active_subscription.md +22 -0
  169. package/docs/errors/no_change_requested.md +22 -0
  170. package/docs/errors/no_outstanding_invoice.md +22 -0
  171. package/docs/errors/no_payment_method.md +22 -0
  172. package/docs/errors/no_prices_configured.md +22 -0
  173. package/docs/errors/not_found.md +22 -0
  174. package/docs/errors/not_scheduled_for_cancellation.md +22 -0
  175. package/docs/errors/offer_not_applicable.md +22 -0
  176. package/docs/errors/offer_not_found.md +22 -0
  177. package/docs/errors/one_time_subscription_not_cancelable.md +22 -0
  178. package/docs/errors/organization_already_claimed.md +22 -0
  179. package/docs/errors/payment_failed.md +22 -0
  180. package/docs/errors/payment_method_not_found.md +22 -0
  181. package/docs/errors/payment_not_cancelable.md +22 -0
  182. package/docs/errors/payment_not_found.md +22 -0
  183. package/docs/errors/payouts_not_available_in_sandbox.md +22 -0
  184. package/docs/errors/plan_change_scheduled.md +22 -0
  185. package/docs/errors/plan_group_not_found.md +22 -0
  186. package/docs/errors/plan_not_found.md +22 -0
  187. package/docs/errors/plan_unavailable.md +22 -0
  188. package/docs/errors/plans_not_in_same_group.md +22 -0
  189. package/docs/errors/price_in_use.md +22 -0
  190. package/docs/errors/price_not_found.md +22 -0
  191. package/docs/errors/pricing_mode_mismatch.md +22 -0
  192. package/docs/errors/promo_code_expired.md +22 -0
  193. package/docs/errors/promo_code_not_found.md +22 -0
  194. package/docs/errors/provider_unsupported.md +22 -0
  195. package/docs/errors/rate_limited.md +22 -0
  196. package/docs/errors/sandbox_only.md +22 -0
  197. package/docs/errors/seat_limit_exceeded.md +22 -0
  198. package/docs/errors/subscription_activation_failed.md +22 -0
  199. package/docs/errors/subscription_already_canceled.md +22 -0
  200. package/docs/errors/subscription_cancel_failed.md +22 -0
  201. package/docs/errors/subscription_creation_failed.md +22 -0
  202. package/docs/errors/subscription_has_open_dispute.md +22 -0
  203. package/docs/errors/subscription_not_active.md +22 -0
  204. package/docs/errors/subscription_not_found.md +22 -0
  205. package/docs/errors/subscription_required.md +22 -0
  206. package/docs/errors/subscription_uncancel_failed.md +22 -0
  207. package/docs/errors/transaction_not_found.md +22 -0
  208. package/docs/errors/unauthorized.md +22 -0
  209. package/docs/errors/validation_error.md +22 -0
  210. package/docs/errors/webhook_not_found.md +22 -0
  211. package/docs/errors.md +34 -0
  212. package/docs/getting-started.md +35 -0
  213. package/docs/knowledge-base/how-do-balance-and-top-ups-work.md +22 -0
  214. package/docs/knowledge-base/how-do-credits-credit-packs-and-customer-credits-differ.md +20 -0
  215. package/docs/knowledge-base/how-do-discounts-work.md +65 -0
  216. package/docs/knowledge-base/how-do-free-plans-work-without-payment.md +88 -0
  217. package/docs/knowledge-base/how-do-monthly-quarterly-and-yearly-billing-work.md +77 -0
  218. package/docs/knowledge-base/how-do-offers-promo-codes-and-card-promotions-work-together.md +20 -0
  219. package/docs/knowledge-base/how-do-trial-periods-work.md +54 -0
  220. package/docs/knowledge-base/how-does-billing-work.md +73 -0
  221. package/docs/knowledge-base/how-does-payment-routing-work.md +17 -0
  222. package/docs/knowledge-base/how-does-quota-based-billing-work.md +106 -0
  223. package/docs/knowledge-base/how-does-seat-based-billing-work.md +88 -0
  224. package/docs/knowledge-base/how-is-proration-calculated-when-changing-plans.md +89 -0
  225. package/docs/knowledge-base/meta.json +29 -0
  226. package/docs/knowledge-base/what-happens-when-a-customer-changes-plans.md +110 -0
  227. package/docs/knowledge-base/what-happens-when-a-payment-fails.md +40 -0
  228. package/docs/knowledge-base/what-happens-when-you-change-your-prices.md +74 -0
  229. package/docs/knowledge-base/what-happens-when-you-refund-or-retry-a-transaction.md +21 -0
  230. package/docs/knowledge-base/what-invoices-do-customers-receive-and-when.md +101 -0
  231. package/docs/manifest.json +1677 -0
  232. package/docs/meta.json +11 -0
  233. package/docs/platform-documentation.md +175 -0
  234. package/docs/schemas.md +995 -0
  235. package/docs/webhooks/addon-activated.md +44 -0
  236. package/docs/webhooks/addon-deactivated.md +40 -0
  237. package/docs/webhooks/balance-depleted.md +37 -0
  238. package/docs/webhooks/balance-low.md +39 -0
  239. package/docs/webhooks/balance-topped-up.md +41 -0
  240. package/docs/webhooks/checkout-ready.md +43 -0
  241. package/docs/webhooks/credits-depleted.md +35 -0
  242. package/docs/webhooks/credits-expired.md +35 -0
  243. package/docs/webhooks/credits-granted.md +37 -0
  244. package/docs/webhooks/credits-low.md +39 -0
  245. package/docs/webhooks/credits-purchased.md +41 -0
  246. package/docs/webhooks/customer-created.md +49 -0
  247. package/docs/webhooks/customer-state-changed.md +134 -0
  248. package/docs/webhooks/customer-updated.md +49 -0
  249. package/docs/webhooks/introduction.md +499 -0
  250. package/docs/webhooks/invoice-created.md +45 -0
  251. package/docs/webhooks/invoice-overdue.md +53 -0
  252. package/docs/webhooks/invoice-upcoming.md +43 -0
  253. package/docs/webhooks/invoice-voided.md +53 -0
  254. package/docs/webhooks/meta.json +78 -0
  255. package/docs/webhooks/payment-dispute-resolved.md +52 -0
  256. package/docs/webhooks/payment-disputed.md +49 -0
  257. package/docs/webhooks/payment-failed.md +37 -0
  258. package/docs/webhooks/payment-link-canceled.md +41 -0
  259. package/docs/webhooks/payment-link-completed.md +47 -0
  260. package/docs/webhooks/payment-link-created.md +41 -0
  261. package/docs/webhooks/payment-link-failed.md +45 -0
  262. package/docs/webhooks/payment-method-attached.md +40 -0
  263. package/docs/webhooks/payment-method-updated.md +38 -0
  264. package/docs/webhooks/payment-received.md +45 -0
  265. package/docs/webhooks/payment-recovered.md +39 -0
  266. package/docs/webhooks/payment-refunded.md +47 -0
  267. package/docs/webhooks/payment-retry-failed.md +39 -0
  268. package/docs/webhooks/payout-available.md +33 -0
  269. package/docs/webhooks/payout-created.md +48 -0
  270. package/docs/webhooks/payout-failed.md +52 -0
  271. package/docs/webhooks/payout-paid.md +48 -0
  272. package/docs/webhooks/quota-exceeded.md +44 -0
  273. package/docs/webhooks/quota-threshold-reached.md +41 -0
  274. package/docs/webhooks/seats-limit-reached.md +39 -0
  275. package/docs/webhooks/seats-updated.md +39 -0
  276. package/docs/webhooks/subscription-activated.md +43 -0
  277. package/docs/webhooks/subscription-canceled.md +57 -0
  278. package/docs/webhooks/subscription-cancellation-revoked.md +37 -0
  279. package/docs/webhooks/subscription-cancellation-scheduled.md +45 -0
  280. package/docs/webhooks/subscription-created.md +35 -0
  281. package/docs/webhooks/subscription-past-due.md +43 -0
  282. package/docs/webhooks/subscription-plan-change-revoked.md +50 -0
  283. package/docs/webhooks/subscription-plan-change-scheduled.md +55 -0
  284. package/docs/webhooks/subscription-plan-changed.md +43 -0
  285. package/docs/webhooks/subscription-reactivated.md +53 -0
  286. package/docs/webhooks/subscription-updated.md +39 -0
  287. package/docs/webhooks/trial-checkout-ready.md +39 -0
  288. package/docs/webhooks/trial-converted.md +39 -0
  289. package/docs/webhooks/trial-expired.md +39 -0
  290. package/docs/webhooks/trial-started.md +46 -0
  291. package/docs/webhooks/trial-will-end.md +41 -0
  292. package/docs/webhooks/usage-recorded.md +41 -0
  293. package/docs/webhooks.md +782 -0
  294. package/package.json +2 -1
@@ -0,0 +1,335 @@
1
+ ---
2
+ lastModified: 2026-07-28
3
+ title: Configure Features
4
+ description: Define capabilities and read current or prospective customer access.
5
+ ---
6
+
7
+ Features are reusable capabilities that can be attached to several plans with different limits and prices.
8
+
9
+ ## Feature types
10
+
11
+ | Type | Use it for |
12
+ | --------- | ----------------------------------------------- |
13
+ | `boolean` | On/off capabilities such as SSO |
14
+ | `usage` | Metered quantities such as API calls |
15
+ | `seats` | Per-user licenses |
16
+ | `quota` | Durable integer balances that can rise and fall |
17
+
18
+ The feature code is the identifier used by Feature Access, Usage, Seats, and Quota. Use lowercase letters, numbers, and underscores.
19
+
20
+ ## Current feature state
21
+
22
+ Use `featureAccess.get` to read whether the customer currently has access and the feature's current counters:
23
+
24
+ **TypeScript**
25
+
26
+ ```typescript
27
+ import { Commet } from "@commet/node";
28
+
29
+ const commet = new Commet({ apiKey: "ck_xxx" });
30
+
31
+ const featureAccess = await commet.featureAccess.get({
32
+ code: "api_calls",
33
+ customerId: "user_123",
34
+ });
35
+ ```
36
+
37
+ **Python**
38
+
39
+ ```python
40
+ from commet import Commet
41
+
42
+ commet = Commet("ck_xxx")
43
+
44
+ feature_access = commet.feature_access.get(
45
+ "api_calls",
46
+ customer_id="user_123",
47
+ )
48
+ ```
49
+
50
+ **Go**
51
+
52
+ ```go
53
+ client, err := commet.New("ck_xxx")
54
+ if err != nil {
55
+ log.Fatal(err)
56
+ }
57
+ ctx := context.Background()
58
+
59
+ featureAccess, err := client.FeatureAccess.Get(ctx, "api_calls", &commet.GetFeatureAccessParams{
60
+ CustomerID: "user_123",
61
+ })
62
+ if err != nil {
63
+ log.Fatal(err)
64
+ }
65
+ ```
66
+
67
+ **Java**
68
+
69
+ ```java
70
+ import co.commet.Commet;
71
+ import co.commet.params.GetFeatureAccessParams;
72
+
73
+ var commet = Commet.builder().apiKey("ck_xxx").build();
74
+
75
+ var featureAccess = commet.featureAccess().get(
76
+ "api_calls",
77
+ GetFeatureAccessParams.builder("user_123").build()
78
+ );
79
+ ```
80
+
81
+ **PHP**
82
+
83
+ ```php
84
+ use Commet\Commet;
85
+
86
+ $commet = new Commet('ck_xxx');
87
+
88
+ $featureAccess = $commet->featureAccess->get(
89
+ code: 'api_calls',
90
+ customerId: 'user_123',
91
+ );
92
+ ```
93
+
94
+ The exact response is discriminated by feature `type`. It can include enabled state, usage, included units, remaining units, seats, or quota values.
95
+
96
+ Use the list operation to retrieve the customer's complete current feature state:
97
+
98
+ **TypeScript**
99
+
100
+ ```typescript
101
+ import { Commet } from "@commet/node";
102
+
103
+ const commet = new Commet({ apiKey: "ck_xxx" });
104
+
105
+ const response = await commet.featureAccess.list({ customerId: "user_123" });
106
+ ```
107
+
108
+ **Python**
109
+
110
+ ```python
111
+ from commet import Commet
112
+
113
+ commet = Commet("ck_xxx")
114
+
115
+ feature_access_list_result = commet.feature_access.list(customer_id="user_123")
116
+ ```
117
+
118
+ **Go**
119
+
120
+ ```go
121
+ client, err := commet.New("ck_xxx")
122
+ if err != nil {
123
+ log.Fatal(err)
124
+ }
125
+ ctx := context.Background()
126
+
127
+ featureAccessListResult, err := client.FeatureAccess.List(ctx, &commet.ListFeatureAccessParams{
128
+ CustomerID: "user_123",
129
+ })
130
+ if err != nil {
131
+ log.Fatal(err)
132
+ }
133
+ ```
134
+
135
+ **Java**
136
+
137
+ ```java
138
+ import co.commet.Commet;
139
+ import co.commet.params.ListFeatureAccessParams;
140
+
141
+ var commet = Commet.builder().apiKey("ck_xxx").build();
142
+
143
+ var featureAccessListResult = commet.featureAccess().list(
144
+ ListFeatureAccessParams.builder("user_123").build()
145
+ );
146
+ ```
147
+
148
+ **PHP**
149
+
150
+ ```php
151
+ use Commet\Commet;
152
+
153
+ $commet = new Commet('ck_xxx');
154
+
155
+ $featureAccessListResult = $commet->featureAccess->list(customerId: 'user_123');
156
+ ```
157
+
158
+ Feature Access lists return the standard `{ object, data, hasMore, nextCursor }` envelope.
159
+
160
+ ## Prospective consumption
161
+
162
+ Use `usage.check` before an action when you need to know whether a specific quantity can be consumed and what it would cost:
163
+
164
+ **TypeScript**
165
+
166
+ ```typescript
167
+ import { Commet } from "@commet/node";
168
+
169
+ const commet = new Commet({ apiKey: "ck_xxx" });
170
+
171
+ const usageCheck = await commet.usage.check({
172
+ customerId: "user_123",
173
+ featureCode: "api_calls",
174
+ });
175
+ ```
176
+
177
+ **Python**
178
+
179
+ ```python
180
+ from commet import Commet
181
+
182
+ commet = Commet("ck_xxx")
183
+
184
+ usage_check = commet.usage.check(
185
+ customer_id="user_123",
186
+ feature_code="api_calls",
187
+ )
188
+ ```
189
+
190
+ **Go**
191
+
192
+ ```go
193
+ client, err := commet.New("ck_xxx")
194
+ if err != nil {
195
+ log.Fatal(err)
196
+ }
197
+ ctx := context.Background()
198
+
199
+ usageCheck, err := client.Usage.Check(ctx, &commet.CheckUsageAvailabilityParams{
200
+ CustomerID: "user_123",
201
+ FeatureCode: "api_calls",
202
+ })
203
+ if err != nil {
204
+ log.Fatal(err)
205
+ }
206
+ ```
207
+
208
+ **Java**
209
+
210
+ ```java
211
+ import co.commet.Commet;
212
+ import co.commet.params.CheckUsageAvailabilityParams;
213
+
214
+ var commet = Commet.builder().apiKey("ck_xxx").build();
215
+
216
+ var usageCheck = commet.usage().check(
217
+ CheckUsageAvailabilityParams.builder("user_123", "api_calls").build()
218
+ );
219
+ ```
220
+
221
+ **PHP**
222
+
223
+ ```php
224
+ use Commet\Commet;
225
+
226
+ $commet = new Commet('ck_xxx');
227
+
228
+ $usageCheck = $commet->usage->check(
229
+ customerId: 'user_123',
230
+ featureCode: 'api_calls',
231
+ );
232
+ ```
233
+
234
+ The response is discriminated by the plan's consumption model:
235
+
236
+ - `metered` reports current, remaining, included, and overage pricing.
237
+ - `credits` reports the estimated credit cost and available pools.
238
+ - `balance` reports the estimated monetary amount and current balance.
239
+
240
+ Do not use Feature Access as a substitute for this prospective check. Feature Access describes current state; Usage Check evaluates the proposed consumption.
241
+
242
+ ## Track the consumption
243
+
244
+ Once the action succeeds, record it through Usage:
245
+
246
+ **TypeScript**
247
+
248
+ ```typescript
249
+ import { Commet } from "@commet/node";
250
+
251
+ const commet = new Commet({ apiKey: "ck_xxx" });
252
+
253
+ const usageEvent = await commet.usage.track({
254
+ featureCode: "api_calls",
255
+ customerId: "user_123",
256
+ model: "example",
257
+ inputTokens: 1,
258
+ outputTokens: 1,
259
+ });
260
+ ```
261
+
262
+ **Python**
263
+
264
+ ```python
265
+ from commet import Commet
266
+
267
+ commet = Commet("ck_xxx")
268
+
269
+ usage_event = commet.usage.track(
270
+ feature_code="api_calls",
271
+ customer_id="user_123",
272
+ model="example",
273
+ input_tokens=1,
274
+ output_tokens=1,
275
+ )
276
+ ```
277
+
278
+ **Go**
279
+
280
+ ```go
281
+ client, err := commet.New("ck_xxx")
282
+ if err != nil {
283
+ log.Fatal(err)
284
+ }
285
+ ctx := context.Background()
286
+
287
+ usageEvent, err := client.Usage.Track(ctx, &commet.TrackUsageParams{
288
+ FeatureCode: "api_calls",
289
+ CustomerID: "user_123",
290
+ Model: func(value string) *string { return &value }("example"),
291
+ InputTokens: func(value int) *int { return &value }(1),
292
+ OutputTokens: func(value int) *int { return &value }(1),
293
+ })
294
+ if err != nil {
295
+ log.Fatal(err)
296
+ }
297
+ ```
298
+
299
+ **Java**
300
+
301
+ ```java
302
+ import co.commet.Commet;
303
+ import co.commet.params.TrackUsageParams;
304
+
305
+ var commet = Commet.builder().apiKey("ck_xxx").build();
306
+
307
+ var usageEvent = commet.usage().track(
308
+ TrackUsageParams.builder("api_calls", "user_123").model("example").inputTokens(1L).outputTokens(1L).build()
309
+ );
310
+ ```
311
+
312
+ **PHP**
313
+
314
+ ```php
315
+ use Commet\Commet;
316
+
317
+ $commet = new Commet('ck_xxx');
318
+
319
+ $usageEvent = $commet->usage->track(
320
+ featureCode: 'api_calls',
321
+ customerId: 'user_123',
322
+ model: 'example',
323
+ inputTokens: 1,
324
+ outputTokens: 1,
325
+ );
326
+ ```
327
+
328
+ Use the caller-owned `eventId` for the business event when retries must deduplicate it. Request idempotency is a separate transport option that maps to `Idempotency-Key`.
329
+
330
+ ## Related
331
+
332
+ - [Track Usage](/docs/track-usage)
333
+ - [Consumption Models](/docs/consumption-models)
334
+ - [Seat Management](/docs/seat-management)
335
+ - [Quota Management](/docs/quota-management)
@@ -0,0 +1,93 @@
1
+ ---
2
+ lastModified: 2026-07-10
3
+ title: Consumption Models
4
+ description: Understand the three ways customers consume and pay for features in Commet plans.
5
+ ---
6
+
7
+ Every plan uses one consumption model that defines how customers consume features and how they're billed. Models are mutually exclusive.
8
+
9
+ ## The three models
10
+
11
+ | Model | Description | Example Products |
12
+ | ----------- | ----------------------------------------------------------------------------- | --------------------------- |
13
+ | **Metered** | Base price + included usage. Overage charged at period end | AWS, Twilio, SendGrid |
14
+ | **Credits** | Base price includes credits. Usage consumes credits. Buy packs when exhausted | ChatGPT, Midjourney, Jasper |
15
+ | **Balance** | Base price becomes a spending balance. Usage deducts real dollars | Google Cloud, Anthropic |
16
+
17
+ ## Metered
18
+
19
+ Customers pay a base price and get included usage. Overage beyond the included amount is charged at the end of the billing period.
20
+
21
+ | Feature | Included | Overage Price |
22
+ | ----------- | ------------ | ---------------- |
23
+ | API Calls | 10,000/month | $0.01 per call |
24
+ | Storage | 100 GB | $0.10 per GB |
25
+ | Email Sends | 50,000/month | $0.001 per email |
26
+
27
+ ## Credits
28
+
29
+ Customers receive credits with their subscription. Feature usage consumes credits. When credits run out, customers can purchase [Credit Packs](/docs/credit-packs) or wait for the next billing cycle.
30
+
31
+ | Feature | Credits per Use |
32
+ | ------------------- | --------------- |
33
+ | AI Image Generation | 10 credits |
34
+ | AI Text Generation | 2 credits |
35
+ | AI Voice Synthesis | 25 credits |
36
+
37
+ > **Note**
38
+ >
39
+ > Plan credits reset each billing period. Credits purchased via Credit Packs **never expire**.
40
+
41
+ ## Balance
42
+
43
+ Customers pay a base price that becomes their spending balance. Feature usage costs real money deducted from the balance. Overage is charged at period end.
44
+
45
+ Balance supports two pricing modes per feature:
46
+
47
+ | Pricing Mode | How price is determined | Best for |
48
+ | --------------- | ------------------------------------------------------- | ------------------------------ |
49
+ | **Fixed Price** | You set a price per unit | API calls, storage, processing |
50
+ | **AI Model** | Commet calculates from model token prices + your margin | AI-powered features |
51
+
52
+ ### Fixed pricing
53
+
54
+ | Feature | Cost per Use |
55
+ | --------------------------- | ------------ |
56
+ | API Call | $0.001 |
57
+ | Image Processing | $0.05 |
58
+ | Video Encoding (per minute) | $0.10 |
59
+
60
+ ### AI Model pricing
61
+
62
+ Set a margin percentage instead of a fixed price. Commet looks up the model's token cost and applies your margin automatically. See [AI Token Billing](/docs/ai-token-billing) for details.
63
+
64
+ ## Comparison
65
+
66
+ | Aspect | Metered | Credits | Balance |
67
+ | -------------------- | --------------------------------------------------------------------------------------------------- | ------------------------------ | ----------------------------------------- |
68
+ | **When exceeded** | Overage at period end | Blocked or buy packs | Overage at period end |
69
+ | **Reset behavior** | Usage resets to 0 each period | Plan credits reset each period | Balance resets to plan amount each period |
70
+ | **Purchased extras** | N/A | Credits persist forever | Top-ups reset at period |
71
+ | **Reset frequency** | Weekly plans reset every 7 days. Monthly, quarterly, yearly, one-time, and free plans reset monthly | Same | Same |
72
+ | **Customer portal** | View usage | Buy credit packs | Add balance (top-up) |
73
+
74
+ ## Overage restrictions by plan type
75
+
76
+ | Plan type | Overage |
77
+ | -------------------------- | ------------------------------------------------------------------------- |
78
+ | **Paid plan** | Fully supported |
79
+ | **Free plan** | **Not allowed** — usage is blocked at included limits |
80
+ | **Trial** (on a paid plan) | **Blocked during trial** — activates when the subscription becomes active |
81
+
82
+ See [Free Plans](/docs/how-do-free-plans-work-without-payment) and [Trials](/docs/how-do-trial-periods-work) for details.
83
+
84
+ ## Learn more
85
+
86
+ - [How Does Billing Work](/docs/how-does-billing-work)
87
+
88
+ ## Related
89
+
90
+ - [Manage Plans](/docs/create-plans) — Create plans with consumption models
91
+ - [Credit Packs](/docs/credit-packs) — Configure credit packages for credits-based plans
92
+ - [Configure Features](/docs/configure-features) — Define what customers can access
93
+ - [Customer Portal](/docs/customer-portal) — Where customers manage their consumption
@@ -0,0 +1,162 @@
1
+ ---
2
+ lastModified: 2026-07-28
3
+ title: Manage Plans
4
+ description: Create and manage pricing plans in Commet that automatically generate subscriptions.
5
+ ---
6
+
7
+ Plans are pre-configured billing packages that combine pricing, features, and billing intervals. Assign a plan to a customer and Commet creates the subscription, customer portal, and recurring invoices automatically.
8
+
9
+ ## Plan components
10
+
11
+ | Component | Description | Example |
12
+ | ---------------------- | ------------------------------------------------- | ------------------------------ |
13
+ | **Name & Description** | Customer-facing display information | "Pro Plan — For growing teams" |
14
+ | **Consumption Model** | How customers consume and pay for features | Metered, Credits, or Balance |
15
+ | **Prices** | Pricing options by billing interval | $99/month, $899/year |
16
+ | **Features** | What's included — boolean, metered, or seat-based | API Calls (10k), SSO, 5 Seats |
17
+ | **Trial Days** | Optional free trial period per interval | 14 days |
18
+ | **Visibility** | Public (pricing page) or private (internal use) | Public or Private |
19
+
20
+ ## Free plans
21
+
22
+ A free plan has a price of $0 and no billing cycle. Customers are activated immediately without checkout. Free plans have one restriction: **overage cannot be configured**. Features on a free plan always block usage at the included limit. See [How Do Free Plans Work](/docs/how-do-free-plans-work-without-payment) for details.
23
+
24
+ ## Create a plan in the dashboard
25
+
26
+ Go to **Plans** and click **Create Plan**. Fill in each component from the table above, then save. For detailed feature configuration, see [Configure Features](/docs/configure-features).
27
+
28
+ ## Retrieve plans via SDK
29
+
30
+ ### TypeScript
31
+
32
+ ```typescript
33
+ const plans = await commet.plans.list()
34
+ ```
35
+
36
+ ### Python
37
+
38
+ ```python
39
+ plans = commet.plans.list()
40
+ ```
41
+
42
+ ### Go
43
+
44
+ ```go
45
+ plans, err := client.Plans.List(ctx, nil)
46
+ ```
47
+
48
+ ### Java
49
+
50
+ ```java
51
+ var plans = commet.plans().list();
52
+ ```
53
+
54
+ ### PHP
55
+
56
+ ```php
57
+ $plans = $commet->plans->list();
58
+ ```
59
+
60
+ ### cURL
61
+
62
+ ```bash
63
+ curl https://commet.co/api/v1/plans \
64
+ -H "x-api-key: $COMMET_API_KEY"
65
+ ```
66
+
67
+ Include private plans:
68
+
69
+ ### TypeScript
70
+
71
+ ```typescript
72
+ const plans = await commet.plans.list({ includePrivate: 'true' })
73
+ ```
74
+
75
+ ### Python
76
+
77
+ ```python
78
+ plans = commet.plans.list(include_private="true")
79
+ ```
80
+
81
+ ### Go
82
+
83
+ ```go
84
+ includePrivate := "true"
85
+ plans, err := client.Plans.List(ctx, &commet.ListPlansParams{
86
+ IncludePrivate: &includePrivate,
87
+ })
88
+ ```
89
+
90
+ ### Java
91
+
92
+ ```java
93
+ var plans = commet.plans().list(
94
+ ListPlansParams.builder().includePrivate("true").build()
95
+ );
96
+ ```
97
+
98
+ ### PHP
99
+
100
+ ```php
101
+ $plans = $commet->plans->list(includePrivate: 'true');
102
+ ```
103
+
104
+ ### cURL
105
+
106
+ ```bash
107
+ curl "https://commet.co/api/v1/plans?includePrivate=true" \
108
+ -H "x-api-key: $COMMET_API_KEY"
109
+ ```
110
+
111
+ Get a specific plan:
112
+
113
+ ### TypeScript
114
+
115
+ ```typescript
116
+ const plan = await commet.plans.get({ id: 'pln_xxx' })
117
+ ```
118
+
119
+ ### Python
120
+
121
+ ```python
122
+ plan = commet.plans.get("pln_xxx")
123
+ ```
124
+
125
+ ### Go
126
+
127
+ ```go
128
+ plan, err := client.Plans.Get(ctx, "pln_xxx")
129
+ ```
130
+
131
+ ### Java
132
+
133
+ ```java
134
+ var plan = commet.plans().get("pln_xxx");
135
+ ```
136
+
137
+ ### PHP
138
+
139
+ ```php
140
+ $plan = $commet->plans->get('pln_xxx');
141
+ ```
142
+
143
+ ### cURL
144
+
145
+ ```bash
146
+ curl https://commet.co/api/v1/plans/pln_xxx \
147
+ -H "x-api-key: $COMMET_API_KEY"
148
+ ```
149
+
150
+ ## Learn more
151
+
152
+ - [How Does Billing Work](/docs/how-does-billing-work)
153
+ - [How Do Free Plans Work Without Payment](/docs/how-do-free-plans-work-without-payment)
154
+
155
+ ## Related
156
+
157
+ - [Consumption Models](/docs/consumption-models) — Metered, Credits, and Balance explained
158
+ - [Credit Packs](/docs/credit-packs) — Purchasable credit packages
159
+ - [Plan Groups](/docs/plan-groups) — Enable self-service upgrades and downgrades
160
+ - [Configure Features](/docs/configure-features) — Boolean, metered, and seat features
161
+ - [Manage Subscriptions](/docs/manage-subscriptions) — Assign plans to customers
162
+ - [Customer Portal](/docs/customer-portal) — Self-service billing portal
@@ -0,0 +1,89 @@
1
+ ---
2
+ lastModified: 2026-07-28
3
+ title: Credit Packs
4
+ description: Configure credit packages that customers can purchase from the Commet Customer Portal.
5
+ ---
6
+
7
+ Credit Packs are additional credit packages customers can purchase when they run out of included plan credits. Only available for plans using the **Credits** [consumption model](/docs/consumption-models).
8
+
9
+ ## Credit pack components
10
+
11
+ | Component | Description | Example |
12
+ | ------------- | ----------------------------- | ---------------------------- |
13
+ | **Pack Name** | Customer-facing name | "Starter Pack", "Power Pack" |
14
+ | **Credits** | Number of credits in the pack | 100, 500, 2000 |
15
+ | **Price** | How much the pack costs | $10.00, $40.00 |
16
+
17
+ ## Availability by subscription status
18
+
19
+ Credit packs can be purchased on any subscription with a payment method — including during a trial and on free plans. Free plan customers are prompted to enter a payment method on their first purchase.
20
+
21
+ ## Create credit packs in the dashboard
22
+
23
+ Go to **Credit Packs** and click **Create Credit Pack**. Pack names must be unique within your organization. Packs are available to all credits-based plans.
24
+
25
+ ## List credit packs via SDK
26
+
27
+ ### TypeScript
28
+
29
+ ```typescript
30
+ const { data } = await commet.creditPacks.list()
31
+ ```
32
+
33
+ ### Python
34
+
35
+ ```python
36
+ response = commet.credit_packs.list()
37
+ ```
38
+
39
+ ### Go
40
+
41
+ ```go
42
+ result, err := client.CreditPacks.List(ctx)
43
+ ```
44
+
45
+ ### Java
46
+
47
+ ```java
48
+ var creditPacks = commet.creditPacks().list();
49
+ ```
50
+
51
+ ### PHP
52
+
53
+ ```php
54
+ $result = $commet->creditPacks->list();
55
+ ```
56
+
57
+ ### cURL
58
+
59
+ ```bash
60
+ curl https://commet.co/api/v1/credit-packs \
61
+ -H "x-api-key: $COMMET_API_KEY"
62
+ ```
63
+
64
+ **Response:**
65
+
66
+ ```json
67
+ {
68
+ "success": true,
69
+ "data": [
70
+ {
71
+ "id": "cpk_abc123",
72
+ "name": "Starter Pack",
73
+ "description": "100 credits for light usage",
74
+ "credits": 100,
75
+ "price": 1000,
76
+ "currency": "usd"
77
+ }
78
+ ]
79
+ }
80
+ ```
81
+
82
+ The `price` field is in **cents** (1000 = $10.00). Prices are always in USD.
83
+
84
+ ## Related
85
+
86
+ - [Consumption Models](/docs/consumption-models) — How credits-based billing works
87
+ - [Manage Plans](/docs/create-plans) — Create plans with consumption models
88
+ - [Customer Portal](/docs/customer-portal) — Where customers purchase credit packs
89
+ - [Configure Features](/docs/configure-features) — Define credit costs per feature
@@ -0,0 +1,14 @@
1
+ {
2
+ "title": "Plans",
3
+ "description": "Configure pricing plans, features, consumption models, and add-ons",
4
+ "pages": [
5
+ "create-plans",
6
+ "configure-features",
7
+ "consumption-models",
8
+ "balance-and-top-ups",
9
+ "add-ons",
10
+ "credit-packs",
11
+ "plan-groups",
12
+ "one-time-payments"
13
+ ]
14
+ }