Claude-skill-registry autumn-best-practices
Skill for integrating Autumn - the billing and entitlements layer over Stripe.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/autumn-best-practices" ~/.claude/skills/majiayu000-claude-skill-registry-autumn-best-practices && rm -rf "$T"
manifest:
skills/data/autumn-best-practices/SKILL.mdsource content
Autumn Integration Guide
Always consult docs.useautumn.com for code examples and latest API.
Autumn is a TypeScript-first billing SDK supporting subscriptions, usage-based pricing, credits, trials, and more via Stripe.
Quick Reference
Environment Variables
- API key (required). Get one at app.useautumn.comAUTUMN_SECRET_KEY
Installation
npm install autumn-js # Node.js pip install autumn-py # Python
Core Methods
| Method | Purpose |
|---|---|
| Create or get customer (idempotent) |
| Get Stripe URL or payment preview |
| Confirm purchase (card on file) |
| Cancel subscription |
| Verify feature access |
| Record usage |
| Get products with billing scenarios |
Core Config Options
| Option | Notes |
|---|---|
| Required. From env |
| Optional. Defaults to |
Billing Patterns
Check → Work → Track
Always follow this order for protected actions:
const { data } = await autumn.check({ customer_id, feature_id: "api_calls" }); if (!data.allowed) return { error: "Limit reached" }; const result = await doWork(); await autumn.track({ customer_id, feature_id: "api_calls", value: 1 }); return result;
Two-Step Checkout
const { data } = await autumn.checkout({ customer_id, product_id: "pro" }); if (data.url) return redirect(data.url); // New customer → Stripe // Returning customer → show confirmation, then: await autumn.attach({ customer_id, product_id: "pro" });
Product Scenarios
Use
products.list to get scenarios. Don't build custom logic.
| Scenario | Meaning |
|---|---|
| Not subscribed |
| Currently on plan |
| Scheduled for future |
| Higher tier available |
| Lower tier available |
| Cancelled, can reactivate |
Feature Types
| Type | Behavior |
|---|---|
| Access granted or denied |
| Usage tracked against limit |
| Pool for multiple features |
React Hooks
| Hook | Purpose |
|---|---|
| Get customer, checkout, attach, check |
| Get products with scenarios |
import { AutumnProvider } from "autumn-js/react"; <AutumnProvider>{children}</AutumnProvider>
Handler Imports
| Framework | Import |
|---|---|
| Next.js | |
| React Router | |
| Hono | |
| Express | |
| Fastify | |
| Generic | |
Common Gotchas
- URL field - Checkout URL is
, notdata.urldata.checkout_url - Frontend checks - For UX only. Always enforce on backend
- Track after success - Only track usage after work completes
- Credit systems - Track metered features, not the credit system itself
- Cancel via free plan - Prefer
overattach({ product_id: "free" })cancel() - Idempotent creation -
returns existing customer if ID existscustomers.create