Loading...
Loading...
Integrate Commet billing and payments into any application. Use when working with @commet/node, @commet/next, @commet/better-auth, the Commet CLI, or building billing features like subscriptions, usage tracking, seat management, checkout, customer portal, webhooks, feature gating, or payment flows. Triggers on imports from "@commet/node", "@commet/next", "@commet/better-auth", commet SDK usage, billing integration tasks, or mentions of Commet.
npx skill4agent add commet-labs/commet-skills commet| Package | Purpose | Install |
|---|---|---|
| Core SDK - customers, subscriptions, usage, seats, features, portal, webhooks | |
| Next.js helpers - webhook handler, customer portal, pricing markdown | |
| Vercel AI SDK middleware - automatic AI token usage billing | |
| Better Auth plugin - auto customer sync, auth-scoped billing | |
| CLI - login, link, pull types, scaffold projects from templates | |
import { Commet } from "@commet/node";
const commet = new Commet({
apiKey: process.env.COMMET_API_KEY!, // ck_xxx format
environment: "production", // "sandbox" | "production"
});https://sandbox.commet.cohttps://commet.cocommet logincommet linkcommet pull.commet/types.d.tsexternalIdsubscriptions.create()checkoutUrlsubscriptions.get()usage.track()seats.add/remove/set()features.check()features.canUse()features.get()portal.getUrl()@commet/node@commet/next@commet/ai-sdk@commet/better-authsubscriptions.get()features.check()features.list()// Recommended: query state directly
const { data: sub } = await commet.subscriptions.get("user_123");
if (sub?.status === "active") { /* grant access */ }
// Recommended: feature gating
const { data } = await commet.features.check({ code: "advanced_analytics", externalId: "user_123" });
if (!data?.allowed) { /* show upgrade prompt */ }externalIdcustomerIdcus_xxxexternalIdexternalIdconst customer = commet.customer("user_123");
await customer.usage.track("api_calls", 1);
await customer.features.canUse("team_members");
await customer.seats.add("editor");
await customer.subscription.get();
await customer.portal.getUrl();await commet.usage.track({
externalId: "user_123",
feature: "api_calls",
idempotencyKey: `req_${requestId}`,
});import { CommetAPIError, CommetValidationError } from "@commet/node";
try {
await commet.subscriptions.create({ ... });
} catch (error) {
if (error instanceof CommetValidationError) {
console.log(error.validationErrors); // { field: ["message"] }
}
if (error instanceof CommetAPIError) {
console.log(error.statusCode, error.code);
}
}COMMET_API_KEY=ck_xxx # API key from dashboard
COMMET_ENVIRONMENT=sandbox # sandbox | production
COMMET_WEBHOOK_SECRET=whsec_xxx # Optional - webhook secret for signature verification