Plans API
Create and manage subscription plans.
Endpoints
GET
/api/v1/plansList all active plans for your wallet
Response:
json
[
{
"id": "abc123",
"name": "Pro Plan",
"amount_sats": 10000,
"interval": "monthly",
"description": "Access to premium features",
"trial_days": 7,
"grace_period_days": 3,
"allow_lightning": true,
"allow_onchain": false,
"allow_stripe": true,
"allow_paypal": false,
"created_at": 1704067200
}
]POST
/api/v1/plansCreate a new plan
Request:
json
{
"name": "Pro Plan",
"amount_sats": 10000,
"interval": "monthly",
"description": "Access to premium features",
"trial_days": 7,
"grace_period_days": 3,
"allow_lightning": true,
"allow_onchain": false,
"allow_stripe": true,
"allow_paypal": false
}Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Plan display name |
amount_sats | integer | Yes | Price in satoshis |
interval | string | Yes | weekly, monthly, or yearly |
description | string | No | Shown on checkout |
trial_days | integer | No | Free trial period (default: 0) |
grace_period_days | integer | No | Days after failed payment (default: 0) |
allow_lightning | boolean | No | Enable Lightning (default: true) |
allow_onchain | boolean | No | Enable on-chain (default: false) |
allow_stripe | boolean | No | Enable Stripe cards/Apple Pay/Google Pay (default: false) |
allow_paypal | boolean | No | Enable PayPal payments (default: false) |
Stripe and PayPal options only work if the LNbits server has these integrations enabled. If not available, these options will be ignored.
GET
/api/v1/plans/{id}Get a specific plan
PUT
/api/v1/plans/{id}Update a plan
Request: Same as POST (include only fields to update)
Price changes only affect new subscriptions. Existing subscribers keep their original price.
DELETE
/api/v1/plans/{id}Archive a plan (cancels all subscriptions)
Deleting a plan cancels all active subscriptions and notifies subscribers. This cannot be undone.
Example: Create a Plan
python
import requests
response = requests.post(
"https://your-lnbits.com/subscriptions_manager/api/v1/plans",
headers={"X-Api-Key": "YOUR_ADMIN_KEY"},
json={
"name": "Premium Membership",
"amount_sats": 50000,
"interval": "monthly",
"description": "Full access to all features",
"trial_days": 7
}
)
plan = response.json()
print(f"Created plan: {plan['id']}")