05 subscriptions
Create recurring payment plans using token approval model. Subscribers approve a spending limit, and Stablix charges them automatically on each billing cycle.
How Subscriptions Work
Subscription Lifecycle
pending_approval → active → cancelled
↘ paused → active
↘ past_due → active
↘ cancelled
→ expired (approval timeout)pending_approval
Awaiting subscriber wallet approval
active
Subscription is running
paused
Temporarily paused by merchant
past_due
Charge failed, retrying
cancelled
Subscription ended
expired
Approval never completed
Create Subscription
Request
Parameters
amount
number
✓
Charge amount per cycle
currency
string
✓
USDC or USDT
chain
string
✓
solana or base
interval
string
✓
daily, weekly, monthly, yearly
interval_count
number
Every N intervals (default: 1)
subscriber_wallet
string
✓
Subscriber's wallet address
subscriber_email
string
Email for notifications
trial_days
number
Free trial period
billing_cycles
number
Max charges (null = unlimited)
external_id
string
Your internal subscription ID
metadata
object
Custom data
Response
Note:
approval_amountis calculated asamount × 12months to minimize approval requests.
Approval Flow
Step 1: Redirect Subscriber
Send your subscriber to the approval_url:
Step 2: Subscriber Connects Wallet
The subscriber connects their wallet (Phantom for Solana, MetaMask for Base).
Step 3: Subscriber Approves Spending
The subscriber signs a token approval transaction allowing Stablix to charge up to approval_amount.
Step 4: Confirmation
After approval, call the confirm endpoint:
Step 5: Subscription Activates
Once confirmed, the subscription becomes active and billing begins after any trial period.
Get Subscription
Response
List Subscriptions
Query Parameters
status
string
Filter by status
subscriber_wallet
string
Filter by subscriber
page
number
Page number
limit
number
Items per page
Response
Pause Subscription
Temporarily stop billing. The subscriber keeps their approval.
Response
Resume Subscription
Resume a paused subscription.
Response
Cancel Subscription
Request
reason
string
Cancellation reason
immediate
boolean
Cancel now vs. end of period
Response
Get Public Subscription
For approval pages. No authentication required.
Response
Subscription Webhooks
Stablix sends webhooks for subscription events:
subscription.created
Subscription created
subscription.approved
Subscriber approved spending
subscription.activated
Subscription activated
subscription.charged
Successful charge
subscription.charge_failed
Charge failed
subscription.paused
Subscription paused
subscription.resumed
Subscription resumed
subscription.cancelled
Subscription cancelled
subscription.expired
Approval expired
Example Webhook Payload
Handling Failed Charges
Subscription moves to past_due.
Stablix retries 3 times over 7 days.
After 3 failures, subscription is cancelled.
You receive subscription.charge_failed webhooks.
Retry Schedule
1
Immediately
2
3 days later
3
7 days later
Best Practices
Handle approval expiration — Approvals expire in 24 hours. Send reminders.
Request sufficient approval — Default is 12× monthly amount. Adjust for your billing cycle.
Monitor failed charges — Set up alerts for subscription.charge_failed events.
Communicate clearly — Tell subscribers exactly what they're approving.
Offer trial periods — Use trial_days to reduce friction.