@commet/node 8.0.1 → 9.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (294) hide show
  1. package/README.md +4 -4
  2. package/dist/index.d.mts +514 -206
  3. package/dist/index.d.ts +514 -206
  4. package/dist/index.js +202 -88
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +202 -88
  7. package/dist/index.mjs.map +1 -1
  8. package/docs/README.md +20 -0
  9. package/docs/ai-onboarding/ai-onboarding.md +90 -0
  10. package/docs/ai-onboarding/billing-best-practices-skill.md +29 -0
  11. package/docs/ai-onboarding/commet-skill.md +58 -0
  12. package/docs/ai-onboarding/mcp-server.md +207 -0
  13. package/docs/ai-onboarding/meta.json +17 -0
  14. package/docs/ai-onboarding/pricing-models-skill.md +29 -0
  15. package/docs/ai-onboarding/subscription-patterns-skill.md +29 -0
  16. package/docs/api-reference/addons.md +127 -0
  17. package/docs/api-reference/api-keys.md +57 -0
  18. package/docs/api-reference/credit-packs.md +80 -0
  19. package/docs/api-reference/customers.md +274 -0
  20. package/docs/api-reference/feature-access.md +36 -0
  21. package/docs/api-reference/features.md +94 -0
  22. package/docs/api-reference/generated-webhooks.md +120 -0
  23. package/docs/api-reference/index.md +31 -0
  24. package/docs/api-reference/invoices.md +123 -0
  25. package/docs/api-reference/markets.md +92 -0
  26. package/docs/api-reference/meta.json +7 -0
  27. package/docs/api-reference/offers.md +104 -0
  28. package/docs/api-reference/payments.md +106 -0
  29. package/docs/api-reference/payouts.md +66 -0
  30. package/docs/api-reference/plan-groups.md +157 -0
  31. package/docs/api-reference/plans.md +358 -0
  32. package/docs/api-reference/portal.md +30 -0
  33. package/docs/api-reference/promo-codes.md +86 -0
  34. package/docs/api-reference/provisioning.md +19 -0
  35. package/docs/api-reference/quota.md +120 -0
  36. package/docs/api-reference/seats.md +123 -0
  37. package/docs/api-reference/subscriptions.md +387 -0
  38. package/docs/api-reference/test-clock.md +59 -0
  39. package/docs/api-reference/transactions.md +78 -0
  40. package/docs/api-reference/usage.md +83 -0
  41. package/docs/documentation/api-versioning.md +100 -0
  42. package/docs/documentation/better-auth.md +361 -0
  43. package/docs/documentation/choose-a-billing-model.md +38 -0
  44. package/docs/documentation/cli.md +1024 -0
  45. package/docs/documentation/create-api-key.md +47 -0
  46. package/docs/documentation/customers/customer-credits.md +48 -0
  47. package/docs/documentation/customers/customer-portal.md +107 -0
  48. package/docs/documentation/customers/manage-customers.md +346 -0
  49. package/docs/documentation/customers/meta.json +5 -0
  50. package/docs/documentation/error-handling.md +239 -0
  51. package/docs/documentation/examples.md +37 -0
  52. package/docs/documentation/finance/acceptable-use.md +145 -0
  53. package/docs/documentation/finance/finance-overview.md +32 -0
  54. package/docs/documentation/finance/local-currency-taxes.md +40 -0
  55. package/docs/documentation/finance/merchant-of-record.md +48 -0
  56. package/docs/documentation/finance/meta.json +13 -0
  57. package/docs/documentation/finance/payouts-verification.md +186 -0
  58. package/docs/documentation/finance/payouts.md +41 -0
  59. package/docs/documentation/finance/supported-countries.md +28 -0
  60. package/docs/documentation/go/integrate-with-encore.md +229 -0
  61. package/docs/documentation/go/integrate-with-go.md +258 -0
  62. package/docs/documentation/go/meta.json +5 -0
  63. package/docs/documentation/introduction.md +58 -0
  64. package/docs/documentation/invoicing/handle-failed-payments.md +283 -0
  65. package/docs/documentation/invoicing/invoices-and-billing-cycles.md +73 -0
  66. package/docs/documentation/invoicing/manage-invoices.md +340 -0
  67. package/docs/documentation/invoicing/meta.json +9 -0
  68. package/docs/documentation/java/integrate-with-java.md +117 -0
  69. package/docs/documentation/java/meta.json +5 -0
  70. package/docs/documentation/meta.json +36 -0
  71. package/docs/documentation/nodejs/integrate-with-astro.md +129 -0
  72. package/docs/documentation/nodejs/integrate-with-bun.md +113 -0
  73. package/docs/documentation/nodejs/integrate-with-express.md +127 -0
  74. package/docs/documentation/nodejs/integrate-with-hono.md +141 -0
  75. package/docs/documentation/nodejs/integrate-with-nextjs.md +118 -0
  76. package/docs/documentation/nodejs/integrate-with-nuxt.md +125 -0
  77. package/docs/documentation/nodejs/integrate-with-remix.md +136 -0
  78. package/docs/documentation/nodejs/integrate-with-sveltekit.md +127 -0
  79. package/docs/documentation/nodejs/meta.json +14 -0
  80. package/docs/documentation/payments/accept-one-time-payments.md +314 -0
  81. package/docs/documentation/payments/meta.json +10 -0
  82. package/docs/documentation/payments/payment-orchestration.md +43 -0
  83. package/docs/documentation/payments/payment-providers.md +59 -0
  84. package/docs/documentation/payments/transactions-refunds-and-retries.md +199 -0
  85. package/docs/documentation/php/integrate-with-laravel.md +222 -0
  86. package/docs/documentation/php/integrate-with-php.md +103 -0
  87. package/docs/documentation/php/integrate-with-symfony.md +214 -0
  88. package/docs/documentation/php/meta.json +9 -0
  89. package/docs/documentation/plans/add-ons.md +257 -0
  90. package/docs/documentation/plans/balance-and-top-ups.md +169 -0
  91. package/docs/documentation/plans/configure-features.md +335 -0
  92. package/docs/documentation/plans/consumption-models.md +93 -0
  93. package/docs/documentation/plans/create-plans.md +162 -0
  94. package/docs/documentation/plans/credit-packs.md +89 -0
  95. package/docs/documentation/plans/meta.json +14 -0
  96. package/docs/documentation/plans/one-time-payments.md +142 -0
  97. package/docs/documentation/plans/plan-groups.md +31 -0
  98. package/docs/documentation/platform/custom-domains.md +27 -0
  99. package/docs/documentation/platform/dashboard-metrics-and-events.md +25 -0
  100. package/docs/documentation/platform/members-and-permissions.md +21 -0
  101. package/docs/documentation/platform/meta.json +10 -0
  102. package/docs/documentation/platform/organization-settings.md +29 -0
  103. package/docs/documentation/python/integrate-with-django.md +161 -0
  104. package/docs/documentation/python/integrate-with-fastapi.md +164 -0
  105. package/docs/documentation/python/integrate-with-flask.md +153 -0
  106. package/docs/documentation/python/integrate-with-python.md +90 -0
  107. package/docs/documentation/python/meta.json +10 -0
  108. package/docs/documentation/sales/card-promotions.md +41 -0
  109. package/docs/documentation/sales/introductory-offers.md +64 -0
  110. package/docs/documentation/sales/meta.json +13 -0
  111. package/docs/documentation/sales/offers.md +65 -0
  112. package/docs/documentation/sales/promo-codes.md +65 -0
  113. package/docs/documentation/sales/promotional-offers.md +58 -0
  114. package/docs/documentation/sales/regional-prices.md +100 -0
  115. package/docs/documentation/sales/trial-periods.md +88 -0
  116. package/docs/documentation/sdk-reference.md +68 -0
  117. package/docs/documentation/subscriptions/manage-subscriptions.md +505 -0
  118. package/docs/documentation/subscriptions/meta.json +9 -0
  119. package/docs/documentation/subscriptions/plan-grants.md +132 -0
  120. package/docs/documentation/subscriptions/upgrade-and-downgrade-plans.md +35 -0
  121. package/docs/documentation/testing-sandbox.md +251 -0
  122. package/docs/documentation/usage/ai-token-billing.md +294 -0
  123. package/docs/documentation/usage/meta.json +10 -0
  124. package/docs/documentation/usage/quota-management.md +341 -0
  125. package/docs/documentation/usage/seat-management.md +377 -0
  126. package/docs/documentation/usage/track-usage.md +282 -0
  127. package/docs/errors/addon_already_active.md +22 -0
  128. package/docs/errors/addon_has_activations.md +22 -0
  129. package/docs/errors/addon_not_active.md +22 -0
  130. package/docs/errors/addon_not_found.md +22 -0
  131. package/docs/errors/already_has_active_subscription.md +22 -0
  132. package/docs/errors/already_scheduled.md +22 -0
  133. package/docs/errors/api_key_not_found.md +22 -0
  134. package/docs/errors/card_promotions_not_available.md +22 -0
  135. package/docs/errors/charge_failed.md +22 -0
  136. package/docs/errors/charge_in_progress.md +22 -0
  137. package/docs/errors/claim_not_pending.md +22 -0
  138. package/docs/errors/credit_pack_not_found.md +22 -0
  139. package/docs/errors/customer_not_found.md +22 -0
  140. package/docs/errors/duplicate.md +22 -0
  141. package/docs/errors/endpoint_deprecated.md +22 -0
  142. package/docs/errors/endpoint_not_available.md +22 -0
  143. package/docs/errors/feature_already_exists.md +22 -0
  144. package/docs/errors/feature_disabled.md +22 -0
  145. package/docs/errors/feature_in_use.md +22 -0
  146. package/docs/errors/feature_not_found.md +22 -0
  147. package/docs/errors/feature_not_in_plan.md +22 -0
  148. package/docs/errors/forbidden.md +22 -0
  149. package/docs/errors/free_plan_change_not_supported.md +22 -0
  150. package/docs/errors/idempotency_in_progress.md +22 -0
  151. package/docs/errors/idempotency_key_mismatch.md +22 -0
  152. package/docs/errors/idempotency_unavailable.md +22 -0
  153. package/docs/errors/included_limit_reached.md +22 -0
  154. package/docs/errors/index.md +89 -0
  155. package/docs/errors/insufficient_balance.md +22 -0
  156. package/docs/errors/insufficient_credits.md +22 -0
  157. package/docs/errors/insufficient_seats.md +22 -0
  158. package/docs/errors/internal_error.md +22 -0
  159. package/docs/errors/invalid_json.md +22 -0
  160. package/docs/errors/invalid_subscription_status.md +22 -0
  161. package/docs/errors/invoice_not_found.md +22 -0
  162. package/docs/errors/market_group_in_use.md +22 -0
  163. package/docs/errors/market_group_not_found.md +22 -0
  164. package/docs/errors/market_in_use.md +22 -0
  165. package/docs/errors/market_not_found.md +22 -0
  166. package/docs/errors/missing_regional_price.md +22 -0
  167. package/docs/errors/model_not_found.md +22 -0
  168. package/docs/errors/no_active_subscription.md +22 -0
  169. package/docs/errors/no_change_requested.md +22 -0
  170. package/docs/errors/no_outstanding_invoice.md +22 -0
  171. package/docs/errors/no_payment_method.md +22 -0
  172. package/docs/errors/no_prices_configured.md +22 -0
  173. package/docs/errors/not_found.md +22 -0
  174. package/docs/errors/not_scheduled_for_cancellation.md +22 -0
  175. package/docs/errors/offer_not_applicable.md +22 -0
  176. package/docs/errors/offer_not_found.md +22 -0
  177. package/docs/errors/one_time_subscription_not_cancelable.md +22 -0
  178. package/docs/errors/organization_already_claimed.md +22 -0
  179. package/docs/errors/payment_failed.md +22 -0
  180. package/docs/errors/payment_method_not_found.md +22 -0
  181. package/docs/errors/payment_not_cancelable.md +22 -0
  182. package/docs/errors/payment_not_found.md +22 -0
  183. package/docs/errors/payouts_not_available_in_sandbox.md +22 -0
  184. package/docs/errors/plan_change_scheduled.md +22 -0
  185. package/docs/errors/plan_group_not_found.md +22 -0
  186. package/docs/errors/plan_not_found.md +22 -0
  187. package/docs/errors/plan_unavailable.md +22 -0
  188. package/docs/errors/plans_not_in_same_group.md +22 -0
  189. package/docs/errors/price_in_use.md +22 -0
  190. package/docs/errors/price_not_found.md +22 -0
  191. package/docs/errors/pricing_mode_mismatch.md +22 -0
  192. package/docs/errors/promo_code_expired.md +22 -0
  193. package/docs/errors/promo_code_not_found.md +22 -0
  194. package/docs/errors/provider_unsupported.md +22 -0
  195. package/docs/errors/rate_limited.md +22 -0
  196. package/docs/errors/sandbox_only.md +22 -0
  197. package/docs/errors/seat_limit_exceeded.md +22 -0
  198. package/docs/errors/subscription_activation_failed.md +22 -0
  199. package/docs/errors/subscription_already_canceled.md +22 -0
  200. package/docs/errors/subscription_cancel_failed.md +22 -0
  201. package/docs/errors/subscription_creation_failed.md +22 -0
  202. package/docs/errors/subscription_has_open_dispute.md +22 -0
  203. package/docs/errors/subscription_not_active.md +22 -0
  204. package/docs/errors/subscription_not_found.md +22 -0
  205. package/docs/errors/subscription_required.md +22 -0
  206. package/docs/errors/subscription_uncancel_failed.md +22 -0
  207. package/docs/errors/transaction_not_found.md +22 -0
  208. package/docs/errors/unauthorized.md +22 -0
  209. package/docs/errors/validation_error.md +22 -0
  210. package/docs/errors/webhook_not_found.md +22 -0
  211. package/docs/errors.md +34 -0
  212. package/docs/getting-started.md +35 -0
  213. package/docs/knowledge-base/how-do-balance-and-top-ups-work.md +22 -0
  214. package/docs/knowledge-base/how-do-credits-credit-packs-and-customer-credits-differ.md +20 -0
  215. package/docs/knowledge-base/how-do-discounts-work.md +65 -0
  216. package/docs/knowledge-base/how-do-free-plans-work-without-payment.md +88 -0
  217. package/docs/knowledge-base/how-do-monthly-quarterly-and-yearly-billing-work.md +77 -0
  218. package/docs/knowledge-base/how-do-offers-promo-codes-and-card-promotions-work-together.md +20 -0
  219. package/docs/knowledge-base/how-do-trial-periods-work.md +54 -0
  220. package/docs/knowledge-base/how-does-billing-work.md +73 -0
  221. package/docs/knowledge-base/how-does-payment-routing-work.md +17 -0
  222. package/docs/knowledge-base/how-does-quota-based-billing-work.md +106 -0
  223. package/docs/knowledge-base/how-does-seat-based-billing-work.md +88 -0
  224. package/docs/knowledge-base/how-is-proration-calculated-when-changing-plans.md +89 -0
  225. package/docs/knowledge-base/meta.json +29 -0
  226. package/docs/knowledge-base/what-happens-when-a-customer-changes-plans.md +110 -0
  227. package/docs/knowledge-base/what-happens-when-a-payment-fails.md +40 -0
  228. package/docs/knowledge-base/what-happens-when-you-change-your-prices.md +74 -0
  229. package/docs/knowledge-base/what-happens-when-you-refund-or-retry-a-transaction.md +21 -0
  230. package/docs/knowledge-base/what-invoices-do-customers-receive-and-when.md +101 -0
  231. package/docs/manifest.json +1677 -0
  232. package/docs/meta.json +11 -0
  233. package/docs/platform-documentation.md +175 -0
  234. package/docs/schemas.md +995 -0
  235. package/docs/webhooks/addon-activated.md +44 -0
  236. package/docs/webhooks/addon-deactivated.md +40 -0
  237. package/docs/webhooks/balance-depleted.md +37 -0
  238. package/docs/webhooks/balance-low.md +39 -0
  239. package/docs/webhooks/balance-topped-up.md +41 -0
  240. package/docs/webhooks/checkout-ready.md +43 -0
  241. package/docs/webhooks/credits-depleted.md +35 -0
  242. package/docs/webhooks/credits-expired.md +35 -0
  243. package/docs/webhooks/credits-granted.md +37 -0
  244. package/docs/webhooks/credits-low.md +39 -0
  245. package/docs/webhooks/credits-purchased.md +41 -0
  246. package/docs/webhooks/customer-created.md +49 -0
  247. package/docs/webhooks/customer-state-changed.md +134 -0
  248. package/docs/webhooks/customer-updated.md +49 -0
  249. package/docs/webhooks/introduction.md +499 -0
  250. package/docs/webhooks/invoice-created.md +45 -0
  251. package/docs/webhooks/invoice-overdue.md +53 -0
  252. package/docs/webhooks/invoice-upcoming.md +43 -0
  253. package/docs/webhooks/invoice-voided.md +53 -0
  254. package/docs/webhooks/meta.json +78 -0
  255. package/docs/webhooks/payment-dispute-resolved.md +52 -0
  256. package/docs/webhooks/payment-disputed.md +49 -0
  257. package/docs/webhooks/payment-failed.md +37 -0
  258. package/docs/webhooks/payment-link-canceled.md +41 -0
  259. package/docs/webhooks/payment-link-completed.md +47 -0
  260. package/docs/webhooks/payment-link-created.md +41 -0
  261. package/docs/webhooks/payment-link-failed.md +45 -0
  262. package/docs/webhooks/payment-method-attached.md +40 -0
  263. package/docs/webhooks/payment-method-updated.md +38 -0
  264. package/docs/webhooks/payment-received.md +45 -0
  265. package/docs/webhooks/payment-recovered.md +39 -0
  266. package/docs/webhooks/payment-refunded.md +47 -0
  267. package/docs/webhooks/payment-retry-failed.md +39 -0
  268. package/docs/webhooks/payout-available.md +33 -0
  269. package/docs/webhooks/payout-created.md +48 -0
  270. package/docs/webhooks/payout-failed.md +52 -0
  271. package/docs/webhooks/payout-paid.md +48 -0
  272. package/docs/webhooks/quota-exceeded.md +44 -0
  273. package/docs/webhooks/quota-threshold-reached.md +41 -0
  274. package/docs/webhooks/seats-limit-reached.md +39 -0
  275. package/docs/webhooks/seats-updated.md +39 -0
  276. package/docs/webhooks/subscription-activated.md +43 -0
  277. package/docs/webhooks/subscription-canceled.md +57 -0
  278. package/docs/webhooks/subscription-cancellation-revoked.md +37 -0
  279. package/docs/webhooks/subscription-cancellation-scheduled.md +45 -0
  280. package/docs/webhooks/subscription-created.md +35 -0
  281. package/docs/webhooks/subscription-past-due.md +43 -0
  282. package/docs/webhooks/subscription-plan-change-revoked.md +50 -0
  283. package/docs/webhooks/subscription-plan-change-scheduled.md +55 -0
  284. package/docs/webhooks/subscription-plan-changed.md +43 -0
  285. package/docs/webhooks/subscription-reactivated.md +53 -0
  286. package/docs/webhooks/subscription-updated.md +39 -0
  287. package/docs/webhooks/trial-checkout-ready.md +39 -0
  288. package/docs/webhooks/trial-converted.md +39 -0
  289. package/docs/webhooks/trial-expired.md +39 -0
  290. package/docs/webhooks/trial-started.md +46 -0
  291. package/docs/webhooks/trial-will-end.md +41 -0
  292. package/docs/webhooks/usage-recorded.md +41 -0
  293. package/docs/webhooks.md +782 -0
  294. package/package.json +2 -1
@@ -0,0 +1,239 @@
1
+ ---
2
+ lastModified: 2026-07-31
3
+ title: Error Handling
4
+ description: Handle errors with automatic retries and typed error classes
5
+ ---
6
+
7
+ ## Error Classes
8
+
9
+ ### TypeScript
10
+
11
+ ```typescript
12
+ import { CommetAPIError, CommetValidationError } from '@commet/node'
13
+
14
+ try {
15
+ await commet.customers.create({ email: 'invalid' })
16
+ } catch (error) {
17
+ if (error instanceof CommetValidationError) {
18
+ console.log(error.validationErrors)
19
+ // { email: ['Invalid email format'] }
20
+ }
21
+
22
+ if (error instanceof CommetAPIError) {
23
+ console.log(error.statusCode, error.message)
24
+ }
25
+ }
26
+ ```
27
+
28
+ ### Python
29
+
30
+ ```python
31
+ from commet import CommetAPIError, CommetValidationError
32
+
33
+ try:
34
+ commet.customers.create(email='invalid')
35
+ except CommetValidationError as e:
36
+ print(e.validation_errors)
37
+ # { 'email': ['Invalid email format'] }
38
+ except CommetAPIError as e:
39
+ print(e.status_code, e)
40
+ ```
41
+
42
+ ### Go
43
+
44
+ ```go
45
+ import (
46
+ "errors"
47
+
48
+ "github.com/commet-labs/commet-go/v9"
49
+ )
50
+
51
+ _, err := client.Customers.Create(ctx, &commet.CreateCustomerParams{Email: "invalid"})
52
+ if err != nil {
53
+ var validationErr *commet.ValidationError
54
+ if errors.As(err, &validationErr) {
55
+ fmt.Println(validationErr.ValidationErrors)
56
+ // map[email:[Invalid email format]]
57
+ }
58
+
59
+ var apiErr *commet.CommetError
60
+ if errors.As(err, &apiErr) {
61
+ fmt.Println(apiErr.StatusCode, apiErr.Message)
62
+ }
63
+ }
64
+ ```
65
+
66
+ ### Java
67
+
68
+ ```java
69
+ import co.commet.CommetApiException;
70
+ import co.commet.CommetValidationException;
71
+ import co.commet.params.CreateCustomerParams;
72
+
73
+ try {
74
+ commet.customers().create(CreateCustomerParams.builder("invalid").build());
75
+ } catch (CommetValidationException e) {
76
+ System.out.println(e.getValidationErrors());
77
+ // { email: [Invalid email format] }
78
+ } catch (CommetApiException e) {
79
+ System.out.println(e.getStatusCode() + " " + e.getMessage());
80
+ }
81
+ ```
82
+
83
+ ### PHP
84
+
85
+ ```php
86
+ use Commet\Exceptions\ApiException;
87
+ use Commet\Exceptions\ValidationException;
88
+
89
+ try {
90
+ $commet->customers->create(email: 'invalid');
91
+ } catch (ValidationException $e) {
92
+ print_r($e->validationErrors);
93
+ // [ 'email' => ['Invalid email format'] ]
94
+ } catch (ApiException $e) {
95
+ echo $e->getStatusCode() . ' ' . $e->getMessage();
96
+ }
97
+ ```
98
+
99
+ | Class | Use case |
100
+ | ----------------------------------------------------------------------------- | -------------------------------- |
101
+ | `CommetAPIError` / `CommetApiException` / `ApiException` | HTTP errors (4xx, 5xx) |
102
+ | `CommetValidationError` / `CommetValidationException` / `ValidationException` | Invalid input with field details |
103
+ | `CommetError` / `CommetException` | Base class for all errors |
104
+
105
+ Go exposes `*commet.CommetError` and `*commet.ValidationError` as concrete types — check them with `errors.As`.
106
+
107
+ ## Error Code Reference
108
+
109
+ Every current API error includes a stable `code` and a version-matched `doc_url` such as [`customer_not_found`](/docs/api-reference/2026-07-31/errors/customer_not_found.md). The URL returns a dedicated English Markdown reference with handling and retry guidance for the resolved API version.
110
+
111
+ Keep the `x-request-id` response header when logging or reporting an error. Commet records the same identifier in Platform, allowing the request to be correlated without including credentials or customer data.
112
+
113
+ ## Automatic Retries
114
+
115
+ Failed requests retry with exponential backoff (1s → 2s → 4s, max 8s).
116
+
117
+ **Retryable:** 408, 429, 500, 502, 503, 504
118
+
119
+ Rate limits are the exception to the backoff: a 429 is retried only when the response carries a `Retry-After` header, and the client waits exactly that value (capped at 30s) instead of backing off. A 429 without `Retry-After` is not retried.
120
+
121
+ ### TypeScript
122
+
123
+ ```typescript
124
+ const commet = new Commet({
125
+ apiKey: process.env.COMMET_API_KEY!,
126
+ retries: 3, // default
127
+ })
128
+ ```
129
+
130
+ ### Python
131
+
132
+ ```python
133
+ commet = Commet(
134
+ api_key=os.environ['COMMET_API_KEY'],
135
+ retries=3, # default
136
+ )
137
+ ```
138
+
139
+ ### Go
140
+
141
+ ```go
142
+ client, err := commet.New(
143
+ os.Getenv("COMMET_API_KEY"),
144
+ commet.WithRetries(3), // default
145
+ )
146
+ ```
147
+
148
+ ### Java
149
+
150
+ ```java
151
+ Commet commet = Commet.builder()
152
+ .apiKey(System.getenv("COMMET_API_KEY"))
153
+ .retries(3) // default
154
+ .build();
155
+ ```
156
+
157
+ ### PHP
158
+
159
+ ```php
160
+ $commet = new Commet(
161
+ apiKey: getenv('COMMET_API_KEY'),
162
+ retries: 3, // default
163
+ );
164
+ ```
165
+
166
+ ## Non-Blocking Usage
167
+
168
+ Don't let tracking errors break your app:
169
+
170
+ ### TypeScript
171
+
172
+ ```typescript
173
+ commet.usage.track({
174
+ customerId: 'user_123',
175
+ featureCode: 'api_calls',
176
+ }).catch(console.error)
177
+
178
+ // Continue without waiting
179
+ ```
180
+
181
+ ### Python
182
+
183
+ ```python
184
+ try:
185
+ commet.usage.track(customer_id='user_123', feature_code='api_calls')
186
+ except Exception as e:
187
+ logger.error(e)
188
+
189
+ # Continue without waiting
190
+ ```
191
+
192
+ ### Go
193
+
194
+ ```go
195
+ go func() {
196
+ _, err := client.Usage.Track(context.Background(), &commet.TrackUsageParams{
197
+ CustomerID: "user_123",
198
+ FeatureCode: "api_calls",
199
+ })
200
+ if err != nil {
201
+ log.Printf("track failed: %v", err)
202
+ }
203
+ }()
204
+
205
+ // Continue without waiting
206
+ ```
207
+
208
+ ### Java
209
+
210
+ ```java
211
+ CompletableFuture.runAsync(() -> {
212
+ try {
213
+ commet.usage().track(
214
+ TrackUsageParams.builder("api_calls", "user_123")
215
+ .customerId("user_123")
216
+ .build()
217
+ );
218
+ } catch (Exception e) {
219
+ log.error("track failed", e);
220
+ }
221
+ });
222
+
223
+ // Continue without waiting
224
+ ```
225
+
226
+ ### PHP
227
+
228
+ ```php
229
+ try {
230
+ $commet->usage->track(
231
+ customerId: 'user_123',
232
+ featureCode: 'api_calls',
233
+ );
234
+ } catch (\Throwable $e) {
235
+ error_log($e->getMessage());
236
+ }
237
+
238
+ // Continue without waiting
239
+ ```
@@ -0,0 +1,37 @@
1
+ ---
2
+ lastModified: 2026-08-16
3
+ title: Examples
4
+ description: Explore complete applications for the main Commet billing models and lifecycle patterns.
5
+ ---
6
+
7
+ The examples are runnable applications, not isolated API snippets. Each one shows how product state, Commet configuration, server actions, and customer access work together.
8
+
9
+ ## Billing models
10
+
11
+ | Example | What it demonstrates |
12
+ | --------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
13
+ | [Fixed subscription](https://github.com/commet-labs/commet/tree/main/examples/fixed) | A recurring plan, checkout, and subscription-backed access |
14
+ | [Metered usage](https://github.com/commet-labs/commet/tree/main/examples/metered) | Included usage, event tracking, and overage |
15
+ | [Credits](https://github.com/commet-labs/commet/tree/main/examples/credits) | Recurring credits and credit-aware product actions |
16
+ | [Fixed balance](https://github.com/commet-labs/commet/tree/main/examples/balance-fixed) | Prepaid monetary balance and top-ups |
17
+ | [AI balance](https://github.com/commet-labs/commet/tree/main/examples/balance-ai) | AI token costs charged against a balance |
18
+ | [Seats](https://github.com/commet-labs/commet/tree/main/examples/seats) | Team membership synchronized with seat quantities |
19
+ | [Quota](https://github.com/commet-labs/commet/tree/main/examples/quota) | Capacity checks and quota mutations |
20
+
21
+ ## Lifecycle
22
+
23
+ The [webhooks example](https://github.com/commet-labs/commet/tree/main/examples/webhooks) shows subscription activation, past-due recovery, cancellation, signed event handling, and UI derived from confirmed billing state.
24
+
25
+ ## Run an example
26
+
27
+ Clone the repository, open one example directory, copy `.env.example`, and use a sandbox API key. Keep the example's database and Commet organization disposable; Test Clock operations and fixture cards are sandbox-only.
28
+
29
+ ```bash
30
+ git clone https://github.com/commet-labs/commet.git
31
+ cd commet/examples/metered
32
+ cp .env.example .env
33
+ pnpm install
34
+ pnpm dev
35
+ ```
36
+
37
+ Read the example together with the relevant conceptual guide. The source shows one implementation; [How Billing Works](/docs/how-does-billing-work) defines the rules that remain true across frameworks.
@@ -0,0 +1,145 @@
1
+ ---
2
+ lastModified: 2026-08-13
3
+ title: Acceptable Use Policy
4
+ description: What products and services can be sold through Commet.
5
+ ---
6
+
7
+ Commet acts as Merchant of Record for transactions processed through Commet-managed payment connections. This policy defines which products we can support on that payment rail. Customer-owned payment connections remain subject to their provider's own rules and do not make a product eligible for Commet-managed processing.
8
+
9
+ > **Note**
10
+ >
11
+ > **Have questions about your specific use case?** [Contact our support team](mailto:help@commet.co) before starting your integration.
12
+
13
+ ## Basic eligibility requirements
14
+
15
+ Every product sold through Commet-managed processing must:
16
+
17
+ 1. Be lawful, transparent, and consistent with payment-provider requirements
18
+ 2. Be sold directly by the business that owns or holds the rights required to distribute it
19
+ 3. Be a working digital product delivered automatically or with minimal human involvement
20
+ 4. Match the product, pricing, ownership, and fulfillment described in the merchant's submission and website
21
+
22
+ Ordinary customer support does not make an automated digital product a human-delivered service.
23
+
24
+ ## Allowed categories
25
+
26
+ ### Software, SaaS, and automated digital services
27
+
28
+ Mobile apps, desktop software, SaaS, AIaaS, developer tools, hosting, analytics, dashboards, website information services, and other electronically supplied services are allowed when the product is standardized and automatically delivered.
29
+
30
+ This includes SEO and marketing software for analytics, diagnostics, content planning, approval, or scheduled publishing. Serving a financial, medical, or other regulated industry does not by itself turn software into the regulated activity. The software must not perform any prohibited activity listed below.
31
+
32
+ ### Digital content and downloads
33
+
34
+ Code repositories, templates, eBooks, PDFs, magazines, newsletters, icons, fonts, design resources, photos, videos, audio files, video games, and owned digital directories or information databases are allowed when the seller holds the necessary rights.
35
+
36
+ ### Premium access and self-service education
37
+
38
+ Subscription content, gated digital experiences, private repositories, community access, and self-service online courses are allowed when access and fulfillment are automated. Live one-to-one coaching and instructor-delivered services are not included.
39
+
40
+ ## Categories requiring manual review
41
+
42
+ These categories are not confirmed policy violations. They require a person to verify the identified fact before approval.
43
+
44
+ ### Pre-orders and paid waitlists
45
+
46
+ Pre-orders and paid waitlists require evidence of a defined digital product, delivery schedule, refund terms, and a credible history or plan for fulfillment.
47
+
48
+ ### Unclear or incomplete business evidence
49
+
50
+ A business requires review when its submission and available website evidence do not establish what the customer buys, who owns it, whether fulfillment is automated, or whether the website describes the same offering. A collection problem alone is not a reason to deny the business.
51
+
52
+ ## Products and business models Commet does not support
53
+
54
+ The categories below cannot use Commet-managed processing. Some are lawful businesses that fall outside our Merchant of Record product; others are prohibited by payment-provider, network, legal, or risk requirements.
55
+
56
+ ### Physical goods, professional services, and live events
57
+
58
+ - Physical goods or anything requiring shipping or physical fulfillment
59
+ - Human-delivered professional services, including consulting, accounting, tax preparation, marketing, design, development, managed services, or tech support
60
+ - Live one-to-one coaching, instructor-delivered services, staffing, or recruitment services
61
+ - Tickets or access to live in-person events
62
+
63
+ Software used by professionals remains allowed when the customer buys the software rather than the professional's work.
64
+
65
+ ### Marketplaces, third-party sales, and advertising inventory
66
+
67
+ - Marketplaces, job boards, or creator platforms that collect payment for third-party sellers, workers, or creators
68
+ - Unauthorized resale or distribution, including software licenses and third-party game items or virtual currency
69
+ - Advertising placements sold in websites, email, or social media
70
+ - Payment facilitation, aggregation, or receiving settlement proceeds for products or services supplied by another merchant
71
+
72
+ ### Travel, donations, fundraising, dating, and file sharing
73
+
74
+ - Travel reservations, travel clubs, timeshares, charter travel, airlines, or cruises
75
+ - Donations, charitable contributions, fundraising, crowdfunding, raffles, or sweepstakes
76
+ - Dating and matchmaking platforms
77
+ - Cyberlockers and file-sharing services
78
+
79
+ ### Financial products, cryptocurrency, and stored value
80
+
81
+ - Investment strategies, trading signals, wealth management, tax advice sold as a service, brokerage, funded prop trading, or trading services
82
+ - Lending, bank-account funding, money transmission, remittances, currency exchange, escrow, neobanks, custody, or transaction facilitation
83
+ - Cryptocurrency exchanges, wallets, mining, staking, ICOs, NFT products, or secondary NFT sales
84
+ - Third-party gift cards, prepaid cards, monetary credits, stored value, or game currency
85
+
86
+ Software that only analyzes information or provides operational tools does not become a financial service unless it executes, controls, intermediates, or advises on the regulated activity. Credits usable only for the seller's own software are not third-party stored value.
87
+
88
+ ### Regulated and age-restricted products or services
89
+
90
+ - Gambling, betting, lotteries, or wagering
91
+ - Weapons, firearms, or regulated weapon components
92
+ - Alcohol, tobacco, vaping products, cannabis, CBD, or illegal drugs
93
+ - Pharmaceuticals, online pharmacies, prescription products, regulated medical devices, telemedicine, unsafe nutraceuticals, medical advice, or weight-loss products making medical claims
94
+ - Any product or service requiring a license or regulatory approval that the business cannot document or that our provider does not support
95
+
96
+ ### Unsolicited marketing, deceptive engagement, and data abuse
97
+
98
+ - Automated unsolicited outreach or telemarketing
99
+ - Bulk SMS, WhatsApp, email, or other messaging that risks spam
100
+ - Automated mass submission, fake engagement, fake reviews, or traffic sales
101
+ - Selling, distributing, or scraping personal contact data without authorization
102
+ - Services that undermine user privacy or data security
103
+
104
+ Generating content, analyzing marketing data, or scheduling approved posts is not prohibited by itself.
105
+
106
+ ### Deceptive, abusive, or nonfunctional products
107
+
108
+ - Pyramid schemes, multi-level marketing, or get-rich-quick schemes
109
+ - Misleading identity, pricing, trial, testimonial, fulfillment, or earnings claims
110
+ - High-pressure or predatory sales practices
111
+ - Products that are nonfunctional, cannot deliver what is sold, or provide no meaningful value
112
+ - Document falsification, card testing, chargeback evasion, or transactions without a real product or service
113
+
114
+ ### Illegal activity and intellectual-property violations
115
+
116
+ - Products or services that violate laws in the business's jurisdiction or target markets
117
+ - Counterfeit goods or infringement of copyright, trademarks, patents, privacy, or other third-party rights
118
+ - Products the seller does not own or have permission to distribute
119
+ - Services designed to breach or bypass another platform's rules
120
+ - Products or services that exploit, endanger, or unlawfully target minors
121
+
122
+ ### Adult content and sexually oriented services
123
+
124
+ - Pornography or sexually explicit media designed for sexual gratification, including AI-generated content meeting those criteria
125
+ - Prostitution, escorts, sexual live chat, fetish services, or platforms primarily selling that content or those services
126
+
127
+ Viewer ratings, mature themes, romance, adult situations, or genre labels do not establish prohibited adult content by themselves.
128
+
129
+ ### Malware, evasion tools, and unauthorized media
130
+
131
+ - Malware, spyware, viruses, suspicious remote-support tools, or privacy-invasive monitoring software
132
+ - Cheating tools, hacks, ban-bypass tools, IP or API cloaking, or services designed to evade enforcement
133
+ - IPTV or unauthorized streaming services
134
+ - eSIM or telecommunication services
135
+
136
+ ## Provider requirements
137
+
138
+ This policy incorporates applicable payment-provider requirements, including [Stripe's prohibited and restricted businesses](https://stripe.com/legal/restricted-businesses) and [dLocal's restricted and prohibited activities](https://www.dlocal.com/legal/terms-and-conditions/). Provider approval for a restricted category must be documented in writing; an internal Commet approval cannot replace it.
139
+
140
+ The lists above are representative rather than exhaustive. Commet may review, suspend, or stop processing when new evidence shows illegal, misleading, unsupported, or materially different activity.
141
+
142
+ ## Related
143
+
144
+ - [Merchant of Record](/docs/merchant-of-record) — How Commet handles taxes and compliance as your MoR
145
+ - [Finance Overview](/docs/finance-overview) — Balances, payouts, and transaction history
@@ -0,0 +1,32 @@
1
+ ---
2
+ lastModified: 2026-07-10
3
+ title: Finance Overview
4
+ description: How money flows through Commet — balances, payouts, and transaction history.
5
+ ---
6
+
7
+ The finance module tracks how money flows from customer payments to your bank account — balance tracking, payouts, and a complete transaction history.
8
+
9
+ ## Balance states
10
+
11
+ The Payouts page shows your money in three states.
12
+
13
+ | State | Description | Example |
14
+ | ----------------- | ------------------------------- | --------------------------- |
15
+ | **Available** | Ready to withdraw | $3,400 available for payout |
16
+ | **Pending** | Transactions still processing | $1,200 clearing |
17
+ | **Total payouts** | Total sent to your bank account | $10,000 paid out to date |
18
+
19
+ ## Payouts
20
+
21
+ A [payout](/docs/payouts) sends your available balance to your bank account. Account verification is required before your first one.
22
+
23
+ Once verified, request payouts of $10 or more. Money reaches your bank account in up to 7 business days.
24
+
25
+ ## Transaction history
26
+
27
+ Every payment, payout, and status change is recorded as a transaction. Use the finance dashboard to view incoming payments from subscriptions and credit purchases, outgoing payouts, and real-time status updates.
28
+
29
+ ## Related
30
+
31
+ - [Account Verification](/docs/payouts-verification) — Get verified to withdraw money
32
+ - [Merchant of Record](/docs/merchant-of-record) — How Commet handles taxes and compliance
@@ -0,0 +1,40 @@
1
+ ---
2
+ lastModified: 2026-07-16
3
+ title: Local Currency Taxes
4
+ description: Banks in some countries add taxes or surcharges on top of local currency payments. What they are, where they apply, and how to handle customer questions.
5
+ ---
6
+
7
+ When customers pay in their local currency, their bank or card issuer may add country-specific taxes or surcharges on top of the amount Commet charges. These charges are collected by the customer's bank on behalf of local tax authorities — Commet does not apply them, does not receive them, and cannot refund them.
8
+
9
+ ## Why this happens
10
+
11
+ Commet acts as the [Merchant of Record](/docs/merchant-of-record), so even when a customer pays in their own currency, the transaction may be processed as a cross-border purchase from a foreign merchant. Some countries require card issuers to collect taxes or tax perceptions on these transactions at the moment of payment.
12
+
13
+ The result: the total on the customer's bank statement can be higher than the price shown at checkout. The tax appears as a separate line item charged by the bank, not as part of the Commet charge.
14
+
15
+ ## Where it applies
16
+
17
+ | Country | What customers may see |
18
+ | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
19
+ | **Argentina** | Tax perceptions on cross-border card payments, historically up to 30% (e.g. "impuesto PAÍS" and income tax perceptions), applied by the card issuer |
20
+ | **Other countries** | Cross-border transaction fees or local tax withholdings, depending on the customer's bank and local regulation |
21
+
22
+ Rates and rules change frequently and vary by bank, card type, and local regulation. The customer's bank determines the final amount.
23
+
24
+ > **Note**
25
+ >
26
+ > These charges apply per transaction and are independent of the currency configured in your plan. Paying in local currency does not by itself exempt the customer from cross-border taxes.
27
+
28
+ ## What this means for your customers
29
+
30
+ - **It is not a duplicate charge.** The Commet charge and the bank's tax perception are separate line items on the statement.
31
+ - **Commet invoices show only the price you configured.** Bank-applied taxes never appear on the Commet invoice or receipt.
32
+ - **Refunds don't include bank taxes.** If you refund a payment, Commet returns the amount it charged. Tax perceptions are refunded (or credited) by the customer's bank or tax authority under local rules.
33
+
34
+ If a customer asks about an unexpected extra charge, direct them to their card issuer — the bank can confirm which tax was applied and how to claim it back where local rules allow it.
35
+
36
+ ## Related
37
+
38
+ - [Regional Prices](/docs/regional-prices) — Let customers pay in their own currency
39
+ - [Merchant of Record](/docs/merchant-of-record) — How Commet handles taxes and compliance on your behalf
40
+ - [Supported Countries](/docs/supported-countries) — Where Commet operates
@@ -0,0 +1,48 @@
1
+ ---
2
+ lastModified: 2026-07-10
3
+ title: Merchant of Record
4
+ description: What a Merchant of Record is and how Commet handles taxes, compliance, refunds, and payouts on your behalf.
5
+ ---
6
+
7
+ A Merchant of Record (MoR) is the legal entity that sells your product to the end customer. Commet acts as the MoR, taking responsibility for global sales taxes, refunds, disputes, and compliance so you can focus on building your product.
8
+
9
+ ## PSP vs MoR
10
+
11
+ | Aspect | PSP (e.g. Stripe) | MoR (e.g. Commet) |
12
+ | ------------------ | ------------------------------ | ----------------------- |
13
+ | Tax handling | You handle it | Platform handles it |
14
+ | Refunds & disputes | You handle it | Platform handles it |
15
+ | API complexity | Low-level, flexible | High-level, opinionated |
16
+ | Fees | Lower per transaction | Higher per transaction |
17
+ | Control | Full control over payment flow | Managed payment flow |
18
+
19
+ ## What should you choose
20
+
21
+ **Choose a PSP if** you're already integrated with Stripe, comfortable handling international taxes yourself, or want full control over your payment flow.
22
+
23
+ **Choose Commet if** you want to go live today without worrying about tax registrations, need a billing tool your whole team can use, or want subscription and pricing management built in.
24
+
25
+ ## When Commet is the MoR
26
+
27
+ Commet is the Merchant of Record when you run on Commet's payment rail — the default. If you connect your own Stripe or dLocal account instead, you remain the merchant and Commet acts as your billing layer on top.
28
+
29
+ ## Use Commet alongside your PSPs
30
+
31
+ You can use both rails in the same organization. Commet is the MoR for countries routed to the Commet provider. Countries routed to your connected Stripe or dLocal account are charged through that provider, under your own merchant identity.
32
+
33
+ Commet decides which provider to use from the country route configured in **Settings → Payments**. If a checkout does not include a country, Commet uses the organization's default provider. Once a customer has a saved payment method or a subscription has been stamped with a connection, recurring charges continue through that provider so the payment method is not moved silently between accounts.
34
+
35
+ See [Payment Providers](/docs/payment-providers) to connect your accounts and [Payment Orchestration](/docs/payment-orchestration) to configure routing rules and defaults.
36
+
37
+ ## Our vision
38
+
39
+ We believe the best companies of the future will be small teams of 5 to 30 people. Technology enables small teams to build incredible products, but monetization complexity shouldn't be a barrier.
40
+
41
+ Commet exists to be the simplest, developer-preferred tool for monetization. We don't aim to solve every use case — we want to be the tool small teams choose when they want to monetize simply, globally, and without hassle.
42
+
43
+ ## Related
44
+
45
+ - [Finance Overview](/docs/finance-overview) — Balances, payouts, and transaction history
46
+ - [Acceptable Use Policy](/docs/acceptable-use) — What products and services can be sold through Commet
47
+ - [Supported Countries](/docs/supported-countries) — 112 countries where Commet operates
48
+ - [Payment Providers](/docs/payment-providers) — Connect Commet, Stripe, and dLocal payment rails
@@ -0,0 +1,13 @@
1
+ {
2
+ "title": "Finance",
3
+ "description": "Payouts, account verification, and Merchant of Record",
4
+ "pages": [
5
+ "finance-overview",
6
+ "payouts",
7
+ "payouts-verification",
8
+ "supported-countries",
9
+ "merchant-of-record",
10
+ "local-currency-taxes",
11
+ "acceptable-use"
12
+ ]
13
+ }