@commet/node 9.3.0 → 9.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +366 -17
- package/dist/index.d.ts +366 -17
- package/dist/index.js +31 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -7
- package/dist/index.mjs.map +1 -1
- package/docs/ai-onboarding/ai-onboarding.md +2 -3
- package/docs/ai-onboarding/billing-best-practices-skill.md +2 -3
- package/docs/ai-onboarding/commet-skill.md +4 -5
- package/docs/ai-onboarding/mcp-server.md +8 -9
- package/docs/ai-onboarding/pricing-models-skill.md +2 -3
- package/docs/ai-onboarding/subscription-patterns-skill.md +2 -3
- package/docs/api-reference/addons.md +1 -1
- package/docs/api-reference/api-keys.md +3 -2
- package/docs/api-reference/credit-packs.md +1 -1
- package/docs/api-reference/customers.md +1 -1
- package/docs/api-reference/feature-access.md +1 -1
- package/docs/api-reference/features.md +1 -1
- package/docs/api-reference/generated-webhooks.md +3 -3
- package/docs/api-reference/index.md +2 -2
- package/docs/api-reference/invoices.md +1 -1
- package/docs/api-reference/markets.md +1 -1
- package/docs/api-reference/offers.md +1 -1
- package/docs/api-reference/payments.md +1 -1
- package/docs/api-reference/payouts.md +1 -1
- package/docs/api-reference/plan-groups.md +1 -1
- package/docs/api-reference/plans.md +1 -1
- package/docs/api-reference/portal.md +1 -1
- package/docs/api-reference/promo-codes.md +2 -2
- package/docs/api-reference/provisioning.md +1 -1
- package/docs/api-reference/quota.md +1 -1
- package/docs/api-reference/seats.md +1 -1
- package/docs/api-reference/subscriptions.md +81 -2
- package/docs/api-reference/test-clock.md +1 -1
- package/docs/api-reference/transactions.md +1 -1
- package/docs/api-reference/usage.md +1 -1
- package/docs/documentation/api-versioning.md +1 -2
- package/docs/documentation/better-auth.md +0 -1
- package/docs/documentation/choose-a-billing-model.md +54 -26
- package/docs/documentation/cli.md +1 -2
- package/docs/documentation/create-api-key.md +100 -25
- package/docs/documentation/customers/customer-credits.md +0 -1
- package/docs/documentation/customers/customer-portal.md +14 -2
- package/docs/documentation/customers/manage-customers.md +1 -2
- package/docs/documentation/error-handling.md +1 -2
- package/docs/documentation/examples.md +0 -1
- package/docs/documentation/finance/acceptable-use.md +0 -1
- package/docs/documentation/finance/finance-overview.md +0 -1
- package/docs/documentation/finance/local-currency-taxes.md +0 -1
- package/docs/documentation/finance/merchant-of-record.md +0 -1
- package/docs/documentation/finance/payouts-verification.md +6 -3
- package/docs/documentation/finance/payouts.md +0 -1
- package/docs/documentation/finance/supported-countries.md +0 -1
- package/docs/documentation/go/integrate-with-encore.md +7 -8
- package/docs/documentation/go/integrate-with-go.md +8 -9
- package/docs/documentation/introduction.md +62 -41
- package/docs/documentation/invoicing/handle-failed-payments.md +9 -4
- package/docs/documentation/invoicing/invoices-and-billing-cycles.md +0 -1
- package/docs/documentation/invoicing/manage-invoices.md +0 -1
- package/docs/documentation/java/integrate-with-java.md +6 -7
- package/docs/documentation/nodejs/integrate-with-astro.md +6 -7
- package/docs/documentation/nodejs/integrate-with-bun.md +6 -7
- package/docs/documentation/nodejs/integrate-with-express.md +7 -8
- package/docs/documentation/nodejs/integrate-with-hono.md +7 -8
- package/docs/documentation/nodejs/integrate-with-nextjs.md +6 -7
- package/docs/documentation/nodejs/integrate-with-nuxt.md +6 -7
- package/docs/documentation/nodejs/integrate-with-remix.md +6 -7
- package/docs/documentation/nodejs/integrate-with-sveltekit.md +6 -7
- package/docs/documentation/payments/accept-one-time-payments.md +0 -1
- package/docs/documentation/payments/payment-orchestration.md +0 -1
- package/docs/documentation/payments/payment-providers.md +0 -1
- package/docs/documentation/payments/transactions-refunds-and-retries.md +8 -1
- package/docs/documentation/php/integrate-with-laravel.md +8 -9
- package/docs/documentation/php/integrate-with-php.md +6 -7
- package/docs/documentation/php/integrate-with-symfony.md +7 -8
- package/docs/documentation/plans/add-ons.md +0 -1
- package/docs/documentation/plans/balance-and-top-ups.md +0 -1
- package/docs/documentation/plans/configure-features.md +0 -1
- package/docs/documentation/plans/consumption-models.md +0 -1
- package/docs/documentation/plans/create-plans.md +0 -1
- package/docs/documentation/plans/credit-packs.md +0 -1
- package/docs/documentation/plans/one-time-payments.md +0 -1
- package/docs/documentation/plans/plan-groups.md +0 -1
- package/docs/documentation/platform/custom-domains.md +0 -1
- package/docs/documentation/platform/dashboard-metrics-and-events.md +0 -1
- package/docs/documentation/platform/members-and-permissions.md +0 -1
- package/docs/documentation/platform/organization-settings.md +0 -1
- package/docs/documentation/python/integrate-with-django.md +8 -9
- package/docs/documentation/python/integrate-with-fastapi.md +8 -9
- package/docs/documentation/python/integrate-with-flask.md +8 -9
- package/docs/documentation/python/integrate-with-python.md +6 -7
- package/docs/documentation/sales/card-promotions.md +0 -1
- package/docs/documentation/sales/introductory-offers.md +0 -1
- package/docs/documentation/sales/offers.md +0 -1
- package/docs/documentation/sales/promo-codes.md +19 -5
- package/docs/documentation/sales/promotional-offers.md +1 -2
- package/docs/documentation/sales/regional-prices.md +0 -1
- package/docs/documentation/sales/trial-periods.md +8 -8
- package/docs/documentation/sdk-reference.md +9 -10
- package/docs/documentation/subscriptions/manage-subscriptions.md +114 -12
- package/docs/documentation/subscriptions/plan-grants.md +0 -1
- package/docs/documentation/subscriptions/upgrade-and-downgrade-plans.md +0 -1
- package/docs/documentation/testing-sandbox.md +0 -1
- package/docs/documentation/usage/ai-token-billing.md +0 -1
- package/docs/documentation/usage/quota-management.md +0 -1
- package/docs/documentation/usage/seat-management.md +0 -1
- package/docs/documentation/usage/track-usage.md +0 -1
- package/docs/errors/addon_already_active.md +1 -1
- package/docs/errors/addon_has_activations.md +1 -1
- package/docs/errors/addon_not_active.md +1 -1
- package/docs/errors/addon_not_found.md +1 -1
- package/docs/errors/already_has_active_subscription.md +1 -1
- package/docs/errors/already_scheduled.md +1 -1
- package/docs/errors/api_key_not_found.md +1 -1
- package/docs/errors/card_promotions_not_available.md +1 -1
- package/docs/errors/charge_failed.md +1 -1
- package/docs/errors/charge_in_progress.md +1 -1
- package/docs/errors/claim_not_pending.md +1 -1
- package/docs/errors/credit_pack_not_found.md +1 -1
- package/docs/errors/customer_not_found.md +1 -1
- package/docs/errors/duplicate.md +1 -1
- package/docs/errors/endpoint_deprecated.md +1 -1
- package/docs/errors/endpoint_not_available.md +1 -1
- package/docs/errors/feature_already_exists.md +1 -1
- package/docs/errors/feature_disabled.md +1 -1
- package/docs/errors/feature_in_use.md +1 -1
- package/docs/errors/feature_not_found.md +1 -1
- package/docs/errors/feature_not_in_plan.md +1 -1
- package/docs/errors/forbidden.md +1 -1
- package/docs/errors/free_plan_change_not_supported.md +1 -1
- package/docs/errors/idempotency_in_progress.md +1 -1
- package/docs/errors/idempotency_key_mismatch.md +1 -1
- package/docs/errors/idempotency_unavailable.md +1 -1
- package/docs/errors/included_limit_reached.md +1 -1
- package/docs/errors/index.md +1 -1
- package/docs/errors/insufficient_balance.md +1 -1
- package/docs/errors/insufficient_credits.md +1 -1
- package/docs/errors/insufficient_seats.md +1 -1
- package/docs/errors/internal_error.md +1 -1
- package/docs/errors/invalid_json.md +1 -1
- package/docs/errors/invalid_subscription_status.md +1 -1
- package/docs/errors/invoice_not_found.md +1 -1
- package/docs/errors/market_group_in_use.md +1 -1
- package/docs/errors/market_group_not_found.md +1 -1
- package/docs/errors/market_in_use.md +1 -1
- package/docs/errors/market_not_found.md +1 -1
- package/docs/errors/missing_regional_price.md +1 -1
- package/docs/errors/model_not_found.md +1 -1
- package/docs/errors/no_active_subscription.md +1 -1
- package/docs/errors/no_change_requested.md +1 -1
- package/docs/errors/no_outstanding_invoice.md +1 -1
- package/docs/errors/no_payment_method.md +1 -1
- package/docs/errors/no_prices_configured.md +1 -1
- package/docs/errors/not_found.md +1 -1
- package/docs/errors/not_scheduled_for_cancellation.md +1 -1
- package/docs/errors/offer_not_applicable.md +1 -1
- package/docs/errors/offer_not_found.md +1 -1
- package/docs/errors/one_time_subscription_not_cancelable.md +1 -1
- package/docs/errors/organization_already_claimed.md +1 -1
- package/docs/errors/payment_failed.md +1 -1
- package/docs/errors/payment_method_not_found.md +1 -1
- package/docs/errors/payment_not_cancelable.md +1 -1
- package/docs/errors/payment_not_found.md +1 -1
- package/docs/errors/payouts_not_available_in_sandbox.md +1 -1
- package/docs/errors/plan_change_scheduled.md +1 -1
- package/docs/errors/plan_group_not_found.md +1 -1
- package/docs/errors/plan_not_found.md +1 -1
- package/docs/errors/plan_unavailable.md +1 -1
- package/docs/errors/plans_not_in_same_group.md +1 -1
- package/docs/errors/price_in_use.md +1 -1
- package/docs/errors/price_not_found.md +1 -1
- package/docs/errors/pricing_mode_mismatch.md +1 -1
- package/docs/errors/promo_code_expired.md +1 -1
- package/docs/errors/promo_code_not_found.md +1 -1
- package/docs/errors/provider_unsupported.md +1 -1
- package/docs/errors/rate_limited.md +1 -1
- package/docs/errors/sandbox_only.md +1 -1
- package/docs/errors/seat_limit_exceeded.md +1 -1
- package/docs/errors/subscription_activation_failed.md +1 -1
- package/docs/errors/subscription_already_canceled.md +1 -1
- package/docs/errors/subscription_cancel_failed.md +1 -1
- package/docs/errors/subscription_creation_failed.md +1 -1
- package/docs/errors/subscription_has_open_dispute.md +1 -1
- package/docs/errors/subscription_not_active.md +1 -1
- package/docs/errors/subscription_not_found.md +1 -1
- package/docs/errors/subscription_required.md +1 -1
- package/docs/errors/subscription_uncancel_failed.md +1 -1
- package/docs/errors/transaction_not_found.md +1 -1
- package/docs/errors/unauthorized.md +1 -1
- package/docs/errors/validation_error.md +1 -1
- package/docs/errors/webhook_not_found.md +1 -1
- package/docs/knowledge-base/how-do-balance-and-top-ups-work.md +0 -1
- package/docs/knowledge-base/how-do-credits-credit-packs-and-customer-credits-differ.md +0 -1
- package/docs/knowledge-base/how-do-discounts-work.md +0 -1
- package/docs/knowledge-base/how-do-free-plans-work-without-payment.md +0 -1
- package/docs/knowledge-base/how-do-monthly-quarterly-and-yearly-billing-work.md +0 -1
- package/docs/knowledge-base/how-do-offers-promo-codes-and-card-promotions-work-together.md +0 -1
- package/docs/knowledge-base/how-do-trial-periods-work.md +0 -1
- package/docs/knowledge-base/how-does-billing-work.md +0 -1
- package/docs/knowledge-base/how-does-payment-routing-work.md +0 -1
- package/docs/knowledge-base/how-does-quota-based-billing-work.md +0 -1
- package/docs/knowledge-base/how-does-seat-based-billing-work.md +0 -1
- package/docs/knowledge-base/how-is-proration-calculated-when-changing-plans.md +0 -1
- package/docs/knowledge-base/what-happens-when-a-customer-changes-plans.md +0 -1
- package/docs/knowledge-base/what-happens-when-a-payment-fails.md +0 -1
- package/docs/knowledge-base/what-happens-when-you-change-your-prices.md +0 -1
- package/docs/knowledge-base/what-happens-when-you-refund-or-retry-a-transaction.md +1 -2
- package/docs/knowledge-base/what-invoices-do-customers-receive-and-when.md +0 -1
- package/docs/manifest.json +186 -235
- package/docs/platform-documentation.md +69 -149
- package/docs/schemas.md +35 -1
- package/docs/webhooks/introduction.md +0 -1
- package/docs/webhooks.md +98 -7
- package/docs/webhooks.openapi.json +11058 -0
- package/package.json +1 -1
- package/docs/ai-onboarding/meta.json +0 -17
- package/docs/api-reference/meta.json +0 -7
- package/docs/documentation/customers/meta.json +0 -5
- package/docs/documentation/finance/meta.json +0 -13
- package/docs/documentation/go/meta.json +0 -5
- package/docs/documentation/invoicing/meta.json +0 -9
- package/docs/documentation/java/meta.json +0 -5
- package/docs/documentation/meta.json +0 -36
- package/docs/documentation/nodejs/meta.json +0 -14
- package/docs/documentation/payments/meta.json +0 -10
- package/docs/documentation/php/meta.json +0 -9
- package/docs/documentation/plans/meta.json +0 -14
- package/docs/documentation/platform/meta.json +0 -10
- package/docs/documentation/python/meta.json +0 -10
- package/docs/documentation/sales/meta.json +0 -13
- package/docs/documentation/subscriptions/meta.json +0 -9
- package/docs/documentation/usage/meta.json +0 -10
- package/docs/knowledge-base/meta.json +0 -29
- package/docs/meta.json +0 -11
- package/docs/webhooks/addon-activated.md +0 -44
- package/docs/webhooks/addon-deactivated.md +0 -40
- package/docs/webhooks/balance-depleted.md +0 -37
- package/docs/webhooks/balance-low.md +0 -39
- package/docs/webhooks/balance-topped-up.md +0 -41
- package/docs/webhooks/checkout-ready.md +0 -43
- package/docs/webhooks/credits-depleted.md +0 -35
- package/docs/webhooks/credits-expired.md +0 -35
- package/docs/webhooks/credits-granted.md +0 -37
- package/docs/webhooks/credits-low.md +0 -39
- package/docs/webhooks/credits-purchased.md +0 -41
- package/docs/webhooks/customer-created.md +0 -49
- package/docs/webhooks/customer-state-changed.md +0 -134
- package/docs/webhooks/customer-updated.md +0 -49
- package/docs/webhooks/invoice-created.md +0 -45
- package/docs/webhooks/invoice-overdue.md +0 -53
- package/docs/webhooks/invoice-upcoming.md +0 -43
- package/docs/webhooks/invoice-voided.md +0 -53
- package/docs/webhooks/meta.json +0 -83
- package/docs/webhooks/payment-dispute-resolved.md +0 -52
- package/docs/webhooks/payment-disputed.md +0 -49
- package/docs/webhooks/payment-failed.md +0 -37
- package/docs/webhooks/payment-link-canceled.md +0 -41
- package/docs/webhooks/payment-link-completed.md +0 -47
- package/docs/webhooks/payment-link-created.md +0 -41
- package/docs/webhooks/payment-link-failed.md +0 -45
- package/docs/webhooks/payment-method-attached.md +0 -40
- package/docs/webhooks/payment-method-updated.md +0 -38
- package/docs/webhooks/payment-received.md +0 -45
- package/docs/webhooks/payment-recovered.md +0 -39
- package/docs/webhooks/payment-refunded.md +0 -47
- package/docs/webhooks/payment-retry-failed.md +0 -39
- package/docs/webhooks/payout-available.md +0 -33
- package/docs/webhooks/payout-created.md +0 -48
- package/docs/webhooks/payout-failed.md +0 -52
- package/docs/webhooks/payout-paid.md +0 -48
- package/docs/webhooks/plan-grant-created.md +0 -74
- package/docs/webhooks/plan-grant-expired.md +0 -86
- package/docs/webhooks/plan-grant-revoked.md +0 -86
- package/docs/webhooks/plan-grant-updated.md +0 -86
- package/docs/webhooks/quota-exceeded.md +0 -44
- package/docs/webhooks/quota-threshold-reached.md +0 -41
- package/docs/webhooks/seats-limit-reached.md +0 -39
- package/docs/webhooks/seats-updated.md +0 -39
- package/docs/webhooks/subscription-activated.md +0 -43
- package/docs/webhooks/subscription-canceled.md +0 -57
- package/docs/webhooks/subscription-cancellation-revoked.md +0 -37
- package/docs/webhooks/subscription-cancellation-scheduled.md +0 -45
- package/docs/webhooks/subscription-created.md +0 -35
- package/docs/webhooks/subscription-past-due.md +0 -43
- package/docs/webhooks/subscription-plan-change-revoked.md +0 -50
- package/docs/webhooks/subscription-plan-change-scheduled.md +0 -55
- package/docs/webhooks/subscription-plan-changed.md +0 -43
- package/docs/webhooks/subscription-reactivated.md +0 -53
- package/docs/webhooks/subscription-updated.md +0 -39
- package/docs/webhooks/trial-checkout-ready.md +0 -39
- package/docs/webhooks/trial-converted.md +0 -39
- package/docs/webhooks/trial-expired.md +0 -39
- package/docs/webhooks/trial-started.md +0 -46
- package/docs/webhooks/trial-will-end.md +0 -41
- package/docs/webhooks/usage-recorded.md +0 -41
|
@@ -1,58 +1,79 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-08-16
|
|
3
2
|
title: Introduction
|
|
4
|
-
description:
|
|
3
|
+
description: Measure consumption, manage subscriptions, and accept payments for your SaaS or AI product with Commet.
|
|
5
4
|
---
|
|
6
5
|
|
|
7
|
-
Commet is a billing and payments platform for SaaS and AI products. It
|
|
6
|
+
Commet is a billing and payments platform for SaaS and AI products. It connects what your customers use with what they pay: subscriptions, usage charges, credits, and one-time payments.
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
You define what you sell and how you price it. Commet manages the billing cycle, invoices, and payment flows. Your application reports consumption and uses Commet's access checks and events to decide what each customer can do.
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
3. Follow the quickstart for your language, then run the matching [example application](/docs/examples).
|
|
14
|
-
4. Confirm subscription and payment outcomes with signed webhooks.
|
|
10
|
+
- [**Quickstart**](/docs/choose-a-billing-model) — Go from creating an account to your first subscription and test payment.
|
|
11
|
+
- [**Build with an agent**](/docs/mcp-server) — Connect your assistant to Commet's documentation and API through MCP.
|
|
15
12
|
|
|
16
|
-
##
|
|
13
|
+
## What can you build with Commet?
|
|
17
14
|
|
|
18
|
-
|
|
19
|
-
- [**Remix**](/docs/integrate-with-remix)
|
|
20
|
-
- [**Nuxt**](/docs/integrate-with-nuxt)
|
|
21
|
-
- [**SvelteKit**](/docs/integrate-with-sveltekit)
|
|
22
|
-
- [**Astro**](/docs/integrate-with-astro)
|
|
23
|
-
- [**Express**](/docs/integrate-with-express)
|
|
24
|
-
- [**Hono**](/docs/integrate-with-hono)
|
|
25
|
-
- [**Bun**](/docs/integrate-with-bun)
|
|
15
|
+
### Subscriptions that match your product
|
|
26
16
|
|
|
27
|
-
|
|
17
|
+
Sell a monthly or annual plan with a fixed price, usage charges, or a combination of both. Define [features](/docs/configure-features) such as API calls, team seats, storage, or access to a capability, then package them into [plans](/docs/create-plans).
|
|
28
18
|
|
|
29
|
-
|
|
19
|
+
A [subscription](/docs/manage-subscriptions) connects a customer to a plan. Commet manages its billing cycle and invoices as the subscription renews or changes. You can offer [trials](/docs/trial-periods), handle [upgrades and downgrades](/docs/upgrade-and-downgrade-plans), and configure [failed-payment recovery](/docs/handle-failed-payments).
|
|
30
20
|
|
|
31
|
-
|
|
32
|
-
2. **Plan** — bundle features with pricing and a consumption model
|
|
33
|
-
3. **Customer** — assign the plan and a subscription is created
|
|
34
|
-
4. **Billing** — invoices, usage tracking, and payments happen without intervention
|
|
21
|
+
### Pricing based on consumption
|
|
35
22
|
|
|
36
|
-
|
|
23
|
+
An AI request, an API call, and a stored file represent different kinds of usage. Commet lets you define how that usage affects the customer's bill or available allowance.
|
|
37
24
|
|
|
38
|
-
|
|
25
|
+
Each plan has one [consumption model](/docs/consumption-models):
|
|
39
26
|
|
|
40
|
-
| Model | How it
|
|
41
|
-
| ----------- |
|
|
42
|
-
| **Metered** |
|
|
43
|
-
| **Credits** |
|
|
44
|
-
| **Balance** |
|
|
27
|
+
| Model | How it treats usage |
|
|
28
|
+
| ----------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
29
|
+
| **Metered** | Measures usage against each feature's included allowance, with overage charges when configured. |
|
|
30
|
+
| **Credits** | Deducts credits from a shared pool as customers use features. |
|
|
31
|
+
| **Balance** | Converts usage into monetary amounts drawn from the customer's balance, with overage behavior defined by the plan. |
|
|
45
32
|
|
|
46
|
-
|
|
33
|
+
Your application [reports usage](/docs/track-usage) to Commet. For AI products, [token billing](/docs/ai-token-billing) uses the model and token counts you report to calculate consumption with your configured margin. You can also manage [team seats](/docs/seat-management) and [quantities such as stored resources](/docs/quota-management).
|
|
47
34
|
|
|
48
|
-
|
|
35
|
+
### One-time purchases and optional extras
|
|
49
36
|
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
- [
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
- [
|
|
37
|
+
[Accept a one-time payment](/docs/accept-one-time-payments) without creating a plan or subscription. This is useful for a standalone purchase or service alongside your recurring product.
|
|
38
|
+
|
|
39
|
+
For subscribers, offer [add-ons](/docs/add-ons) to extend a plan, [credit packs](/docs/credit-packs) for more consumption, or [balance top-ups](/docs/balance-and-top-ups). These give customers a way to buy more without changing their entire subscription.
|
|
40
|
+
|
|
41
|
+
### A billing experience customers can manage themselves
|
|
42
|
+
|
|
43
|
+
Use checkout to collect payment and the [customer portal](/docs/customer-portal) to let customers view invoices, update payment methods, and review usage. Configure [plan groups](/docs/plan-groups) to offer self-service plan changes.
|
|
44
|
+
|
|
45
|
+
You can also create reusable [offers](/docs/offers), distribute them through [promo codes](/docs/promo-codes), and configure [regional prices](/docs/regional-prices) for different markets and currencies.
|
|
46
|
+
|
|
47
|
+
## Choose how you accept payments
|
|
48
|
+
|
|
49
|
+
Use Commet's [Merchant of Record](/docs/merchant-of-record) offering, or connect your own [Stripe or dLocal account](/docs/payment-providers).
|
|
50
|
+
|
|
51
|
+
For payments processed through its Merchant of Record offering, Commet handles tax collection and remittance, compliance, refunds, and disputes on your behalf. With your own Stripe or dLocal account, you remain the merchant and manage funds and payouts with that provider. Commet provides the billing layer in either setup.
|
|
52
|
+
|
|
53
|
+
The guides cover [payment routing](/docs/payment-orchestration), [transactions and refunds](/docs/transactions-refunds-and-retries), and [finance and payouts](/docs/finance-overview). Before using Commet as Merchant of Record, review [supported countries](/docs/supported-countries) and [verification requirements](/docs/payouts-verification).
|
|
54
|
+
|
|
55
|
+
## Integrate the way you work
|
|
56
|
+
|
|
57
|
+
Start in the dashboard to configure your product, then connect your application with an [API key](/docs/create-api-key). Choose a guide for your stack:
|
|
58
|
+
|
|
59
|
+
| Stack | Integration guides |
|
|
60
|
+
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
61
|
+
| **JavaScript and TypeScript** | [Next.js](/docs/integrate-with-nextjs), [Nuxt](/docs/integrate-with-nuxt), [SvelteKit](/docs/integrate-with-sveltekit), [Express](/docs/integrate-with-express), or the [Node.js SDK reference](/docs/sdk-reference). |
|
|
62
|
+
| **Python** | [Python](/docs/integrate-with-python), [FastAPI](/docs/integrate-with-fastapi), [Django](/docs/integrate-with-django), and [Flask](/docs/integrate-with-flask). |
|
|
63
|
+
| **Go, Java, and PHP** | [Go](/docs/integrate-with-go), [Java](/docs/integrate-with-java), [PHP](/docs/integrate-with-php), and [Laravel](/docs/integrate-with-laravel). |
|
|
64
|
+
|
|
65
|
+
Using Better Auth? The [Commet plugin](/docs/better-auth) connects customer creation and billing to your authentication flow. For complete applications you can adapt, explore the [examples](/docs/examples).
|
|
66
|
+
|
|
67
|
+
### Tools for developers and agents
|
|
68
|
+
|
|
69
|
+
The [CLI](/docs/cli) lets you manage Commet from your terminal and work with billing configuration as code. The [REST API reference](/docs/api-reference/overview) documents the endpoints available to your own tools and integrations.
|
|
70
|
+
|
|
71
|
+
For an AI coding assistant, install the [Commet skill](/docs/commet-skill) for integration guidance. Connect the [MCP server](/docs/mcp-server) when the assistant also needs to read documentation and work with resources in your organization. The skill provides guidance; MCP provides access to tools.
|
|
72
|
+
|
|
73
|
+
## Connect billing to your application
|
|
74
|
+
|
|
75
|
+
Build your first flow in [sandbox](/docs/testing-sandbox), where you can exercise checkout and billing without real charges. Use [access and usage checks](/docs/track-usage) in your application to enforce the plan you sell.
|
|
76
|
+
|
|
77
|
+
Connect [signed webhooks](/docs/webhooks/introduction) to keep your application in sync with subscription and payment outcomes. Review [error handling](/docs/error-handling) before moving the integration to production.
|
|
78
|
+
|
|
79
|
+
Ready to start? Follow the [quickstart](/docs/choose-a-billing-model) to create a feature, plan, customer, subscription, and test payment in order.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-07-28
|
|
3
2
|
title: Handle Failed Payments
|
|
4
3
|
description: What happens when a customer's payment fails and how they can reactivate from the Customer Portal.
|
|
5
4
|
---
|
|
@@ -33,9 +32,15 @@ Initial checkout card declines do not emit `payment.failed`; the checkout respon
|
|
|
33
32
|
|
|
34
33
|
Retries run on day 1, day 3, day 5, and day 7 after the original failure (4 retries). The calendar is anchored to the failure and never moves. After the last failed retry the subscription is canceled.
|
|
35
34
|
|
|
36
|
-
Manual retries
|
|
35
|
+
Manual retries from the Customer Portal or [`reactivate`](#retry-the-charge-server-to-server) use the default payment method and have separate daily limits. They do not consume automatic retry slots or start another charge while an automatic retry is in progress.
|
|
37
36
|
|
|
38
|
-
|
|
37
|
+
### Saved payment methods
|
|
38
|
+
|
|
39
|
+
Commet first tries the default saved method on the subscription's payment connection. After a confirmed decline, it tries the other available methods on that connection, newest first. OXXO is excluded from these retries. Changing country routing does not change the connection used for these retries.
|
|
40
|
+
|
|
41
|
+
Trying several methods counts as one scheduled retry. Commet stops when a payment succeeds. If a result is pending or unknown, it waits for that result before trying another method.
|
|
42
|
+
|
|
43
|
+
A successful charge with another method does not change the customer's default payment method.
|
|
39
44
|
|
|
40
45
|
## Dunning communications
|
|
41
46
|
|
|
@@ -217,7 +222,7 @@ Customers in `past_due` see their subscription in the [Customer Portal](/docs/cu
|
|
|
217
222
|
- **Retry with their current card** — useful when the failure was temporary (insufficient funds that are now available, a bank hold that cleared).
|
|
218
223
|
- **Update their payment method** — enter a new card through the subscription's payment provider and retry in the same step.
|
|
219
224
|
|
|
220
|
-
A successful retry settles the outstanding invoice, moves the subscription back to `active`, and emits a `payment.recovered` event. A declined retry
|
|
225
|
+
A successful retry settles the outstanding invoice, moves the subscription back to `active`, and emits a `payment.recovered` event. A declined manual retry preserves the automatic dunning calendar. Retry attempts are rate-limited to 3 per day per customer.
|
|
221
226
|
|
|
222
227
|
## Prompt payment update
|
|
223
228
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-07-28
|
|
3
2
|
title: Integrate with Java
|
|
4
3
|
description: Install and configure the Commet Java SDK.
|
|
5
4
|
---
|
|
@@ -10,7 +9,7 @@ Install the Commet Skill so your coding agent can integrate the current SDK and
|
|
|
10
9
|
npx skills add commet-labs/skills --skill commet
|
|
11
10
|
```
|
|
12
11
|
|
|
13
|
-
1.
|
|
12
|
+
1. ### Install
|
|
14
13
|
### Maven
|
|
15
14
|
```xml title="pom.xml"
|
|
16
15
|
<dependency>
|
|
@@ -24,7 +23,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
24
23
|
implementation("co.commet:commet-java:9.0.0")
|
|
25
24
|
```
|
|
26
25
|
|
|
27
|
-
2.
|
|
26
|
+
2. ### Configure
|
|
28
27
|
```bash title=".env"
|
|
29
28
|
COMMET_API_KEY=ck_sandbox_xxx
|
|
30
29
|
```
|
|
@@ -40,7 +39,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
40
39
|
```
|
|
41
40
|
There is no environment option on the client: sandbox vs live is decided by the organization the API key belongs to.
|
|
42
41
|
|
|
43
|
-
3.
|
|
42
|
+
3. ### Create Customer and Subscribe
|
|
44
43
|
`customers().create` is idempotent — if a customer with the same `id` already exists, it returns the existing record.
|
|
45
44
|
```java
|
|
46
45
|
import co.commet.params.CreateCustomerParams;
|
|
@@ -62,7 +61,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
62
61
|
```
|
|
63
62
|
The customer is redirected to checkout to complete payment.
|
|
64
63
|
|
|
65
|
-
4.
|
|
64
|
+
4. ### Check Access
|
|
66
65
|
```java
|
|
67
66
|
import co.commet.models.FeatureAccess;
|
|
68
67
|
import co.commet.models.Subscription;
|
|
@@ -80,7 +79,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
80
79
|
boolean allowed = access.allowed();
|
|
81
80
|
```
|
|
82
81
|
|
|
83
|
-
5.
|
|
82
|
+
5. ### Track Usage
|
|
84
83
|
```java
|
|
85
84
|
import co.commet.params.TrackUsageParams;
|
|
86
85
|
|
|
@@ -92,7 +91,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
92
91
|
```
|
|
93
92
|
Usage is aggregated and billed at end of period.
|
|
94
93
|
|
|
95
|
-
6.
|
|
94
|
+
6. ### Webhooks
|
|
96
95
|
```java
|
|
97
96
|
import co.commet.resources.Webhooks;
|
|
98
97
|
import java.util.Map;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-07-28
|
|
3
2
|
title: Integrate with Astro
|
|
4
3
|
description: Add billing and payments to your Astro application.
|
|
5
4
|
---
|
|
@@ -14,7 +13,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
14
13
|
>
|
|
15
14
|
> Astro requires an SSR adapter for API routes. Set `output: 'server'` or `output: 'hybrid'` in your `astro.config.mjs`.
|
|
16
15
|
|
|
17
|
-
1.
|
|
16
|
+
1. ### Install
|
|
18
17
|
### pnpm
|
|
19
18
|
```bash
|
|
20
19
|
pnpm add @commet/node
|
|
@@ -32,7 +31,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
32
31
|
bun add @commet/node
|
|
33
32
|
```
|
|
34
33
|
|
|
35
|
-
2.
|
|
34
|
+
2. ### Configure
|
|
36
35
|
```bash title=".env"
|
|
37
36
|
COMMET_API_KEY=ck_sandbox_xxx
|
|
38
37
|
```
|
|
@@ -44,7 +43,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
44
43
|
})
|
|
45
44
|
```
|
|
46
45
|
|
|
47
|
-
3.
|
|
46
|
+
3. ### Subscribe
|
|
48
47
|
`customers.create` is idempotent — if a customer with the same `id` already exists, it returns the existing record.
|
|
49
48
|
```typescript title="src/pages/api/billing/subscribe.ts"
|
|
50
49
|
import type { APIRoute } from 'astro'
|
|
@@ -64,7 +63,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
64
63
|
}
|
|
65
64
|
```
|
|
66
65
|
|
|
67
|
-
4.
|
|
66
|
+
4. ### Check Access
|
|
68
67
|
```typescript title="src/pages/api/billing/access/[customerId].ts"
|
|
69
68
|
import type { APIRoute } from 'astro'
|
|
70
69
|
import { commet } from '../../../../lib/commet'
|
|
@@ -88,7 +87,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
88
87
|
}
|
|
89
88
|
```
|
|
90
89
|
|
|
91
|
-
5.
|
|
90
|
+
5. ### Track Usage
|
|
92
91
|
```typescript title="src/pages/api/billing/usage.ts"
|
|
93
92
|
import type { APIRoute } from 'astro'
|
|
94
93
|
import { commet } from '../../../lib/commet'
|
|
@@ -107,7 +106,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
107
106
|
```
|
|
108
107
|
Usage is aggregated and billed at end of period.
|
|
109
108
|
|
|
110
|
-
6.
|
|
109
|
+
6. ### Customer Portal
|
|
111
110
|
```typescript title="src/pages/api/billing/portal.ts"
|
|
112
111
|
import type { APIRoute } from 'astro'
|
|
113
112
|
import { commet } from '../../../lib/commet'
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-07-28
|
|
3
2
|
title: Integrate with Bun
|
|
4
3
|
description: Add billing and payments to your Bun application.
|
|
5
4
|
---
|
|
@@ -10,12 +9,12 @@ Install the Commet Skill so your coding agent can integrate the current SDK and
|
|
|
10
9
|
npx skills add commet-labs/skills --skill commet
|
|
11
10
|
```
|
|
12
11
|
|
|
13
|
-
1.
|
|
12
|
+
1. ### Install
|
|
14
13
|
```bash
|
|
15
14
|
bun add @commet/node
|
|
16
15
|
```
|
|
17
16
|
|
|
18
|
-
2.
|
|
17
|
+
2. ### Configure
|
|
19
18
|
```bash title=".env"
|
|
20
19
|
COMMET_API_KEY=ck_sandbox_xxx
|
|
21
20
|
```
|
|
@@ -27,7 +26,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
27
26
|
})
|
|
28
27
|
```
|
|
29
28
|
|
|
30
|
-
3.
|
|
29
|
+
3. ### Subscribe
|
|
31
30
|
```typescript title="src/index.ts"
|
|
32
31
|
import { commet } from './commet'
|
|
33
32
|
|
|
@@ -54,7 +53,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
54
53
|
})
|
|
55
54
|
```
|
|
56
55
|
|
|
57
|
-
4.
|
|
56
|
+
4. ### Check Access
|
|
58
57
|
Add these routes to the `fetch` handler.
|
|
59
58
|
```typescript title="src/index.ts"
|
|
60
59
|
if (url.pathname.startsWith('/subscription/') && req.method === 'GET') {
|
|
@@ -78,7 +77,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
78
77
|
}
|
|
79
78
|
```
|
|
80
79
|
|
|
81
|
-
5.
|
|
80
|
+
5. ### Track Usage
|
|
82
81
|
```typescript title="src/index.ts"
|
|
83
82
|
if (url.pathname === '/usage' && req.method === 'POST') {
|
|
84
83
|
const { customerId } = await req.json()
|
|
@@ -94,7 +93,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
94
93
|
```
|
|
95
94
|
Usage is aggregated and billed at end of period.
|
|
96
95
|
|
|
97
|
-
6.
|
|
96
|
+
6. ### Customer Portal
|
|
98
97
|
```typescript title="src/index.ts"
|
|
99
98
|
if (url.pathname === '/portal' && req.method === 'GET') {
|
|
100
99
|
const customerId = url.searchParams.get('customerId')!
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-07-28
|
|
3
2
|
title: Integrate with Express
|
|
4
3
|
description: Add billing and payments to your Express application.
|
|
5
4
|
---
|
|
@@ -10,7 +9,7 @@ Install the Commet Skill so your coding agent can integrate the current SDK and
|
|
|
10
9
|
npx skills add commet-labs/skills --skill commet
|
|
11
10
|
```
|
|
12
11
|
|
|
13
|
-
1.
|
|
12
|
+
1. ### Install
|
|
14
13
|
### pnpm
|
|
15
14
|
```bash
|
|
16
15
|
pnpm add @commet/node express
|
|
@@ -24,7 +23,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
24
23
|
yarn add @commet/node express
|
|
25
24
|
```
|
|
26
25
|
|
|
27
|
-
2.
|
|
26
|
+
2. ### Configure
|
|
28
27
|
```bash title=".env"
|
|
29
28
|
COMMET_API_KEY=ck_sandbox_xxx
|
|
30
29
|
```
|
|
@@ -36,7 +35,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
36
35
|
})
|
|
37
36
|
```
|
|
38
37
|
|
|
39
|
-
3.
|
|
38
|
+
3. ### Subscribe
|
|
40
39
|
```typescript title="src/routes/billing.ts"
|
|
41
40
|
import { Router } from 'express'
|
|
42
41
|
import { commet } from '../commet'
|
|
@@ -59,7 +58,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
59
58
|
export default router
|
|
60
59
|
```
|
|
61
60
|
|
|
62
|
-
4.
|
|
61
|
+
4. ### Check Access
|
|
63
62
|
```typescript title="src/routes/billing.ts"
|
|
64
63
|
router.get('/subscription/:customerId', async (req, res) => {
|
|
65
64
|
const subscription = await commet.subscriptions.getActive({ customerId: req.params.customerId })
|
|
@@ -81,7 +80,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
81
80
|
})
|
|
82
81
|
```
|
|
83
82
|
|
|
84
|
-
5.
|
|
83
|
+
5. ### Track Usage
|
|
85
84
|
```typescript title="src/routes/billing.ts"
|
|
86
85
|
router.post('/usage', async (req, res) => {
|
|
87
86
|
await commet.usage.track({
|
|
@@ -95,7 +94,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
95
94
|
```
|
|
96
95
|
Usage is aggregated and billed at end of period.
|
|
97
96
|
|
|
98
|
-
6.
|
|
97
|
+
6. ### Customer Portal
|
|
99
98
|
```typescript title="src/routes/billing.ts"
|
|
100
99
|
router.get('/portal', async (req, res) => {
|
|
101
100
|
const portal = await commet.portal.getUrl({
|
|
@@ -106,7 +105,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
106
105
|
})
|
|
107
106
|
```
|
|
108
107
|
|
|
109
|
-
7.
|
|
108
|
+
7. ### Start Server
|
|
110
109
|
```typescript title="src/index.ts"
|
|
111
110
|
import express from 'express'
|
|
112
111
|
import billingRoutes from './routes/billing'
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-07-28
|
|
3
2
|
title: Integrate with Hono
|
|
4
3
|
description: Add billing and payments to your Hono application.
|
|
5
4
|
---
|
|
@@ -10,7 +9,7 @@ Install the Commet Skill so your coding agent can integrate the current SDK and
|
|
|
10
9
|
npx skills add commet-labs/skills --skill commet
|
|
11
10
|
```
|
|
12
11
|
|
|
13
|
-
1.
|
|
12
|
+
1. ### Install
|
|
14
13
|
### pnpm
|
|
15
14
|
```bash
|
|
16
15
|
pnpm add @commet/node hono
|
|
@@ -24,7 +23,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
24
23
|
bun add @commet/node hono
|
|
25
24
|
```
|
|
26
25
|
|
|
27
|
-
2.
|
|
26
|
+
2. ### Configure
|
|
28
27
|
```bash title=".env"
|
|
29
28
|
COMMET_API_KEY=ck_sandbox_xxx
|
|
30
29
|
```
|
|
@@ -36,7 +35,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
36
35
|
})
|
|
37
36
|
```
|
|
38
37
|
|
|
39
|
-
3.
|
|
38
|
+
3. ### Subscribe
|
|
40
39
|
```typescript title="src/routes/billing.ts"
|
|
41
40
|
import { Hono } from 'hono'
|
|
42
41
|
import { commet } from '../commet'
|
|
@@ -59,7 +58,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
59
58
|
export default billing
|
|
60
59
|
```
|
|
61
60
|
|
|
62
|
-
4.
|
|
61
|
+
4. ### Check Access
|
|
63
62
|
```typescript title="src/routes/billing.ts"
|
|
64
63
|
billing.get('/subscription/:customerId', async (c) => {
|
|
65
64
|
const subscription = await commet.subscriptions.getActive({ customerId: c.req.param('customerId') })
|
|
@@ -81,7 +80,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
81
80
|
})
|
|
82
81
|
```
|
|
83
82
|
|
|
84
|
-
5.
|
|
83
|
+
5. ### Track Usage
|
|
85
84
|
```typescript title="src/routes/billing.ts"
|
|
86
85
|
billing.post('/usage', async (c) => {
|
|
87
86
|
const { customerId } = await c.req.json()
|
|
@@ -97,7 +96,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
97
96
|
```
|
|
98
97
|
Usage is aggregated and billed at end of period.
|
|
99
98
|
|
|
100
|
-
6.
|
|
99
|
+
6. ### Customer Portal
|
|
101
100
|
```typescript title="src/routes/billing.ts"
|
|
102
101
|
billing.get('/portal', async (c) => {
|
|
103
102
|
const customerId = c.get('customerId')
|
|
@@ -108,7 +107,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
108
107
|
})
|
|
109
108
|
```
|
|
110
109
|
|
|
111
|
-
7.
|
|
110
|
+
7. ### Start Server
|
|
112
111
|
### Node.js
|
|
113
112
|
```typescript title="src/index.ts"
|
|
114
113
|
import { serve } from '@hono/node-server'
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-07-28
|
|
3
2
|
title: Integrate with Next.js
|
|
4
3
|
description: Add billing and payments to your Next.js application.
|
|
5
4
|
---
|
|
@@ -10,7 +9,7 @@ Install the Commet Skill so your coding agent can integrate the current SDK and
|
|
|
10
9
|
npx skills add commet-labs/skills --skill commet
|
|
11
10
|
```
|
|
12
11
|
|
|
13
|
-
1.
|
|
12
|
+
1. ### Install
|
|
14
13
|
### pnpm
|
|
15
14
|
```bash
|
|
16
15
|
pnpm add @commet/node @commet/next
|
|
@@ -28,7 +27,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
28
27
|
bun add @commet/node @commet/next
|
|
29
28
|
```
|
|
30
29
|
|
|
31
|
-
2.
|
|
30
|
+
2. ### Configure
|
|
32
31
|
```bash title=".env.local"
|
|
33
32
|
COMMET_API_KEY=ck_sandbox_xxx
|
|
34
33
|
```
|
|
@@ -40,7 +39,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
40
39
|
})
|
|
41
40
|
```
|
|
42
41
|
|
|
43
|
-
3.
|
|
42
|
+
3. ### Create Customer and Subscribe
|
|
44
43
|
`customers.create` is idempotent — if a customer with the same `id` already exists, it returns the existing record.
|
|
45
44
|
```typescript title="app/actions/billing.ts"
|
|
46
45
|
'use server'
|
|
@@ -67,7 +66,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
67
66
|
```
|
|
68
67
|
The customer is redirected to checkout to complete payment. When `checkoutUrl` is `null` no payment is needed and the subscription is already active.
|
|
69
68
|
|
|
70
|
-
4.
|
|
69
|
+
4. ### Check Access
|
|
71
70
|
```typescript title="app/actions/billing.ts"
|
|
72
71
|
export async function getSubscription(customerId: string) {
|
|
73
72
|
const subscription = await commet.subscriptions.getActive({ customerId })
|
|
@@ -83,7 +82,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
83
82
|
}
|
|
84
83
|
```
|
|
85
84
|
|
|
86
|
-
5.
|
|
85
|
+
5. ### Track Usage
|
|
87
86
|
```typescript title="app/actions/usage.ts"
|
|
88
87
|
export async function trackApiCall(customerId: string) {
|
|
89
88
|
await commet.usage.track({
|
|
@@ -95,7 +94,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
95
94
|
```
|
|
96
95
|
Usage is aggregated and billed at end of period.
|
|
97
96
|
|
|
98
|
-
6.
|
|
97
|
+
6. ### Customer Portal
|
|
99
98
|
```typescript title="app/api/commet/portal/route.ts"
|
|
100
99
|
import { CustomerPortal } from '@commet/next'
|
|
101
100
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-07-28
|
|
3
2
|
title: Integrate with Nuxt
|
|
4
3
|
description: Add billing and payments to your Nuxt application.
|
|
5
4
|
---
|
|
@@ -10,7 +9,7 @@ Install the Commet Skill so your coding agent can integrate the current SDK and
|
|
|
10
9
|
npx skills add commet-labs/skills --skill commet
|
|
11
10
|
```
|
|
12
11
|
|
|
13
|
-
1.
|
|
12
|
+
1. ### Install
|
|
14
13
|
### pnpm
|
|
15
14
|
```bash
|
|
16
15
|
pnpm add @commet/node
|
|
@@ -28,7 +27,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
28
27
|
bun add @commet/node
|
|
29
28
|
```
|
|
30
29
|
|
|
31
|
-
2.
|
|
30
|
+
2. ### Configure
|
|
32
31
|
```bash title=".env"
|
|
33
32
|
COMMET_API_KEY=ck_sandbox_xxx
|
|
34
33
|
```
|
|
@@ -50,7 +49,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
50
49
|
})
|
|
51
50
|
```
|
|
52
51
|
|
|
53
|
-
3.
|
|
52
|
+
3. ### Subscribe
|
|
54
53
|
`customers.create` is idempotent — if a customer with the same `id` already exists, it returns the existing record.
|
|
55
54
|
```typescript title="server/api/billing/subscribe.post.ts"
|
|
56
55
|
export default defineEventHandler(async (event) => {
|
|
@@ -67,7 +66,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
67
66
|
})
|
|
68
67
|
```
|
|
69
68
|
|
|
70
|
-
4.
|
|
69
|
+
4. ### Check Access
|
|
71
70
|
```typescript title="server/api/billing/access/[customerId].get.ts"
|
|
72
71
|
export default defineEventHandler(async (event) => {
|
|
73
72
|
const customerId = getRouterParam(event, 'customerId')!
|
|
@@ -90,7 +89,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
90
89
|
})
|
|
91
90
|
```
|
|
92
91
|
|
|
93
|
-
5.
|
|
92
|
+
5. ### Track Usage
|
|
94
93
|
```typescript title="server/api/billing/usage.post.ts"
|
|
95
94
|
export default defineEventHandler(async (event) => {
|
|
96
95
|
const { customerId } = await readBody(event)
|
|
@@ -106,7 +105,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
106
105
|
```
|
|
107
106
|
Usage is aggregated and billed at end of period.
|
|
108
107
|
|
|
109
|
-
6.
|
|
108
|
+
6. ### Customer Portal
|
|
110
109
|
```typescript title="server/api/billing/portal.get.ts"
|
|
111
110
|
export default defineEventHandler(async (event) => {
|
|
112
111
|
const customerId = 'user_123'
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-07-28
|
|
3
2
|
title: Integrate with Remix
|
|
4
3
|
description: Add billing and payments to your Remix application.
|
|
5
4
|
---
|
|
@@ -10,7 +9,7 @@ Install the Commet Skill so your coding agent can integrate the current SDK and
|
|
|
10
9
|
npx skills add commet-labs/skills --skill commet
|
|
11
10
|
```
|
|
12
11
|
|
|
13
|
-
1.
|
|
12
|
+
1. ### Install
|
|
14
13
|
### pnpm
|
|
15
14
|
```bash
|
|
16
15
|
pnpm add @commet/node @remix-run/node
|
|
@@ -28,7 +27,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
28
27
|
bun add @commet/node @remix-run/node
|
|
29
28
|
```
|
|
30
29
|
|
|
31
|
-
2.
|
|
30
|
+
2. ### Configure
|
|
32
31
|
```bash title=".env"
|
|
33
32
|
COMMET_API_KEY=ck_sandbox_xxx
|
|
34
33
|
```
|
|
@@ -41,7 +40,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
41
40
|
})
|
|
42
41
|
```
|
|
43
42
|
|
|
44
|
-
3.
|
|
43
|
+
3. ### Subscribe
|
|
45
44
|
`customers.create` is idempotent — if a customer with the same `id` already exists, it returns the existing record.
|
|
46
45
|
```typescript title="app/routes/billing.subscribe.ts"
|
|
47
46
|
import { json, redirect, type ActionFunctionArgs } from '@remix-run/node'
|
|
@@ -68,7 +67,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
68
67
|
}
|
|
69
68
|
```
|
|
70
69
|
|
|
71
|
-
4.
|
|
70
|
+
4. ### Check Access
|
|
72
71
|
```typescript title="app/routes/billing.status.ts"
|
|
73
72
|
import { json, type LoaderFunctionArgs } from '@remix-run/node'
|
|
74
73
|
import { commet } from '~/lib/commet.server'
|
|
@@ -95,7 +94,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
95
94
|
}
|
|
96
95
|
```
|
|
97
96
|
|
|
98
|
-
5.
|
|
97
|
+
5. ### Track Usage
|
|
99
98
|
```typescript title="app/routes/billing.usage.ts"
|
|
100
99
|
import { json, type ActionFunctionArgs } from '@remix-run/node'
|
|
101
100
|
import { commet } from '~/lib/commet.server'
|
|
@@ -114,7 +113,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
114
113
|
```
|
|
115
114
|
Usage is aggregated and billed at end of period.
|
|
116
115
|
|
|
117
|
-
6.
|
|
116
|
+
6. ### Customer Portal
|
|
118
117
|
```typescript title="app/routes/billing.portal.ts"
|
|
119
118
|
import { redirect, type LoaderFunctionArgs } from '@remix-run/node'
|
|
120
119
|
import { commet } from '~/lib/commet.server'
|