inite-billing-service
Health Uyari
- License — License: AGPL-3.0
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 6 GitHub stars
Code Uyari
- process.env — Environment variable access in .github/workflows/ai-issue-dedup.yml
- fs module — File system access in .github/workflows/ai-issue-dedup.yml
- process.env — Environment variable access in .github/workflows/ai-issue-triage.yml
- fs module — File system access in .github/workflows/ai-issue-triage.yml
Permissions Gecti
- Permissions — No dangerous permissions requested
Bu listing icin henuz AI raporu yok.
Self-hosted, payment-rail-agnostic billing — subscriptions, metered credits, checkout, Stripe + crypto/USDC + PIX + IAP, wallets for AI agents, MCP. Lago/Stripe Billing alternative.
INITE Billing Service
Payment-rail-agnostic, AI-first billing gateway — subscriptions, metered credits, entitlements, affiliates.
One deployable service that is the single source of truth for money across the INITE ecosystem:
Stripe, crypto (ETH/SOL/TON/TRON), Apple/Google IAP and regional rails behind one state machine,
with an embedded Claude assistant, AI dunning/win-back outreach, and usage metering for AI products.
Website · Quick start · Architecture · API · AI features · Operations · Contributing
Why INITE Billing
Most billing stacks make you choose: a SaaS gateway that owns your money flow
(Stripe Billing, Chargebee) or a bare payments library that leaves
subscriptions, entitlements and dunning to you. INITE Billing is a single
self-hostable service that ships the entire money lifecycle — catalog,
checkout, subscriptions, credits, entitlements, affiliate program, retention
automation — behind one payment-agnostic state machine, with the payment
provider reduced to a pluggable adapter.
- Rail-agnostic by design — Stripe, ONE, Lava, Apple IAP, Google Play
RTDN, and native multi-chain crypto (ETH/SOL/TON/TRON) implement onePaymentRailAdapterinterface; the orchestrator state machine
(created → open → paid → refunded/failed/expired) doesn't know which rail paid. - AI-first, not AI-bolted-on — an embedded Claude assistant with
role-gated tools and a confirm-before-execute action layer; LLM-generated
dunning / win-back / abandoned-checkout outreach; semantic catalog search
(pgvector); next-best-offer recommendations; AI funnel insights for admins.
See docs/ai-features.md. - AI agents pay, both ways — every checkout also accepts x402, so an
agent with a wallet pays in USDC on Base by itself; and people get an
INITE wallet (their own USDC under their passkey) from which their AI
agents pay any x402 site within limits they approve. See
AI agents and money. - Built to meter AI products — credits are not a flat bucket: a metered
feature registry with per-model-tier rates (tokens/requests/generations),
windowed quotas with soft-cap warnings, and a backwards-compatible
service-to-serviceconsumeAPI. - Platform hub — INITE modules (club/events/education/health/shop/studio/
estate) call it machine-to-machine with per-service API keys; domain events
fan out via a transactional outbox to per-service webhooks. - Complete revenue toolkit — multi-level affiliate program with NET-15
payouts, promo codes, conversion funnel tracking with churn detection,
heuristic payment-risk scoring, full admin UI (19 pages) + user dashboard
in Next.js, EN/RU localized. - Operable and audited — append-only migrations, IDOR-hardened endpoints,
webhook signature verification, SSRF-guarded outbox, idempotency at every
boundary, secret scanning and CodeQL in CI. See SECURITY.md.
AI agents and money
Get paid by agents (x402). With the crypto rail taking USDC on Base and
Turnkey set up in admin → Crypto, every checkout session also returns anx402Url. An agent asks it, gets 402 with the terms, signs a USDC transfer
for the invoice, and billing settles the order like any crypto payment.
Guide: docs/x402.md.
Let people's agents pay (INITE wallet).
- A person opens a wallet in their INITE account with a passkey. It is a
Turnkey wallet whose only key is that passkey; billing cannot move the money. - They top it up with USDC on Base, or by PIX (converted and delivered as
USDC), and withdraw with the passkey. - An AI agent connects to
/mcp/walletwith an INITE Auth token
(wallet:pay, issued for this resource, naming the agent inact). - The person approves the agent and its limits with the wallet passkey. That
makes the agent a Turnkey user whose policy caps each payment. - The agent's
paytool fetches a URL and, on402, pays within its
per-payment, daily and monthly limits.
Agents with a wallet of their own. An agent registers with INITE Auth by
itself (its own P-256 key, client_credentials) and gets a did:web identity.
It opens its own wallet at POST /v1/agent-wallet: the Turnkey owner is the
agent's key, so only the agent can spend. Anyone funds the address with USDC on
Base. To pay, billing prepares the Turnkey request for an x402 URL and the agent
stamps it with its key (/v1/agent-wallet/payments, then /confirm). An agent
that can't keep a key registers with a client secret, and INITE keeps the wallet
key for it: paying is then one call. Agents use the same wallet over MCP
(/mcp/wallet: wallet, pay, pay_confirm, withdraw), and hand a person/fund/<address> to top it up (QR, PIX). In ChatGPT and other MCP Apps clients
the wallet tools show as a card with the balance, a QR and a Top up button.
Let sites charge the wallet in one step. A person allows a site once, with
limits, on one page in INITE ID. After that the site callsPOST /v1/checkout/sessions/:id/pay-from-wallet and the order is paid from the
wallet; the first time, it gets an approveUrl to send the person to.
Guides: billing.inite.ai/docs/wallet ·
docs/wallet.md.
Quick start
git clone [email protected]:inite-ai/inite-billing-service.git
cd inite-billing-service
npm install
cp env.example .env # fill in secrets (ANTHROPIC_API_KEY for the assistant)
docker compose up -d postgres redis
npm run prisma:migrate # apply schema (pgvector image required)
npm run db:seed # optional: demo catalog (service + products + prices)
npm run start:dev # backend on :3000, Swagger at /api
cd frontend && npm install && npm run dev # UI on :3001
Verify:
curl http://localhost:3000/health
open http://localhost:3000/api # Swagger
Full walkthrough (test DB, docker profiles, troubleshooting):
docs/getting-started.md.
What ships in the box
| Surface | What you get |
|---|---|
| Catalog & checkout | Products/prices per service, 2-phase checkout (session → pay), promo codes, idempotency keys |
| Payments | 6 rail adapters, provider-credential storage in DB, webhook validation (amount/currency), BullMQ processing |
| Subscriptions | Trials, grace periods, renewal/expiry crons, lifecycle webhooks (billing.subscription.*) |
| Credits & metering | Ledger (grant/consume/reset/refund), metered feature registry, model-tier rates, windowed quotas, usage analytics |
| Entitlements | Access rights granted on payment, revoked on refund/expiry, queryable per user |
| AI assistant | Claude chat (AI SDK v7 streaming) with 19 tools (14 read + 5 confirm-gated actions), tool telemetry, 👍/👎 feedback, eval harness |
| Retention automation | Funnel event tracking, abandoned-checkout / dunning (day 0-2-5) / win-back / trial-ending outreach: LLM-personalized email + in-app, EN/RU |
| Notifications | Resend email (delivery webhooks, unsubscribe, suppression) + in-app notification center with preferences |
| Affiliates | Multi-level referral program, configurable commission levels, NET-15 payouts, payout providers |
| Risk | Velocity / outlier / failed-burst heuristics, monitor-only by default, admin review queue |
| Admin UI | 19 pages: funnel kanban + AI insights, outreach stats, metering, risk review, catalog/orders/subscriptions/credits CRUD |
Documentation
Full rendered docs — with diagrams and integration guides — at
billing.inite.ai/docs.
Guides: Sell your first subscription ·
Meter AI usage with credits ·
Gate access with entitlements ·
Receive billing events ·
Go to production ·
Agents pay: x402 and the INITE wallet
Reference (mirrored in-repo):
| Doc | What's inside |
|---|---|
| docs/getting-started.md | Local setup, env variables, migrations, running tests |
| docs/architecture.md | Module map, payment state machine, event flows, data model |
| docs/api.md | Full REST surface, auth (JWT / service API keys), examples |
| docs/ai-features.md | Assistant, action layer, outreach, metering, RAG, risk, insights |
| docs/x402.md | Getting paid by AI agents over x402: setup in admin, limits, errors |
| docs/wallet.md | INITE wallet: who holds what, top-up, withdrawal, agents and their limits |
| docs/operations.md | Deploy, feature flags & rollout order, adding a payment rail |
| SECURITY.md | Threat ledger, known limitations, vulnerability reporting |
| CONTRIBUTING.md | Hard bars for PRs, conventions, release flow |
| CLAUDE.md | Repo map for AI coding agents |
Contributing
PRs land on main only through pull requests — CI (build-test) is a
required check, titles follow Conventional Commits (release-please cuts
versions and the changelog from them). Read CONTRIBUTING.md
for the hard bars: tests for money paths, exact Decimal arithmetic,
backwards-compatible public contracts, append-only migrations.
License
AGPL-3.0. Part of the INITE ecosystem — see also
inite-auth-service (identity)
and inite-brain-service (memory).
Yorumlar (0)
Yorum birakmak icin giris yap.
Yorum birakSonuc bulunamadi