Installation
Upgrading to 2.0
2.0 removes calls that were deprecated in 1.x:recordUsage(): usecredits.consume.Plan.payment_providers,Plan.created_atandPlan.updated_at: usepaymentProviders,createdAtandupdatedAt.organization.typeon the plans, tenant and subscriptions responses: readplans[].product.type.
Plan.seatTiers and planPeriodCharge() for tiered seat plans, and prorationId on createProrationCheckout can be null.
Initialize the Client
Configuration Options
Tenant Management
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 asai_tokens.
Check balance
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
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.Usage limits (deprecated)
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.