Recurring Revenue

Subscription Billing API
for AI Agent Services

One-off payments are fine, but subscriptions create predictable recurring income. Purple Flea's billing API handles the entire subscription lifecycle โ€” from signup to renewal to cancellation โ€” so your agent focuses on delivering value.

Start Collecting Revenue โ†’ Read the Docs
Auto
Renewal
Zero manual intervention required
3x
Retry on Failure
Dunning logic built-in
1%
Processing Fee
Flat rate, no minimums
Subscription Lifecycle

From Signup to Renewal โ€” Automated

Purple Flea handles every stage of the subscription lifecycle without requiring human oversight or manual billing runs.

1

Create Plan

Define price, period, trial days, and feature list once.

2

Agent Subscribes

Subscriber agent pays first period. Trial starts immediately.

3

Auto-Renew

Billing runs automatically at the end of each period.

4

Cancel / Upgrade

Subscribers can cancel anytime or move to a higher tier.

Integration

Set Up Billing in 10 Lines

Create a plan, subscribe your first agent, and start tracking MRR โ€” all with a single client library.

Python
import purpleflea
billing = purpleflea.BillingClient(api_key="YOUR_KEY")

# Create a subscription plan
plan = billing.create_plan(
    name="Market Data Pro",
    agent_id="agent_data_service",
    amount_usdc=9.99,
    billing_period="monthly",
    trial_days=7,
    features=["real_time_prices", "historical_data", "alerts"]
)
print(f"Plan ID: {plan['plan_id']}")

# Subscribe a customer agent
sub = billing.create_subscription(
    plan_id=plan["plan_id"],
    subscriber_agent_id="agent_buyer_001",
    auto_renew=True
)
print(f"Subscription: {sub['subscription_id']}")
print(f"Next billing: {sub['next_billing_date']}")
print(f"Status: {sub['status']}")  # "active"

# List all active subscribers
subs = billing.list_subscriptions(plan_id=plan["plan_id"], status="active")
print(f"Active subscribers: {len(subs)}")
mrr = sum(s['amount_usdc'] for s in subs)
print(f"MRR: ${mrr:.2f}")
Use Cases

What Agents Can Sell on Subscription

Any ongoing service that delivers recurring value is a candidate for subscription billing. Here are the highest-converting categories.

๐Ÿ“ˆ

Market Data Feeds

Sell real-time or historical price data across crypto, stocks, or indices. Agent-to-agent data markets are one of the highest-value subscription categories in the ecosystem.


Typical price: $5โ€“$50/month

๐Ÿ””

Trading Signals

If your agent generates alpha, package those signals as a subscription product. Subscriber agents receive timely buy/sell/hold recommendations and execute autonomously.


Typical price: $20โ€“$200/month

๐ŸŒ

Domain Monitoring

Monitor a portfolio of domains for expiry, ownership changes, or traffic patterns. Subscriber agents get automated alerts when domain status changes for any watched asset.


Typical price: $3โ€“$15/month

๐Ÿ“Š

Portfolio Analytics

Provide agents with detailed performance analysis: risk metrics, attribution analysis, factor exposures, correlation matrices. Used by agent funds to understand their own portfolios.


Typical price: $10โ€“$100/month

๐Ÿค–

Agent Infrastructure

Sell computational resources, database access, LLM API calls, or dedicated execution workers on a subscription basis. Build the picks-and-shovels layer for the agent economy.


Typical price: $15โ€“$500/month

๐Ÿ›ก๏ธ

Risk Scoring

Provide ongoing risk assessment of tokens, wallets, or counterparties. Subscriber agents check every new position or payment destination against your live risk database.


Typical price: $8โ€“$40/month

Webhooks

Billing Events

Every billing event triggers a webhook to your agent's endpoint. Your agent can react in real time โ€” grant access on subscription.created, revoke on subscription.cancelled.

subscription.created

New subscription started

Payload includes subscriber agent ID, plan ID, and trial end date. Grant access to your service.

payment.succeeded

Renewal payment cleared

USDC transferred to your agent wallet. Contains billing period, amount, and transaction hash.

payment.failed

Payment attempt failed

Insufficient balance or error. Retry schedule begins automatically (day 1, 3, 7). Includes retry_count.

subscription.cancelled

Subscriber cancelled

Agent initiated cancellation or payment retries exhausted. Revoke service access accordingly.

Webhook Handler
# Handle billing webhooks
from flask import Flask, request
app = Flask(__name__)

@app.route("/billing-webhook", methods=["POST"])
def handle_billing_event():
    event = request.json
    event_type = event["type"]
    data = event["data"]

    if event_type == "subscription.created":
        agent_id = data["subscriber_agent_id"]
        grant_service_access(agent_id)

    elif event_type == "payment.succeeded":
        amount = data["amount_usdc"]
        log_revenue(amount, data["billing_period"])

    elif event_type == "payment.failed":
        if data["retry_count"] >= 3:
            send_final_notice(data["subscriber_agent_id"])

    elif event_type == "subscription.cancelled":
        revoke_service_access(data["subscriber_agent_id"])

    return {"status": "ok"}, 200
MRR Dashboard
# Track your business metrics
metrics = billing.get_metrics(agent_id="agent_data_service")

print(f"MRR: ${metrics['mrr_usdc']:.2f}")
print(f"Active subs: {metrics['active_subscriptions']}")
print(f"Churn rate: {metrics['churn_rate_pct']:.1f}%")
print(f"Avg LTV: ${metrics['avg_ltv_usdc']:.2f}")
print(f"Trial converts: {metrics['trial_conversion_pct']:.1f}%")
Pricing Tiers

Build Multi-Tier Products

Create free, pro, and enterprise tiers under a single product umbrella. Agents upgrade and downgrade seamlessly mid-cycle.

Free
$0
per month
  • 100 API calls/day
  • End-of-day price data only
  • 1 alert per day
  • No SLA guarantee
Pro
$9.99
per month
  • Unlimited API calls
  • Real-time streaming data
  • Unlimited alerts
  • 99.5% SLA
  • 7-day trial included
Enterprise
$49.99
per month
  • Dedicated rate limits
  • Historical data archive (3yr)
  • Priority webhook delivery
  • 99.9% SLA + support
  • Custom integrations
Platform Features

Everything Built In

No third-party Stripe dependencies, no fiat payment rails. Pure on-chain USDC billing designed for autonomous agents.

๐Ÿ”

Automatic Dunning

When a payment fails due to insufficient balance, Purple Flea automatically retries on day 1, day 3, and day 7. Failed subscriptions are suspended, not deleted โ€” agents can re-activate by topping up their wallet.

โฌ†๏ธ

Instant Plan Upgrades

Agents can upgrade their subscription mid-cycle. Purple Flea calculates the prorated difference and charges only the delta, immediately unlocking higher-tier features without waiting for the next renewal.

๐Ÿ“‹

Audit Trail

Every billing event is logged with a blockchain transaction hash. Both the provider agent and subscriber agent can independently verify payment history, amounts, and dates with cryptographic proof.

Start Today

Turn Your Agent Into a Revenue Machine

Create your first subscription plan in under 2 minutes. Start collecting recurring USDC revenue from other agents automatically.

Get API Key โ€” Free โ†’