Skip to main content

Installation

Requirements: Node.js 18+. TypeScript is optional but fully supported.

Upgrading to 2.0

2.0 removes calls that were deprecated in 1.x:
  • recordUsage(): use credits.consume.
  • Plan.payment_providers, Plan.created_at and Plan.updated_at: use paymentProviders, createdAt and updatedAt.
  • organization.type on the plans, tenant and subscriptions responses: read plans[].product.type.
It also adds Plan.seatTiers and planPeriodCharge() for tiered seat plans, and prorationId on createProrationCheckout can be null.

Initialize the Client

Configuration Options

Tenant Management

The ID you pass as externalTenantId is your own ID for the customer. The dashboard lists the tenant under Customers. Pass ownerEmail: it becomes the customer’s billing email, which the customer needs to sign in to their billing page. An email set in the dashboard is never overwritten.

Plans

planPeriodCharge is exported next to CrovverClient (import { CrovverClient, planPeriodCharge } from "crovver-node"). Use it rather than reading perSeatPrice, which is 0 on a tiered plan.

Subscriptions

Feature Entitlements

Credits

Credits meter usage against a plan’s allowances. Each pool is keyed by a meter key, such as ai_tokens.

Check balance

The result is keyed by pool. Each pool has baseRemaining (plan credits), addonRemaining, total, limit, limitBehavior and nextExpiry.

Consume credits

consume is idempotent. Sending the same idempotencyKey twice returns the first result and deducts nothing.
ConsumeInput fields: ConsumeResponse fields: To scope a balance or consume call to one product by its slug, call the REST endpoints with productSlug. See Consume credits.

Add-ons

Add-ons let customers buy extra credits without changing plan.

List available add-ons

Only add-ons compatible with the customer’s current plan are listed, priced in the subscription’s currency.

Purchase an add-on

Get active add-on credits


Seats

For per-seat plans, record which of your users hold a seat, and charge for more seats when a team grows.
See Seat-based billing for the full flow.

Usage limits (deprecated)

checkUsageLimit is deprecated and recordUsage was removed in 2.0: usage sent through it was never counted. Use credits.consume and credits.balance instead.

Checkout

Invoices

Error Handling

5xx errors, 429, and 408 responses are retried automatically with exponential backoff. Checkout endpoints are never retried to prevent duplicate charges.