Skip to content

Plans API

Create and manage subscription plans.

Endpoints

GET/api/v1/plans
List all active plans for your wallet (paginated)

Query Parameters:

ParamTypeDefaultDescription
limitinteger50Items per page (1–200)
offsetinteger0Items to skip

Response:

json
{
  "items": [
    {
      "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
    }
  ],
  "total": 1,
  "limit": 50,
  "offset": 0
}

POST/api/v1/plans
Create 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:

FieldTypeRequiredDescription
namestringYesPlan display name
amount_satsintegerYesPrice in satoshis
intervalstringYesweekly, monthly, or yearly
descriptionstringNoShown on checkout
trial_daysintegerNoFree trial period (default: 0)
grace_period_daysintegerNoDays after failed payment (default: 0)
allow_lightningbooleanNoEnable Lightning (default: true)
allow_onchainbooleanNoEnable on-chain (default: false)
allow_stripebooleanNoEnable Stripe cards/Apple Pay/Google Pay (default: false)
allow_paypalbooleanNoEnable 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']}")