@commet/node 9.4.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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- 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/promo-codes.md +1 -1
- package/docs/api-reference/subscriptions.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 +14 -8
- package/docs/documentation/cli.md +1 -2
- package/docs/documentation/create-api-key.md +0 -1
- 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 +3 -4
- 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 +2 -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 +1 -2
- package/docs/documentation/subscriptions/manage-subscriptions.md +2 -1
- 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/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 +0 -1
- package/docs/knowledge-base/what-invoices-do-customers-receive-and-when.md +0 -1
- package/docs/manifest.json +72 -157
- package/docs/platform-documentation.md +69 -155
- package/docs/webhooks/introduction.md +0 -1
- package/docs/webhooks.md +2 -0
- 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 -89
- package/docs/webhooks/payment-dispute-resolved.md +0 -52
- package/docs/webhooks/payment-disputed.md +0 -49
- package/docs/webhooks/payment-failed.md +0 -178
- package/docs/webhooks/payment-link-canceled.md +0 -41
- package/docs/webhooks/payment-link-completed.md +0 -89
- package/docs/webhooks/payment-link-created.md +0 -41
- package/docs/webhooks/payment-link-failed.md +0 -87
- package/docs/webhooks/payment-method-attached.md +0 -44
- package/docs/webhooks/payment-method-updated.md +0 -37
- package/docs/webhooks/payment-received.md +0 -202
- package/docs/webhooks/payment-recovered.md +0 -43
- 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 -58
- 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-pause-revoked.md +0 -27
- package/docs/webhooks/subscription-pause-scheduled.md +0 -35
- package/docs/webhooks/subscription-pause-updated.md +0 -31
- package/docs/webhooks/subscription-paused.md +0 -35
- 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-resume-failed.md +0 -33
- package/docs/webhooks/subscription-resumed.md +0 -35
- 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,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'
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-07-28
|
|
3
2
|
title: Integrate with SvelteKit
|
|
4
3
|
description: Add billing and payments to your SvelteKit 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
|
```
|
|
@@ -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="src/routes/api/billing/subscribe/+server.ts"
|
|
47
46
|
import { json } from '@sveltejs/kit'
|
|
@@ -62,7 +61,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
62
61
|
}
|
|
63
62
|
```
|
|
64
63
|
|
|
65
|
-
4.
|
|
64
|
+
4. ### Check Access
|
|
66
65
|
```typescript title="src/routes/api/billing/access/[customerId]/+server.ts"
|
|
67
66
|
import { json } from '@sveltejs/kit'
|
|
68
67
|
import { commet } from '$lib/server/commet'
|
|
@@ -84,7 +83,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
84
83
|
}
|
|
85
84
|
```
|
|
86
85
|
|
|
87
|
-
5.
|
|
86
|
+
5. ### Track Usage
|
|
88
87
|
```typescript title="src/routes/api/billing/usage/+server.ts"
|
|
89
88
|
import { json } from '@sveltejs/kit'
|
|
90
89
|
import { commet } from '$lib/server/commet'
|
|
@@ -104,7 +103,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
104
103
|
```
|
|
105
104
|
Usage is aggregated and billed at end of period.
|
|
106
105
|
|
|
107
|
-
6.
|
|
106
|
+
6. ### Customer Portal
|
|
108
107
|
```typescript title="src/routes/api/billing/portal/+server.ts"
|
|
109
108
|
import { redirect } from '@sveltejs/kit'
|
|
110
109
|
import { commet } from '$lib/server/commet'
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-09-24
|
|
3
2
|
title: Transactions, Refunds, and Retries
|
|
4
3
|
description: Inspect provider-neutral payment attempts, refund successful charges, and retry failed renewals safely.
|
|
5
4
|
---
|
|
@@ -137,6 +136,8 @@ The operation requests a full refund and returns its actual provider-neutral sta
|
|
|
137
136
|
|
|
138
137
|
The subscription and its renewal schedule stay as they were, even when the payment is fully refunded. To end the subscription, [cancel it separately](/docs/manage-subscriptions).
|
|
139
138
|
|
|
139
|
+
When Commet processes the payment as [Merchant of Record](/docs/merchant-of-record) and the card issuer reports it as fraudulent, Commet automatically refunds what remains of it to avoid a chargeback. The transaction appears as refunded and you receive [`payment.refunded`](/docs/webhooks/payment-refunded). The refunded amount, excluding refunded taxes, is debited from your balance, and Commet's and the processor's fees are not returned.
|
|
140
|
+
|
|
140
141
|
## Retry a failed renewal
|
|
141
142
|
|
|
142
143
|
**TypeScript**
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-07-28
|
|
3
2
|
title: Integrate with Laravel
|
|
4
3
|
description: Add billing and payments to your Laravel 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
|
composer require commet/commet-php
|
|
16
15
|
```
|
|
17
16
|
|
|
18
|
-
2.
|
|
17
|
+
2. ### Configure
|
|
19
18
|
```bash title=".env"
|
|
20
19
|
COMMET_API_KEY=ck_sandbox_xxx
|
|
21
20
|
COMMET_WEBHOOK_SECRET=whsec_xxx
|
|
@@ -47,7 +46,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
47
46
|
],
|
|
48
47
|
```
|
|
49
48
|
|
|
50
|
-
3.
|
|
49
|
+
3. ### Subscribe
|
|
51
50
|
```php title="app/Http/Controllers/BillingController.php"
|
|
52
51
|
<?php
|
|
53
52
|
|
|
@@ -87,7 +86,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
87
86
|
}
|
|
88
87
|
```
|
|
89
88
|
|
|
90
|
-
4.
|
|
89
|
+
4. ### Check Access
|
|
91
90
|
```php title="app/Http/Controllers/BillingController.php"
|
|
92
91
|
public function getSubscription(string $customerId): JsonResponse
|
|
93
92
|
{
|
|
@@ -112,7 +111,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
112
111
|
}
|
|
113
112
|
```
|
|
114
113
|
|
|
115
|
-
5.
|
|
114
|
+
5. ### Track Usage
|
|
116
115
|
```php title="app/Http/Controllers/BillingController.php"
|
|
117
116
|
public function trackUsage(Request $request): JsonResponse
|
|
118
117
|
{
|
|
@@ -131,7 +130,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
131
130
|
```
|
|
132
131
|
Usage is aggregated and billed at end of period.
|
|
133
132
|
|
|
134
|
-
6.
|
|
133
|
+
6. ### Customer Portal
|
|
135
134
|
```php title="app/Http/Controllers/BillingController.php"
|
|
136
135
|
use Illuminate\Http\RedirectResponse;
|
|
137
136
|
|
|
@@ -143,7 +142,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
143
142
|
}
|
|
144
143
|
```
|
|
145
144
|
|
|
146
|
-
7.
|
|
145
|
+
7. ### Webhooks
|
|
147
146
|
```php title="app/Http/Controllers/WebhookController.php"
|
|
148
147
|
<?php
|
|
149
148
|
|
|
@@ -198,7 +197,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
198
197
|
})
|
|
199
198
|
```
|
|
200
199
|
|
|
201
|
-
8.
|
|
200
|
+
8. ### Routes
|
|
202
201
|
```php title="routes/api.php"
|
|
203
202
|
<?php
|
|
204
203
|
|