@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 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-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
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-07-28
|
|
3
2
|
title: Integrate with Python
|
|
4
3
|
description: Install and configure the Commet Python 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
|
### pip
|
|
15
14
|
```bash
|
|
16
15
|
pip install commet-sdk
|
|
@@ -24,7 +23,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
24
23
|
poetry add commet-sdk
|
|
25
24
|
```
|
|
26
25
|
|
|
27
|
-
2.
|
|
26
|
+
2. ### Configure
|
|
28
27
|
```bash title=".env"
|
|
29
28
|
COMMET_API_KEY=ck_sandbox_xxx
|
|
30
29
|
```
|
|
@@ -38,7 +37,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
38
37
|
)
|
|
39
38
|
```
|
|
40
39
|
|
|
41
|
-
3.
|
|
40
|
+
3. ### Create Customer and Subscribe
|
|
42
41
|
`customers.create` is idempotent — if a customer with the same `id` already exists, it returns the existing record.
|
|
43
42
|
```python
|
|
44
43
|
response = commet.customers.create(
|
|
@@ -55,7 +54,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
55
54
|
```
|
|
56
55
|
The customer is redirected to checkout to complete payment.
|
|
57
56
|
|
|
58
|
-
4.
|
|
57
|
+
4. ### Check Access
|
|
59
58
|
```python
|
|
60
59
|
sub = commet.subscriptions.get_active(customer_id="user_123")
|
|
61
60
|
status = sub.status if sub else None
|
|
@@ -64,7 +63,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
64
63
|
allowed = access.allowed
|
|
65
64
|
```
|
|
66
65
|
|
|
67
|
-
5.
|
|
66
|
+
5. ### Track Usage
|
|
68
67
|
```python
|
|
69
68
|
commet.usage.track(
|
|
70
69
|
customer_id="user_123",
|
|
@@ -74,7 +73,7 @@ npx skills add commet-labs/skills --skill commet
|
|
|
74
73
|
```
|
|
75
74
|
Usage is aggregated and billed at end of period.
|
|
76
75
|
|
|
77
|
-
6.
|
|
76
|
+
6. ### Multiple Operations
|
|
78
77
|
Call each resource directly with `customer_id`:
|
|
79
78
|
```python
|
|
80
79
|
commet.usage.track(customer_id="user_123", feature_code="api_calls", value=1)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-07-31
|
|
3
2
|
title: Promo Codes
|
|
4
3
|
description: Distribute an existing Offer through a customer-entered checkout code.
|
|
5
4
|
---
|
|
@@ -8,18 +7,29 @@ A Promo Code is a distribution channel. The referenced Offer owns the economic t
|
|
|
8
7
|
|
|
9
8
|
## Create a compatible Offer
|
|
10
9
|
|
|
11
|
-
A Promo Code can reference an Offer with
|
|
10
|
+
A Promo Code can reference an Offer with ordered `percentage`, `amount_off`, or `fixed_price` phases. It can start with one `free_trial` phase when a discount follows it. Each discount phase before the last must have a finite duration.
|
|
12
11
|
|
|
13
12
|
```typescript
|
|
14
13
|
const launchOffer = await commet.offers.create({
|
|
15
|
-
name: 'Launch
|
|
14
|
+
name: 'Launch discount',
|
|
16
15
|
phases: [
|
|
17
16
|
{ type: 'percentage', durationCycles: 2, percentage: 5000 },
|
|
17
|
+
{ type: 'percentage', durationCycles: 3, percentage: 2000 },
|
|
18
18
|
],
|
|
19
19
|
})
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
For a trial followed by a discount, put the trial first:
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
const trialOffer = await commet.offers.create({
|
|
26
|
+
name: 'Early access',
|
|
27
|
+
phases: [
|
|
28
|
+
{ type: 'free_trial', durationDays: 14 },
|
|
29
|
+
{ type: 'percentage', durationCycles: 3, percentage: 2000 },
|
|
30
|
+
],
|
|
31
|
+
})
|
|
32
|
+
```
|
|
23
33
|
|
|
24
34
|
## Create the code
|
|
25
35
|
|
|
@@ -41,12 +51,16 @@ The Promo Code owns:
|
|
|
41
51
|
- the redemption limit;
|
|
42
52
|
- expiration and active state.
|
|
43
53
|
|
|
44
|
-
Updating the Offer changes future redemptions.
|
|
54
|
+
Updating the Offer changes future redemptions of codes that reference it. Each completed checkout counts one redemption and keeps an immutable Offer Application with the phases accepted at that checkout. Editing the Offer does not change earlier redemptions or their renewals.
|
|
55
|
+
|
|
56
|
+
Clients pinned before `2026-07-24` receive only the first phase in the legacy Promo Code discount fields when that phase is `percentage` or `amount_off`. Codes starting with `free_trial` or `fixed_price` cannot be represented and are absent from those older Promo Code endpoints. Use the current Offer API to inspect the complete sequence.
|
|
45
57
|
|
|
46
58
|
## Checkout behavior
|
|
47
59
|
|
|
48
60
|
The customer enters the code during checkout. Commet validates the code, resolves the referenced Offer in the checkout currency, and records an Offer Application with source `promo_code`.
|
|
49
61
|
|
|
62
|
+
When the Offer starts with a trial, a new subscription checkout collects a payment method without charging. Applying that code to a pending first-payment checkout replaces it with a trial setup checkout. Trial codes cannot start a trial on an existing subscription's plan change. One redemption is recorded when setup completes; the first paid invoice follows the trial and uses the next phase. Renewals do not count as new redemptions.
|
|
63
|
+
|
|
50
64
|
If an eligible automatic Introductory Offer applies, the code is rejected with `intro_offer_active`. A Promo Code also cannot be combined with an explicit `offerId`.
|
|
51
65
|
|
|
52
66
|
```typescript
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-08-21
|
|
3
2
|
title: Promotional Offers
|
|
4
3
|
description: Apply any compatible Offer directly for campaigns, retention, and experiments.
|
|
5
4
|
---
|
|
@@ -65,7 +64,7 @@ The same operation on a subscription with a pending payment checkout quotes or r
|
|
|
65
64
|
|
|
66
65
|
Use direct `offerId` when your application decides who receives the terms. Use a Promo Code when the customer should enter a code and the campaign needs redemption restrictions.
|
|
67
66
|
|
|
68
|
-
A Promo Code can
|
|
67
|
+
A Promo Code can distribute multiple discount phases, including `fixed_price`, and can begin with a trial when a discount follows it. A trial-only Offer remains available for direct application.
|
|
69
68
|
|
|
70
69
|
## Related
|
|
71
70
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-07-31
|
|
3
2
|
title: Trial Periods
|
|
4
3
|
description: Use free-trial Offer phases for automatic onboarding or explicit campaigns.
|
|
5
4
|
---
|
|
@@ -8,14 +7,15 @@ A trial is a `free_trial` phase in an Offer. It is not a separate discount syste
|
|
|
8
7
|
|
|
9
8
|
The phase records how long payment is delayed. The application channel decides who receives it:
|
|
10
9
|
|
|
11
|
-
| Channel | Trial behavior
|
|
12
|
-
| ---------------------- |
|
|
13
|
-
| Introductory placement | Applied automatically to an eligible new subscription
|
|
14
|
-
| Direct `offerId` | Applied explicitly by your application
|
|
15
|
-
|
|
|
16
|
-
| `
|
|
10
|
+
| Channel | Trial behavior |
|
|
11
|
+
| ---------------------- | ------------------------------------------------------------------------------------------ |
|
|
12
|
+
| Introductory placement | Applied automatically to an eligible new subscription |
|
|
13
|
+
| Direct `offerId` | Applied explicitly by your application |
|
|
14
|
+
| Promo Code | Customer enters a code for an Offer that starts with a trial and continues with a discount |
|
|
15
|
+
| `customTrialDays` | Creates customer-specific trial terms without a reusable catalog Offer |
|
|
16
|
+
| `skipTrial: true` | Bypasses the automatic trial |
|
|
17
17
|
|
|
18
|
-
Promo
|
|
18
|
+
Promo Code trials require at least one discount phase after the trial. A code can be pre-applied at subscription creation or entered in a pending payment checkout, which then changes to a trial setup checkout.
|
|
19
19
|
|
|
20
20
|
## Reusable trial
|
|
21
21
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-09-23
|
|
3
2
|
title: SDK Reference
|
|
4
3
|
description: Configuration, environments, and pagination
|
|
5
4
|
---
|
|
@@ -55,7 +54,7 @@ List endpoints use cursor-based pagination.
|
|
|
55
54
|
const page = await commet.customers.list({ limit: 25 })
|
|
56
55
|
|
|
57
56
|
if (page.hasMore) {
|
|
58
|
-
const nextPage = await commet.customers.list({
|
|
57
|
+
const nextPage = await commet.customers.list({
|
|
59
58
|
limit: 25,
|
|
60
59
|
cursor: page.nextCursor,
|
|
61
60
|
})
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
lastModified: 2026-09-04
|
|
3
2
|
title: Manage Subscriptions
|
|
4
3
|
description: Create, retrieve, pause, resume, cancel, and reactivate subscriptions.
|
|
5
4
|
---
|
|
@@ -115,6 +114,8 @@ Omitting `priceId` preserves default price and Market resolution. Omitting `offe
|
|
|
115
114
|
|
|
116
115
|
A compatible `pending_payment` checkout may be reused. An incompatible pending selection can be replaced without duplicating a paid subscription.
|
|
117
116
|
|
|
117
|
+
Omitting a `promoCode` or `offerId` that the pending checkout carries, including an Offer assigned through `PUT /subscriptions/{id}/offer`, replaces it with a new subscription and checkout without that benefit. Redirect to the returned `checkoutUrl`; the previous link stops working. To keep the Offer, send it again or assign it to the returned subscription ID.
|
|
118
|
+
|
|
118
119
|
## Retrieve current or historical state
|
|
119
120
|
|
|
120
121
|
**TypeScript**
|