@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,136 @@
1
+ ---
2
+ lastModified: 2026-07-28
3
+ title: Integrate with Remix
4
+ description: Add billing and payments to your Remix application.
5
+ ---
6
+
7
+ Install the Commet Skill so your coding agent can integrate the current SDK and verify its work against the live API contract.
8
+
9
+ ```bash
10
+ npx skills add commet-labs/skills --skill commet
11
+ ```
12
+
13
+ 1. ## Install
14
+ ### pnpm
15
+ ```bash
16
+ pnpm add @commet/node @remix-run/node
17
+ ```
18
+ ### npm
19
+ ```bash
20
+ npm install @commet/node @remix-run/node
21
+ ```
22
+ ### yarn
23
+ ```bash
24
+ yarn add @commet/node @remix-run/node
25
+ ```
26
+ ### bun
27
+ ```bash
28
+ bun add @commet/node @remix-run/node
29
+ ```
30
+
31
+ 2. ## Configure
32
+ ```bash title=".env"
33
+ COMMET_API_KEY=ck_sandbox_xxx
34
+ ```
35
+ The `.server.ts` suffix ensures this module is never bundled into client code.
36
+ ```typescript title="app/lib/commet.server.ts"
37
+ import { Commet } from '@commet/node'
38
+
39
+ export const commet = new Commet({
40
+ apiKey: process.env.COMMET_API_KEY!,
41
+ })
42
+ ```
43
+
44
+ 3. ## Subscribe
45
+ `customers.create` is idempotent — if a customer with the same `id` already exists, it returns the existing record.
46
+ ```typescript title="app/routes/billing.subscribe.ts"
47
+ import { json, redirect, type ActionFunctionArgs } from '@remix-run/node'
48
+ import { commet } from '~/lib/commet.server'
49
+
50
+ export async function action({ request }: ActionFunctionArgs) {
51
+ const formData = await request.formData()
52
+ const customerId = String(formData.get('customerId'))
53
+ const email = String(formData.get('email'))
54
+
55
+ await commet.customers.create({ email, id: customerId })
56
+
57
+ const subscription = await commet.subscriptions.create({
58
+ customerId,
59
+ planCode: 'pro',
60
+ })
61
+
62
+ const checkoutUrl = subscription.checkoutUrl
63
+ if (checkoutUrl) {
64
+ return redirect(checkoutUrl)
65
+ }
66
+
67
+ return json({ subscribed: true })
68
+ }
69
+ ```
70
+
71
+ 4. ## Check Access
72
+ ```typescript title="app/routes/billing.status.ts"
73
+ import { json, type LoaderFunctionArgs } from '@remix-run/node'
74
+ import { commet } from '~/lib/commet.server'
75
+
76
+ export async function loader({ request }: LoaderFunctionArgs) {
77
+ const url = new URL(request.url)
78
+ const customerId = url.searchParams.get('customerId')!
79
+
80
+ const subscription = await commet.subscriptions.getActive({ customerId })
81
+
82
+ if (!subscription) {
83
+ return json({ error: 'no_active_subscription' }, { status: 404 })
84
+ }
85
+
86
+ const feature = await commet.featureAccess.get({
87
+ code: 'api_calls',
88
+ customerId,
89
+ })
90
+
91
+ return json({
92
+ status: subscription.status,
93
+ allowed: feature.allowed,
94
+ })
95
+ }
96
+ ```
97
+
98
+ 5. ## Track Usage
99
+ ```typescript title="app/routes/billing.usage.ts"
100
+ import { json, type ActionFunctionArgs } from '@remix-run/node'
101
+ import { commet } from '~/lib/commet.server'
102
+
103
+ export async function action({ request }: ActionFunctionArgs) {
104
+ const { customerId } = await request.json()
105
+
106
+ await commet.usage.track({
107
+ customerId,
108
+ featureCode: 'api_calls',
109
+ value: 1,
110
+ })
111
+
112
+ return json({ tracked: true })
113
+ }
114
+ ```
115
+ Usage is aggregated and billed at end of period.
116
+
117
+ 6. ## Customer Portal
118
+ ```typescript title="app/routes/billing.portal.ts"
119
+ import { redirect, type LoaderFunctionArgs } from '@remix-run/node'
120
+ import { commet } from '~/lib/commet.server'
121
+
122
+ export async function loader({ request }: LoaderFunctionArgs) {
123
+ const customerId = 'user_123'
124
+
125
+ const portal = await commet.portal.getUrl({ customerId })
126
+
127
+ return redirect(portal.portalUrl)
128
+ }
129
+ ```
130
+
131
+ ## Related
132
+
133
+ - [Subscriptions](/docs/manage-subscriptions)
134
+ - [Track Usage](/docs/track-usage)
135
+ - [Customer Portal](/docs/customer-portal)
136
+ - [SDK Reference](/docs/sdk-reference)
@@ -0,0 +1,127 @@
1
+ ---
2
+ lastModified: 2026-07-28
3
+ title: Integrate with SvelteKit
4
+ description: Add billing and payments to your SvelteKit application.
5
+ ---
6
+
7
+ Install the Commet Skill so your coding agent can integrate the current SDK and verify its work against the live API contract.
8
+
9
+ ```bash
10
+ npx skills add commet-labs/skills --skill commet
11
+ ```
12
+
13
+ 1. ## Install
14
+ ### pnpm
15
+ ```bash
16
+ pnpm add @commet/node
17
+ ```
18
+ ### npm
19
+ ```bash
20
+ npm install @commet/node
21
+ ```
22
+ ### yarn
23
+ ```bash
24
+ yarn add @commet/node
25
+ ```
26
+ ### bun
27
+ ```bash
28
+ bun add @commet/node
29
+ ```
30
+
31
+ 2. ## Configure
32
+ ```bash title=".env"
33
+ COMMET_API_KEY=ck_sandbox_xxx
34
+ ```
35
+ ```typescript title="src/lib/server/commet.ts"
36
+ import { Commet } from '@commet/node'
37
+ import { COMMET_API_KEY } from '$env/static/private'
38
+
39
+ export const commet = new Commet({
40
+ apiKey: COMMET_API_KEY,
41
+ })
42
+ ```
43
+
44
+ 3. ## Subscribe
45
+ `customers.create` is idempotent — if a customer with the same `id` already exists, it returns the existing record.
46
+ ```typescript title="src/routes/api/billing/subscribe/+server.ts"
47
+ import { json } from '@sveltejs/kit'
48
+ import { commet } from '$lib/server/commet'
49
+ import type { RequestHandler } from './$types'
50
+
51
+ export const POST: RequestHandler = async ({ request }) => {
52
+ const { customerId, email } = await request.json()
53
+
54
+ await commet.customers.create({ email, id: customerId })
55
+
56
+ const subscription = await commet.subscriptions.create({
57
+ customerId,
58
+ planCode: 'pro',
59
+ })
60
+
61
+ return json({ checkoutUrl: subscription.checkoutUrl ?? null })
62
+ }
63
+ ```
64
+
65
+ 4. ## Check Access
66
+ ```typescript title="src/routes/api/billing/access/[customerId]/+server.ts"
67
+ import { json } from '@sveltejs/kit'
68
+ import { commet } from '$lib/server/commet'
69
+ import type { RequestHandler } from './$types'
70
+
71
+ export const GET: RequestHandler = async ({ params }) => {
72
+ const subscription = await commet.subscriptions.getActive({ customerId: params.customerId })
73
+
74
+ if (!subscription) {
75
+ return json({ error: 'no_active_subscription' }, { status: 404 })
76
+ }
77
+
78
+ const feature = await commet.featureAccess.get({
79
+ code: 'api_calls',
80
+ customerId: params.customerId,
81
+ })
82
+
83
+ return json({ status: subscription.status, allowed: feature.allowed })
84
+ }
85
+ ```
86
+
87
+ 5. ## Track Usage
88
+ ```typescript title="src/routes/api/billing/usage/+server.ts"
89
+ import { json } from '@sveltejs/kit'
90
+ import { commet } from '$lib/server/commet'
91
+ import type { RequestHandler } from './$types'
92
+
93
+ export const POST: RequestHandler = async ({ request }) => {
94
+ const { customerId } = await request.json()
95
+
96
+ await commet.usage.track({
97
+ customerId,
98
+ featureCode: 'api_calls',
99
+ value: 1,
100
+ })
101
+
102
+ return json({ tracked: true })
103
+ }
104
+ ```
105
+ Usage is aggregated and billed at end of period.
106
+
107
+ 6. ## Customer Portal
108
+ ```typescript title="src/routes/api/billing/portal/+server.ts"
109
+ import { redirect } from '@sveltejs/kit'
110
+ import { commet } from '$lib/server/commet'
111
+ import type { RequestHandler } from './$types'
112
+
113
+ export const GET: RequestHandler = async ({ locals }) => {
114
+ const portal = await commet.portal.getUrl({
115
+ customerId: locals.user.customerId,
116
+ })
117
+
118
+ redirect(303, portal.portalUrl)
119
+ }
120
+ ```
121
+
122
+ ## Related
123
+
124
+ - [Subscriptions](/docs/manage-subscriptions)
125
+ - [Track Usage](/docs/track-usage)
126
+ - [Customer Portal](/docs/customer-portal)
127
+ - [SDK Reference](/docs/sdk-reference)
@@ -0,0 +1,14 @@
1
+ {
2
+ "title": "Node.js",
3
+ "description": "Integrate Commet with Node.js frameworks",
4
+ "pages": [
5
+ "integrate-with-nextjs",
6
+ "integrate-with-remix",
7
+ "integrate-with-nuxt",
8
+ "integrate-with-sveltekit",
9
+ "integrate-with-astro",
10
+ "integrate-with-express",
11
+ "integrate-with-hono",
12
+ "integrate-with-bun"
13
+ ]
14
+ }
@@ -0,0 +1,314 @@
1
+ ---
2
+ lastModified: 2026-07-28
3
+ title: Accept One-Time Payments
4
+ description: Charge customers once with the Commet payments resource — no subscription or plan required. Tax, invoice, and receipt handled automatically.
5
+ ---
6
+
7
+ A payment is a standalone one-time charge with no subscription or plan attached.
8
+
9
+ Commet calculates tax, generates an invoice, and sends a receipt on every payment automatically.
10
+
11
+ > **Note**
12
+ >
13
+ > For lifetime deals and one-off purchases billed as a **plan** (trials, intro offers, add-ons, consumption models), use [One-Time Plans](/docs/one-time-payments) instead.
14
+
15
+ ## Link vs. charge
16
+
17
+ There are two ways to take a one-time payment.
18
+
19
+ - **Link** (`payments.create`): builds a hosted payment link. The customer opens the `url` and pays with any card. Vaults the payment method on confirmation.
20
+ - **Charge** (`payments.charge`): bills a customer's already-vaulted payment method off-session. No customer interaction, no `url`.
21
+
22
+ ## Create a payment link
23
+
24
+ Returns a `Payment` with a `url`. Redirect the customer to it to collect payment.
25
+
26
+ ### TypeScript
27
+
28
+ ```typescript
29
+ const payment = await commet.payments.create({
30
+ amount: 25000,
31
+ currency: 'usd',
32
+ description: 'Annual report',
33
+ customerId: 'user_123',
34
+ successUrl: 'https://yourapp.com/thanks',
35
+ })
36
+
37
+ redirect(payment.url)
38
+ ```
39
+
40
+ ### Python
41
+
42
+ ```python
43
+ payment = commet.payments.create(
44
+ amount=25000,
45
+ currency='usd',
46
+ description='Annual report',
47
+ customer_id='user_123',
48
+ success_url='https://yourapp.com/thanks',
49
+ )
50
+
51
+ redirect(payment.url)
52
+ ```
53
+
54
+ ### Go
55
+
56
+ ```go
57
+ payment, err := client.Payments.Create(ctx, &commet.CreatePaymentParams{
58
+ Amount: 25000,
59
+ Currency: "usd",
60
+ Description: "Annual report",
61
+ CustomerID: "user_123",
62
+ SuccessURL: "https://yourapp.com/thanks",
63
+ })
64
+
65
+ // redirect(payment.URL)
66
+ ```
67
+
68
+ ### Java
69
+
70
+ ```java
71
+ CreatePaymentParams params = CreatePaymentParams.builder()
72
+ .amount(25000)
73
+ .currency("usd")
74
+ .description("Annual report")
75
+ .customerId("user_123")
76
+ .successUrl("https://yourapp.com/thanks")
77
+ .build();
78
+ var payment = commet.payments().create(params);
79
+
80
+ // redirect(payment.url())
81
+ ```
82
+
83
+ ### PHP
84
+
85
+ ```php
86
+ $result = $commet->payments->create(
87
+ amount: 25000,
88
+ currency: 'usd',
89
+ description: 'Annual report',
90
+ customerId: 'user_123',
91
+ successUrl: 'https://yourapp.com/thanks',
92
+ );
93
+
94
+ redirect($result->url);
95
+ ```
96
+
97
+ ### cURL
98
+
99
+ ```bash
100
+ curl -X POST https://commet.co/api/v1/payments \
101
+ -H "x-api-key: $COMMET_API_KEY" \
102
+ -H "Content-Type: application/json" \
103
+ -d '{
104
+ "amount": 25000,
105
+ "currency": "usd",
106
+ "description": "Annual report",
107
+ "customerId": "user_123",
108
+ "successUrl": "https://yourapp.com/thanks"
109
+ }'
110
+ ```
111
+
112
+ ### CLI
113
+
114
+ ```bash
115
+ commet payments create \
116
+ --amount 25000 \
117
+ --currency usd \
118
+ --description "Annual report" \
119
+ --customer-id user_123 \
120
+ --success-url https://yourapp.com/thanks
121
+ ```
122
+
123
+ `amount` is in cents. `25000` is $250.00.
124
+
125
+ ### Parameters
126
+
127
+ | Parameter | Type | Required | Description |
128
+ | ------------- | -------- | -------- | --------------------------------------------------- |
129
+ | `amount` | `number` | Yes | Charge amount in cents |
130
+ | `currency` | `string` | Yes | ISO 4217 currency code (`usd`, `eur`, `brl`) |
131
+ | `description` | `string` | Yes | Shown on the payment link, invoice, and receipt |
132
+ | `customerId` | `string` | No | Commet customer ID (`cus_xxx`) or your external ID |
133
+ | `successUrl` | `string` | No | Where the customer lands after paying |
134
+ | `metadata` | `object` | No | Key-value pairs. Shape: `{ [key: string]: string }` |
135
+
136
+ ## Charge a saved payment method
137
+
138
+ Bills a customer's vaulted payment method off-session. The customer must have a payment method on file.
139
+
140
+ ### TypeScript
141
+
142
+ ```typescript
143
+ const payment = await commet.payments.charge({
144
+ customerId: 'user_123',
145
+ amount: 25000,
146
+ currency: 'usd',
147
+ description: 'Annual report',
148
+ })
149
+ ```
150
+
151
+ ### Python
152
+
153
+ ```python
154
+ response = commet.payments.charge(
155
+ customer_id='user_123',
156
+ amount=25000,
157
+ currency='usd',
158
+ description='Annual report',
159
+ )
160
+ ```
161
+
162
+ ### Go
163
+
164
+ ```go
165
+ result, err := client.Payments.Charge(ctx, &commet.ChargePaymentParams{
166
+ CustomerID: "user_123",
167
+ Amount: 25000,
168
+ Currency: "usd",
169
+ Description: "Annual report",
170
+ })
171
+ ```
172
+
173
+ ### Java
174
+
175
+ ```java
176
+ ChargePaymentParams params = ChargePaymentParams.builder()
177
+ .customerId("user_123")
178
+ .amount(25000)
179
+ .currency("usd")
180
+ .description("Annual report")
181
+ .build();
182
+ var payment = commet.payments().charge(params);
183
+ ```
184
+
185
+ ### PHP
186
+
187
+ ```php
188
+ $result = $commet->payments->charge(
189
+ customerId: 'user_123',
190
+ amount: 25000,
191
+ currency: 'usd',
192
+ description: 'Annual report',
193
+ );
194
+ ```
195
+
196
+ ### cURL
197
+
198
+ ```bash
199
+ curl -X POST https://commet.co/api/v1/payments/charge \
200
+ -H "x-api-key: $COMMET_API_KEY" \
201
+ -H "Content-Type: application/json" \
202
+ -d '{
203
+ "customerId": "user_123",
204
+ "amount": 25000,
205
+ "currency": "usd",
206
+ "description": "Annual report"
207
+ }'
208
+ ```
209
+
210
+ ### CLI
211
+
212
+ ```bash
213
+ commet payments charge \
214
+ --customer-id user_123 \
215
+ --amount 25000 \
216
+ --currency usd \
217
+ --description "Annual report"
218
+ ```
219
+
220
+ ### Parameters
221
+
222
+ | Parameter | Type | Required | Description |
223
+ | ------------- | -------- | -------- | --------------------------------------------------- |
224
+ | `customerId` | `string` | Yes | Commet customer ID (`cus_xxx`) or your external ID |
225
+ | `amount` | `number` | Yes | Charge amount in cents |
226
+ | `currency` | `string` | Yes | ISO 4217 currency code (`usd`, `eur`, `brl`) |
227
+ | `description` | `string` | Yes | Shown on the invoice and receipt |
228
+ | `metadata` | `object` | No | Key-value pairs. Shape: `{ [key: string]: string }` |
229
+
230
+ ## Retrieve a payment
231
+
232
+ ```typescript
233
+ const payment = await commet.payments.get({ id: 'pay_123' })
234
+ ```
235
+
236
+ ## List payments
237
+
238
+ ```typescript
239
+ const { data } = await commet.payments.list({
240
+ customerId: 'user_123',
241
+ limit: 20,
242
+ })
243
+ ```
244
+
245
+ | Parameter | Type | Required | Description |
246
+ | ------------ | -------- | -------- | ---------------------------------------- |
247
+ | `customerId` | `string` | No | Filter to one customer |
248
+ | `limit` | `number` | No | Page size |
249
+ | `cursor` | `string` | No | Pagination cursor from the previous page |
250
+
251
+ ## Cancel a payment link
252
+
253
+ Cancels a pending link so it can no longer be paid.
254
+
255
+ ```typescript
256
+ await commet.payments.cancel({ id: 'pay_123' })
257
+ ```
258
+
259
+ > **Warning**
260
+ >
261
+ > Only a link that has not been paid or started processing can be canceled. Charges cannot be canceled.
262
+
263
+ ## The Payment object
264
+
265
+ | Field | Type | Description |
266
+ | ---------------- | ---------------------------------- | --------------------------------------- |
267
+ | `id` | `string` | Payment ID (`pay_xxx`) |
268
+ | `customerId` | `string \| null` | Customer the payment belongs to |
269
+ | `kind` | `"link" \| "charge"` | How the payment was taken |
270
+ | `status` | `string` | Current state (see below) |
271
+ | `provider` | `"stripe" \| "commet" \| "dlocal"` | Payment provider that processed it |
272
+ | `amountSubtotal` | `number` | Pre-tax amount in cents |
273
+ | `taxAmount` | `number` | Tax in cents |
274
+ | `amountTotal` | `number` | Subtotal + tax in cents |
275
+ | `currency` | `string` | ISO 4217 currency code |
276
+ | `description` | `string` | Description set at creation |
277
+ | `metadata` | `object \| null` | Key-value pairs set at creation |
278
+ | `url` | `string \| null` | Hosted payment link. `null` for charges |
279
+ | `expiresAt` | `string \| null` | When the link expires |
280
+ | `createdAt` | `string` | ISO 8601 datetime |
281
+ | `updatedAt` | `string` | ISO 8601 datetime |
282
+ | `object` | `"payment"` | Object type |
283
+ | `livemode` | `boolean` | `false` for sandbox payments |
284
+
285
+ ### Statuses
286
+
287
+ - `pending`: The link was created and is waiting for the customer to pay.
288
+ - `processing`: The payment is being confirmed with the provider.
289
+ - `succeeded`: The payment completed and an invoice was generated.
290
+ - `requires_action`: The customer must complete an extra step such as 3D Secure.
291
+ - `failed`: The payment did not go through.
292
+ - `canceled`: The link was canceled before payment.
293
+
294
+ `failed` and `requires_action` are not terminal for links: the customer can reopen the same payment link and pay with another card, as long as the link hasn't expired.
295
+
296
+ ## View in the dashboard
297
+
298
+ Navigate to **Payments**. Each payment shows its status, amount, tax, customer, and the generated invoice.
299
+
300
+ ## Limitations
301
+
302
+ - `amount` is in cents — minor units of the currency
303
+ - Tax is calculated automatically and added on top of `amount`
304
+ - `payments.charge` requires a vaulted payment method on the customer
305
+ - Charges cannot be canceled
306
+ - A link can only be canceled while `pending`
307
+
308
+ ## Related
309
+
310
+ - [One-Time Plans](/docs/one-time-payments) — One-time charges billed as a plan
311
+ - [Invoices and Billing Cycles](/docs/invoices-and-billing-cycles) — How invoices are generated
312
+ - [Manage Customers](/docs/manage-customers) — Create customers and vault payment methods
313
+ - [SDK Reference](/docs/sdk-reference) — Node.js SDK methods
314
+ - [CLI](/docs/cli#payments) — Create payment links from the terminal
@@ -0,0 +1,10 @@
1
+ {
2
+ "title": "Payments",
3
+ "description": "Accept one-time payments with no subscription or plan",
4
+ "pages": [
5
+ "accept-one-time-payments",
6
+ "transactions-refunds-and-retries",
7
+ "payment-providers",
8
+ "payment-orchestration"
9
+ ]
10
+ }
@@ -0,0 +1,43 @@
1
+ ---
2
+ lastModified: 2026-07-27
3
+ title: Payment Orchestration
4
+ description: Route payments across Commet and your connected PSPs using country rules, defaults, and provider-bound payment methods.
5
+ ---
6
+
7
+ Payment orchestration is the layer that chooses which connected provider handles a payment. Commet supports its own payment rail and your connected Stripe or dLocal accounts through the same billing integration.
8
+
9
+ ## Payment method management
10
+
11
+ To manage provider connections and routing, open **Settings → Payments** in the Commet dashboard. The page includes the payment routing map, the list of connected providers, country assignments, the default provider, and the **Add payment provider** action.
12
+
13
+ To inspect a customer's saved method, open **Customers**, select the customer, and view the **Billing** section. Commet only displays non-sensitive details such as the card brand and last four digits. The full payment method stays with the provider that vaulted it.
14
+
15
+ Customers can update their method through the [Customer Portal](/docs/customer-portal). The new method is collected through the connection used by that customer's subscription. Do not assume that changing an organization's country routing will move an existing method.
16
+
17
+ ## Routing rules
18
+
19
+ In **Settings → Payments**, use **Payment routing** to assign countries to connected providers. You can select individual countries or region presets, then save the assignment. The map and routing list show which provider will handle each country.
20
+
21
+ For a new checkout or other new activity, Commet resolves the customer's billing country as an ISO country code and looks up that country's route. For example, a customer whose billing address has `BR` uses the provider assigned to Brazil. The route is based on the billing address supplied to Commet, not on the customer's IP address.
22
+
23
+ If a subscription already has a saved payment connection, recurring charges continue through that connection. This preserves the location of the vaulted payment method. When there is no saved connection, Commet uses the country route; when no country is available, it uses the organization's default provider.
24
+
25
+ ## Fallback providers
26
+
27
+ The **default provider** is the fallback for a checkout that has no country code. Choose it from the provider list in **Settings → Payments**. Commet starts every organization with the Commet provider as the default, so there is a working route until you configure another one.
28
+
29
+ This default is a routing fallback, not an automatic outage failover. If a provider declines a payment or becomes unavailable, Commet records the failure and exposes the provider's failure code. Automatic retries and recovery links retry the affected billing flow; they do not silently move a saved payment method to another provider.
30
+
31
+ If you need new traffic to use another provider, connect it and reassign the relevant countries or make it the default for countryless checkouts. Existing subscriptions remain on their stamped connection until the customer completes a new payment-method setup.
32
+
33
+ ## Reuse payment methods
34
+
35
+ **Coming soon:** reuse a saved payment method across different providers.
36
+
37
+ Today, a saved payment method belongs to the provider connection that collected it. Commet does not copy card credentials between Stripe, dLocal, and Commet, and a routing change cannot make the same vaulted method chargeable by another provider. Customers must complete a new setup or checkout on the new connection.
38
+
39
+ ## Related
40
+
41
+ - [Payment Providers](/docs/payment-providers) — Connect and configure Stripe, dLocal, and Commet
42
+ - [Use Commet alongside your PSPs](/docs/merchant-of-record#use-commet-alongside-your-psps) — Understand the MoR boundary for each rail
43
+ - [Handle Failed Payments](/docs/handle-failed-payments) — Provider errors, retries, and self-serve recovery