autumn-js calls the way Autumn’s docs explain them. A check asks whether the customer can use a feature, a track records uses of it, and attach gives the customer a plan. Each line names the customer, the feature and the plan, so autumn.check({ customerId: "user_123", featureId: "messages" }) reads as “Check whether the customer “user_123” can use the messages feature”. A check’s answer, kept as allowed, res.allowed or 0.x’s data.allowed, reads as that same question wherever it’s tested.
library: { name: "autumn-js", versions: ">=0.1 <2" }. It reads both majors: 1.x’s camelCase parameters and namespaces (billing.attach, customers.getOrCreate, plans) and 0.x’s snake_case parameters, { data, error } results, products and static Autumn.check(…). Same-named calls kept their meaning between the two, so there is no version option. It only narrates files that import autumn-js or belong to a package that depends on it (see Dependency detection), and only calls on something it can show is an Autumn client: a new Autumn(…), a value typed Autumn, the Autumn class, or an autumn the file imports from the app’s own module. Another SDK’s autumn.attach(…), a Stripe call and a useCustomer from elsewhere are left alone.
Examples
Checking and tracking
English
Plans and billing
English
A backend handler
English
React hooks
English
What it covers
- The client:
new Autumnwith its secret key (or theAUTUMN_SECRET_KEYit falls back to), server URL and fail-open setting. checkwithrequiredBalance,sendEvent,lock, entities, event properties andwithPreview; its answer as a condition, its balance, and 0.x’s{ data, error }.track, negative values, event names,async: false, idempotency keys,trackTokensandbatchTrack; setting usage directly withbalances.updateor 0.xusage; granting balances and finishing locks withbalances.finalize.- Billing:
attach,multiAttach, previews, 0.xcheckout,billing.updatewith its cancel actions and quantities, 0.xcancel, the billing portal and payment setup, with trials, prepaid quantities, proration, discounts and redirects as bullets. The payment, checkout and portal URLs on the results read as what they open. - Customers (
getOrCreate,get,updatewith billing controls,delete, 0.xcreateandupdateBalances), entities in both call styles, plans, products, features, referrals, rewards, licenses and usage totals (events.aggregate, 0.xquery). Invoices, webhooks, keys and sandboxes read by method. autumnHandlerfrom every framework adapter, with how it identifies the customer, and the low-level handler fromautumn-js/backend.- React:
useCustomerand the functions it hands back (attach,checkout,check,track,cancel,updateSubscription,openBillingPortal,openCustomerPortal,setupPayment,refetchand the rest),useEntity,usePricingTable,useListPlans,useReferrals,useListEvents,useAggregateEventsandusePaywall. Components such asPricingTableandCheckoutDialogare read by the React plugin like any other component. - Better Auth’s
autumn()plugin is read by the Better Auth plugin.
Translating
The English phrasebook is exported asen and typed as AutumnPhrases.