Commercial ledger lanes
Each lane owns a different fact: access, invoice, usage, license, legal, or acquisition.
- @nebutra/access-gateinvite lifecycle for controlled SaaS access
- @nebutra/billingCreem, ChinaPay, credits, manual
- @nebutra/meteringusage records and billing handoff
- @nebutra/licenseissuance, validation, lifecycle events
- @nebutra/legalpolicy content and compliance surfaces
What it owns
- Billing provider adapters, subscription lifecycle, and metering contracts
- Access-gate invites, licensing, legal content, marketing primitives, and waitlist
- Commercial boundaries that apps expose but do not redefine
Where it stops
- Landing copy can link to commerce contracts; it does not own pricing behavior.
- Auth and billing connect through tenant identifiers, not shared UI state.
How we know it works
- access-gate lifecycle tests and package status docs
- billing model docs and release-surface verification
In code
1import { createCheckoutSession } from "@nebutra/billing";
2
3const session = await createCheckoutSession({
4 customerId: org.stripeCustomerId,
5 priceId: "price_pro_monthly",
6 successUrl: `${origin}/billing/success`,
7 cancelUrl: `${origin}/billing`,
8});
9
10return Response.redirect(session.url);Packages
9 packages in packages/commerce.
Pre-launch access gate — invite-code redemption, position queue, drip-release windows. Layers on top of @nebutra/waitlist.
Billing on Creem (cards worldwide, merchant of record), plus WeChat Pay / Alipay for mainland China (or manual, for offline invoicing). Same Subscription / Invoice / Customer surface for every backend.
- eventinvoice.paid{ id, amount, currency }
- eventuser.created{ id, email }
- eventsubscription.canceled{ tenantId, reason }
- eventfeature.gated{ flag, actorId }
TypeScript-validated · zero-runtime contracts
Cross-package event, identity, billing, and notification type contracts. The shared TypeScript boundary that lets commerce talk to iam, queue, webhooks.
Legal entity primitives — corp filings, registered agents, jurisdiction-aware ToS/Privacy generation. Feeds the legal section of @nebutra/preset.
License key generation, validation, and revocation. Ed25519-signed, offline-verifiable, with seat-count and expiry enforcement.
Shared marketing-site primitives — hero blocks, pricing tables, FAQ accordions — reused by landing and product marketing surfaces with the brand tokens already wired.
Usage metering on ClickHouse — sub-second ingestion, per-tenant quota lookup, ready to feed metered billing or in-product limits.
Pre-launch waitlist for the foundation tier — invite codes, position queues, referral counts, and operator dashboards.