Create Subscription Workflow
Goal
A provider publishes a new subscription on-chain so others can subscribe to it.
Who is involved
| Role | What they do |
|---|---|
| Provider | The wallet address passed as from — creates and owns the subscription |
| Your app | Builds the subscription params and requests unsigned createSubscription calldata |
| Clocktower API | Simulates and returns unsigned transactions |
| Wallet | Signs and broadcasts to the selected chain (REST ?chainId=; MCP optional chainId, default Base) |
Steps
- Prepare create — send amount, token, frequency, due day, and metadata; receive unsigned
createSubscriptioncalldata. - Sign — provider wallet signs the transaction.
- Broadcast — your app sends it to the chain in
unsignedTransactions[].chainId. - Confirm (optional) — poll transaction status.
- Fetch new ID — after mining, read the subscription by ID or poll until it appears on-chain.
Flow diagram
Calls by surface
| Step | REST | MCP tool | SDK |
|---|---|---|---|
| 1. Prepare | POST /prepare/create_subscription | prepare_create_subscription | createSubscription() |
| 2–3. Sign & broadcast | Your wallet + RPC | Same | walletClient via viem |
| 5. Fetch ID | GET /subscriptions/:id or search | get_subscription | waitForSubscription() |
Example request body
{
"from": "0xProviderAddress",
"amount": "10",
"token": "0x...",
"details": { "url": "https://example.com/", "description": "Premium" },
"frequency": 1,
"dueDay": 15
}
On REST, pass ?chainId= on prepare and on the follow-up GET /subscriptions/:id so you stay on the same chain. On MCP, pass the same chainId on prepare and get_transaction_status (omitted uses Base). See REST chain selection and MCP chain selection.