Table of contents
- Products and plans
- Plan types
- Meters
- Customer references
- Paywall protection flow
- Purchase lifecycle
- Authentication flow
- Usage tracking
- Next steps
Products and plans
Products
A product represents the API, app, or MCP server you monetize.- Product reference (
prd_...) - Name and description
Plans
A plan defines pricing and access for a product.- Plan reference (
pln_...) - Type:
recurring,usage-based,one-time, orhybrid - Price and currency
- Features
- Status:
active,inactive, orarchived
Product-plan relationship
- One product can have multiple plans
- Plans are embedded in products
- One default plan per product
- Paywall checks verify plan access for a product
Plan types
| Type | Description | Best for |
|---|---|---|
| Recurring | Fixed price billed on a cycle | SaaS subscriptions |
| Usage-based | Pay-per-use tracked by a meter | APIs and token services |
| Hybrid | Recurring fee plus usage overage | Enterprise mixed workloads |
| One-time | Single purchase without recurring billing | Digital goods and lifetime access |
Meters
Meters define what usage to measure.- Default meters:
api_requests,requests,api_calls,tokens - MCP tool meters:
tool:{toolName} - Custom meters for business-specific usage
Customer references
A customer reference (customerRef) maps your user identity to SolvaPay.
Paywall protection flow
When your handler is wrapped withpayable(), the SDK:
- Resolves customer reference
- Checks purchase status
- Checks usage limits
- Executes business logic when allowed
- Tracks usage
- Returns a paywall response when blocked
Example blocked response
Purchase lifecycle
Purchase states:- Active
- Cancelled
- Expired
- Past due
Authentication flow
You keep your existing auth and map identities to SolvaPay customers. Common pattern:- Extract user ID from your auth layer
- Use ID as
customerRef - Sync email/name as needed
- Run purchase checks
Usage tracking
Usepayable() for automatic usage tracking, or record usage directly.