@commet/node 9.4.0 → 9.6.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 +41 -41
- package/dist/index.d.ts +41 -41
- 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/offers.md +2 -2
- package/docs/api-reference/plans.md +1 -1
- package/docs/api-reference/promo-codes.md +3 -3
- package/docs/api-reference/subscriptions.md +4 -4
- package/docs/documentation/api-versioning.md +2 -2
- package/docs/documentation/better-auth.md +0 -1
- package/docs/documentation/choose-a-billing-model.md +14 -8
- package/docs/documentation/cli.md +14 -15
- 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 +10 -10
- 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 +1 -2
- package/docs/documentation/plans/configure-features.md +0 -1
- package/docs/documentation/plans/consumption-models.md +7 -8
- 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 +1 -2
- 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 +8 -9
- package/docs/knowledge-base/how-do-monthly-quarterly-and-yearly-billing-work.md +6 -7
- 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 +1 -2
- package/docs/knowledge-base/what-happens-when-a-customer-changes-plans.md +2 -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 +13 -14
- package/docs/manifest.json +72 -157
- package/docs/platform-documentation.md +69 -155
- package/docs/schemas.md +10 -9
- 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 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
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-07-28
|
|
3
2
|
title: Integrate with PHP
|
|
4
3
|
description: Install and configure the Commet PHP SDK.
|
|
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
|
```
|
|
@@ -31,7 +30,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
31
30
|
);
|
|
32
31
|
```
|
|
33
32
|
|
|
34
|
-
3.
|
|
33
|
+
3. ### Create Customer and Subscribe
|
|
35
34
|
`customers->create` is idempotent — if a customer with the same `id` already exists, it returns the existing record.
|
|
36
35
|
```php
|
|
37
36
|
$commet->customers->create(
|
|
@@ -48,7 +47,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
48
47
|
```
|
|
49
48
|
The customer is redirected to checkout to complete payment.
|
|
50
49
|
|
|
51
|
-
4.
|
|
50
|
+
4. ### Check Access
|
|
52
51
|
```php
|
|
53
52
|
$sub = $commet->subscriptions->getActive('user_123');
|
|
54
53
|
$status = $sub?->status->value;
|
|
@@ -57,7 +56,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
57
56
|
$allowed = $access->allowed;
|
|
58
57
|
```
|
|
59
58
|
|
|
60
|
-
5.
|
|
59
|
+
5. ### Track Usage
|
|
61
60
|
```php
|
|
62
61
|
$commet->usage->track(
|
|
63
62
|
customerId: 'user_123',
|
|
@@ -67,7 +66,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
67
66
|
```
|
|
68
67
|
Usage is aggregated and billed at end of period.
|
|
69
68
|
|
|
70
|
-
6.
|
|
69
|
+
6. ### Webhooks
|
|
71
70
|
```php
|
|
72
71
|
<?php
|
|
73
72
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-07-28
|
|
3
2
|
title: Integrate with Symfony
|
|
4
3
|
description: Add billing and payments to your Symfony 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
|
|
@@ -51,7 +50,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
51
50
|
}
|
|
52
51
|
```
|
|
53
52
|
|
|
54
|
-
3.
|
|
53
|
+
3. ### Subscribe
|
|
55
54
|
```php title="src/Controller/BillingController.php"
|
|
56
55
|
<?php
|
|
57
56
|
|
|
@@ -91,7 +90,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
91
90
|
}
|
|
92
91
|
```
|
|
93
92
|
|
|
94
|
-
4.
|
|
93
|
+
4. ### Check Access
|
|
95
94
|
```php title="src/Controller/BillingController.php"
|
|
96
95
|
#[Route('/billing/subscription/{customerId}', methods: ['GET'])]
|
|
97
96
|
public function getSubscription(string $customerId): JsonResponse
|
|
@@ -118,7 +117,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
118
117
|
}
|
|
119
118
|
```
|
|
120
119
|
|
|
121
|
-
5.
|
|
120
|
+
5. ### Track Usage
|
|
122
121
|
```php title="src/Controller/BillingController.php"
|
|
123
122
|
#[Route('/billing/usage', methods: ['POST'])]
|
|
124
123
|
public function trackUsage(Request $request): JsonResponse
|
|
@@ -136,7 +135,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
136
135
|
```
|
|
137
136
|
Usage is aggregated and billed at end of period.
|
|
138
137
|
|
|
139
|
-
6.
|
|
138
|
+
6. ### Customer Portal
|
|
140
139
|
```php title="src/Controller/BillingController.php"
|
|
141
140
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
|
142
141
|
|
|
@@ -149,7 +148,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
149
148
|
}
|
|
150
149
|
```
|
|
151
150
|
|
|
152
|
-
7.
|
|
151
|
+
7. ### Webhooks
|
|
153
152
|
```php title="src/Controller/WebhookController.php"
|
|
154
153
|
<?php
|
|
155
154
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-08-16
|
|
3
2
|
title: Balance and Top-Ups
|
|
4
3
|
description: Configure prepaid monetary usage, adjust a subscription balance, and let customers buy more.
|
|
5
4
|
---
|
|
@@ -10,7 +9,7 @@ The Balance consumption model gives a subscription a monetary allowance. Billabl
|
|
|
10
9
|
|
|
11
10
|
In **Plans**, choose **Balance**, set the amount included at each reset, and add billable features. Use [AI Token Billing](/docs/ai-token-billing) when model token cost and margin determine the charge.
|
|
12
11
|
|
|
13
|
-
Plan balance resets monthly for monthly, quarterly, yearly, free, and one-time plans. Weekly plans reset every seven days. Purchased top-ups do not survive the next reset.
|
|
12
|
+
Plan balance resets monthly for monthly, quarterly, semiannual, yearly, free, and one-time plans. Weekly plans reset every seven days. Purchased top-ups do not survive the next reset.
|
|
14
13
|
|
|
15
14
|
## Adjust balance without charging
|
|
16
15
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-07-10
|
|
3
2
|
title: Consumption Models
|
|
4
3
|
description: Understand the three ways customers consume and pay for features in Commet plans.
|
|
5
4
|
---
|
|
@@ -63,13 +62,13 @@ Set a margin percentage instead of a fixed price. Commet looks up the model's to
|
|
|
63
62
|
|
|
64
63
|
## Comparison
|
|
65
64
|
|
|
66
|
-
| Aspect | Metered
|
|
67
|
-
| -------------------- |
|
|
68
|
-
| **When exceeded** | Overage at period end
|
|
69
|
-
| **Reset behavior** | Usage resets to 0 each period
|
|
70
|
-
| **Purchased extras** | N/A
|
|
71
|
-
| **Reset frequency** | Weekly plans reset every 7 days. Monthly, quarterly, yearly, one-time, and free plans reset monthly | Same | Same |
|
|
72
|
-
| **Customer portal** | View usage
|
|
65
|
+
| Aspect | Metered | Credits | Balance |
|
|
66
|
+
| -------------------- | --------------------------------------------------------------------------------------------------------------- | ------------------------------ | ----------------------------------------- |
|
|
67
|
+
| **When exceeded** | Overage at period end | Blocked or buy packs | Overage at period end |
|
|
68
|
+
| **Reset behavior** | Usage resets to 0 each period | Plan credits reset each period | Balance resets to plan amount each period |
|
|
69
|
+
| **Purchased extras** | N/A | Credits persist forever | Top-ups reset at period |
|
|
70
|
+
| **Reset frequency** | Weekly plans reset every 7 days. Monthly, quarterly, semiannual, yearly, one-time, and free plans reset monthly | Same | Same |
|
|
71
|
+
| **Customer portal** | View usage | Buy credit packs | Add balance (top-up) |
|
|
73
72
|
|
|
74
73
|
## Overage restrictions by plan type
|
|
75
74
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-07-28
|
|
3
2
|
title: Integrate with Django
|
|
4
3
|
description: Add billing and payments to your Django 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
|
### pip
|
|
15
14
|
```bash
|
|
16
15
|
pip install commet-sdk django
|
|
@@ -24,7 +23,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
24
23
|
poetry add commet-sdk django
|
|
25
24
|
```
|
|
26
25
|
|
|
27
|
-
2.
|
|
26
|
+
2. ### Configure
|
|
28
27
|
```bash title=".env"
|
|
29
28
|
COMMET_API_KEY=ck_sandbox_xxx
|
|
30
29
|
```
|
|
@@ -37,7 +36,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
37
36
|
)
|
|
38
37
|
```
|
|
39
38
|
|
|
40
|
-
3.
|
|
39
|
+
3. ### Subscribe
|
|
41
40
|
```python title="billing/views.py"
|
|
42
41
|
import json
|
|
43
42
|
from django.http import JsonResponse
|
|
@@ -62,7 +61,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
62
61
|
return JsonResponse({"checkout_url": subscription.checkout_url})
|
|
63
62
|
```
|
|
64
63
|
|
|
65
|
-
4.
|
|
64
|
+
4. ### Check Access
|
|
66
65
|
```python title="billing/views.py"
|
|
67
66
|
def get_subscription(request, customer_id):
|
|
68
67
|
sub = commet.subscriptions.get_active(customer_id=customer_id)
|
|
@@ -76,7 +75,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
76
75
|
return JsonResponse({"allowed": result.allowed})
|
|
77
76
|
```
|
|
78
77
|
|
|
79
|
-
5.
|
|
78
|
+
5. ### Track Usage
|
|
80
79
|
```python title="billing/views.py"
|
|
81
80
|
@require_POST
|
|
82
81
|
def track_usage(request):
|
|
@@ -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. ### Customer Portal
|
|
96
95
|
```python title="billing/views.py"
|
|
97
96
|
from django.shortcuts import redirect
|
|
98
97
|
|
|
@@ -102,7 +101,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
102
101
|
return redirect(result.portal_url)
|
|
103
102
|
```
|
|
104
103
|
|
|
105
|
-
7.
|
|
104
|
+
7. ### Webhooks
|
|
106
105
|
```python title="billing/views.py"
|
|
107
106
|
import os
|
|
108
107
|
|
|
@@ -131,7 +130,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
131
130
|
return JsonResponse({"ok": True})
|
|
132
131
|
```
|
|
133
132
|
|
|
134
|
-
8.
|
|
133
|
+
8. ### URLs
|
|
135
134
|
```python title="billing/urls.py"
|
|
136
135
|
from django.urls import path
|
|
137
136
|
from . import views
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-07-28
|
|
3
2
|
title: Integrate with FastAPI
|
|
4
3
|
description: Add billing and payments to your FastAPI 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
|
### pip
|
|
15
14
|
```bash
|
|
16
15
|
pip install commet-sdk fastapi uvicorn
|
|
@@ -24,7 +23,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
24
23
|
poetry add commet-sdk fastapi uvicorn
|
|
25
24
|
```
|
|
26
25
|
|
|
27
|
-
2.
|
|
26
|
+
2. ### Configure
|
|
28
27
|
```bash title=".env"
|
|
29
28
|
COMMET_API_KEY=ck_sandbox_xxx
|
|
30
29
|
```
|
|
@@ -37,7 +36,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
37
36
|
)
|
|
38
37
|
```
|
|
39
38
|
|
|
40
|
-
3.
|
|
39
|
+
3. ### Subscribe
|
|
41
40
|
```python title="routes/billing.py"
|
|
42
41
|
from fastapi import APIRouter, HTTPException
|
|
43
42
|
from pydantic import BaseModel
|
|
@@ -66,7 +65,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
66
65
|
return {"checkout_url": subscription.checkout_url}
|
|
67
66
|
```
|
|
68
67
|
|
|
69
|
-
4.
|
|
68
|
+
4. ### Check Access
|
|
70
69
|
```python title="routes/billing.py"
|
|
71
70
|
@router.get("/subscription/{customer_id}")
|
|
72
71
|
def get_subscription(customer_id: str):
|
|
@@ -82,7 +81,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
82
81
|
return {"allowed": result.allowed}
|
|
83
82
|
```
|
|
84
83
|
|
|
85
|
-
5.
|
|
84
|
+
5. ### Track Usage
|
|
86
85
|
```python title="routes/billing.py"
|
|
87
86
|
class UsageRequest(BaseModel):
|
|
88
87
|
customer_id: str
|
|
@@ -100,7 +99,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
100
99
|
```
|
|
101
100
|
Usage is aggregated and billed at end of period.
|
|
102
101
|
|
|
103
|
-
6.
|
|
102
|
+
6. ### Customer Portal
|
|
104
103
|
```python title="routes/billing.py"
|
|
105
104
|
from fastapi.responses import RedirectResponse
|
|
106
105
|
|
|
@@ -111,7 +110,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
111
110
|
return RedirectResponse(result.portal_url)
|
|
112
111
|
```
|
|
113
112
|
|
|
114
|
-
7.
|
|
113
|
+
7. ### Webhooks
|
|
115
114
|
```python title="routes/webhooks.py"
|
|
116
115
|
import os
|
|
117
116
|
|
|
@@ -142,7 +141,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
142
141
|
return Response(status_code=200)
|
|
143
142
|
```
|
|
144
143
|
|
|
145
|
-
8.
|
|
144
|
+
8. ### Start Server
|
|
146
145
|
```python title="main.py"
|
|
147
146
|
from fastapi import FastAPI
|
|
148
147
|
from routes.billing import router as billing_router
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-07-28
|
|
3
2
|
title: Integrate with Flask
|
|
4
3
|
description: Add billing and payments to your Flask 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
|
### pip
|
|
15
14
|
```bash
|
|
16
15
|
pip install commet-sdk flask
|
|
@@ -24,7 +23,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
24
23
|
poetry add commet-sdk flask
|
|
25
24
|
```
|
|
26
25
|
|
|
27
|
-
2.
|
|
26
|
+
2. ### Configure
|
|
28
27
|
```bash title=".env"
|
|
29
28
|
COMMET_API_KEY=ck_sandbox_xxx
|
|
30
29
|
```
|
|
@@ -37,7 +36,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
37
36
|
)
|
|
38
37
|
```
|
|
39
38
|
|
|
40
|
-
3.
|
|
39
|
+
3. ### Subscribe
|
|
41
40
|
```python title="routes/billing.py"
|
|
42
41
|
from flask import Blueprint, request, jsonify, redirect
|
|
43
42
|
from commet_client import commet
|
|
@@ -62,7 +61,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
62
61
|
return jsonify({"checkout_url": subscription.checkout_url})
|
|
63
62
|
```
|
|
64
63
|
|
|
65
|
-
4.
|
|
64
|
+
4. ### Check Access
|
|
66
65
|
```python title="routes/billing.py"
|
|
67
66
|
@billing.route("/subscription/<customer_id>")
|
|
68
67
|
def get_subscription(customer_id):
|
|
@@ -78,7 +77,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
78
77
|
return jsonify({"allowed": result.allowed})
|
|
79
78
|
```
|
|
80
79
|
|
|
81
|
-
5.
|
|
80
|
+
5. ### Track Usage
|
|
82
81
|
```python title="routes/billing.py"
|
|
83
82
|
@billing.route("/usage", methods=["POST"])
|
|
84
83
|
def track_usage():
|
|
@@ -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
|
```python title="routes/billing.py"
|
|
99
98
|
@billing.route("/portal")
|
|
100
99
|
def portal():
|
|
@@ -102,7 +101,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
102
101
|
return redirect(result.portal_url)
|
|
103
102
|
```
|
|
104
103
|
|
|
105
|
-
7.
|
|
104
|
+
7. ### Webhooks
|
|
106
105
|
```python title="routes/webhooks.py"
|
|
107
106
|
import os
|
|
108
107
|
|
|
@@ -131,7 +130,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
131
130
|
return "", 200
|
|
132
131
|
```
|
|
133
132
|
|
|
134
|
-
8.
|
|
133
|
+
8. ### Start Server
|
|
135
134
|
```python title="app.py"
|
|
136
135
|
from flask import Flask
|
|
137
136
|
from routes.billing import billing
|