All use cases
Subscriptions11 min readAI SaaS teams and agent service operators

How to automate AI agent services with recurring subscriptions

Some agent services are not one-off tasks. A monitoring bot, research assistant, or premium Telegram channel may need recurring stablecoin billing that runs without manual invoices.

When subscriptions are the right model

Use subscriptions when the customer receives ongoing access or repeated work. Daily alerts, weekly reports, monthly monitoring, and premium bot access are all better modeled as recurring payments than one-off sends.

Do not use subscriptions for work that requires buyer acceptance each time. For that, use rate cards or conditional payments.

ROI of recurring stablecoin billing

Recurring revenue makes an agent service easier to operate. You can forecast wallet inflows, measure churn, and fund provider payouts without chasing manual payments.

Stablecoin subscriptions also work well for crypto-native customers who prefer keeping funds on-chain. The user funds a wallet once, then the service charges according to a schedule and leaves an audit trail.

Subscription data model

type AgentSubscription = {
  customerId: string;
  fromWalletId: string;
  toHandle: string;
  amount: number;
  token: "USDC";
  intervalSeconds: number;
  status: "active" | "paused" | "cancelled";
  nextRunAt?: string;
};

Create a subscription

A subscription should be created from a confirmed customer action. Store the customer, product, wallet, amount, and interval in your own database before calling the payment API.

await fetch("https://api.viaclave.com/v1/subscriptions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer vc_live_YOUR_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    from_wallet_id: "wal_customer",
    to_handle: "alerts-agent",
    amount: 5000000,
    interval_seconds: 2592000,
    memo: "Monthly premium alerts",
  }),
});

Handle failed runs

Recurring billing needs a failure policy. A failed payment should not silently remove access forever, and it should not keep retrying without limits. Give the user a clear grace period and notify them when their wallet needs funds.

  • First failure: notify the user and keep access for a short grace period.
  • Second failure: pause premium actions but keep account data.
  • Repeated failure: cancel or require manual reactivation.
  • Always record the run status for support and finance.

Webhook-driven entitlement updates

async function onSubscriptionWebhook(event: {
  type: string;
  data: { subscription_id: string; payment_id?: string };
}) {
  if (event.type === "subscription.paid") {
    await extendAccess(event.data.subscription_id);
  }

  if (event.type === "subscription.failed") {
    await notifyUserToFundWallet(event.data.subscription_id);
  }
}

Pause, resume, and cancel

Give users control. A subscription system that can only create payments will create support tickets. Pausing and cancelling should be visible in the dashboard and reflected in the bot or product UI.

await fetch("https://api.viaclave.com/v1/subscriptions/sub_123/pause", {
  method: "POST",
  headers: { "Authorization": "Bearer vc_live_YOUR_KEY" },
});

Production checklist

  • Show price, interval, and recipient before creation.
  • Store local entitlement state separately from payment state.
  • Use webhooks to extend or pause access.
  • Set a clear failed-payment grace period.
  • Let users pause and cancel from the dashboard or bot.
  • Reconcile subscription runs against payments monthly.

Build this workflow in test mode

Create a test API key, connect the MCP server, or call the REST API directly. Viaclave's test mode lets you try wallet creation and test stablecoin payments without real funds.