How It Works
Paygent connects your AI application to billing in six stages. This page is the integration map — follow it top to bottom when onboarding a new product or customer.
Architecture overview
Step 1 — Define your product (dashboard)
Before writing code, configure what you sell:
Step 2 — Integrate the SDK (your app)
Install the SDK and send events as your AI runs:
Python
Node.js
Go
Every event includes agent ID, customer ID, and indicator. Paygent resolves pricing, credits, and custom rates server-side.
Step 3 — Register customers (dashboard or API)
Create customers with an external ID matching your database primary key:
Add billing address and tax defaults for invoice PDFs.
Step 4 — Create an order (contract)
An order ties a customer to agents, plans, seat counts, taxes, and billing schedule:
- Orders → Create Order
- Pick customer, billing day, payment terms
- Add agent lines — select a Plan or default pricing
- Configure wallet settings if the plan includes credit benefits
- Attach taxes if needed
- Activate the order
Draft orders do not bill. Only active orders generate invoices.
Step 5 — Usage accumulates (automatic)
As your app sends events:
- Activity/outcome indicators → metered for usage billing
- Billable metrics → aggregate meta_tags into quantities
- Credit indicators → debit prepaid wallets or accrue postpaid usage
- External costs → match dashboard configs → invoice lines
- Voice/video → minutes, tokens, resolution tiers via custom pricing
Monitor real-time usage in Dashboard → Agent Analytics.
Step 6 — Billing runs → invoices (automatic)
On each customer’s billing day, Paygent:
- Aggregates usage for the billing period
- Adds setup, platform, and seat fees (see Subscription Fees)
- Applies external cost and wallet conversions
- Calculates taxes
- Creates an invoice (PDF + line items)
You can send email, generate a Stripe payment link, or mark as paid to release pending wallet credits.
Common integration paths
Path A — Simple usage billing
Agent + indicator + FLAT price → SDK → order → invoice.
Best for: MVP, single product, pay-per-call.
Path B — SaaS subscription + usage
Plan with platform fee + seat fee + activity indicators.
Best for: B2B AI tools with base subscription and overage.
Path C — Prepaid credits
Credit currency → platform fee credit benefits → prepaid wallet → CREDITS indicators.
Best for: API marketplaces, developer platforms.
Path D — Voice agent
Voice SDK + custom per-minute pricing + external telephony costs.
Best for: AI phone agents, speech-to-speech products.
Why this works
- Real-time tracking — no lost billable events between billing cycles
- Server-side pricing — change rates in dashboard without redeploying
- Automatic invoicing — eliminates spreadsheet reconciliation
- Flexible models — combine fees, credits, taxes, and pass-through costs on one invoice
