PlandalfDocsSign inStart free trial

API and webhooks

Prices

Prices belong to products. Create or update them from your system, matched by product and lookup_key, and search them to build a "pick a Plandalf price" control in a plugin.

Example

A monthly subscription price with a 14-day trial on the product from Products:

curl -X POST https://admin.plandalf.dev/api/v1/prices \
  -H "Authorization: Bearer $PLANDALF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "product": { "lookup_key": "gold-membership" },
    "lookup_key": "gold-monthly",
    "name": "Gold monthly",
    "amount_cents": 4900,
    "currency": "usd",
    "recurring": { "interval": "month", "interval_count": 1 },
    "trial_period_days": 14
  }'

Leave out recurring for a one-off price. A product that matches neither product.id nor product.lookup_key returns 404.

Endpoints

Search prices

GET /api/v1/prices

Active list prices, newest first, up to 100. search matches the price name, its lookup key or its product's name; ids fetches specific prices. Built for a "link a Plandalf price" picker in a plugin.

Parameters

NameInTypeWhat it is
search optionalquerystring | null
ids[] optionalqueryinteger[]
curl https://admin.plandalf.dev/api/v1/prices \
  -H "Authorization: Bearer $PLANDALF_API_KEY"

Response

{
  "data": [
    {
      "id": 0,
      "lookup_key": "string",
      "name": "string",
      "product": {
        "id": 0,
        "name": "string",
        "lookup_key": "string"
      },
      "amount_cents": 0,
      "currency": "string",
      "recurring": {
        "interval": "string",
        "interval_count": 0
      },
      "trial_period_days": 0,
      "active": true
    }
  ]
}

Errors

StatusWhen
401The API key or OAuth token is missing or invalid.
422The request failed validation; errors lists the problems by field.

Create or update a price

POST /api/v1/prices

Upserts by product and lookup_key. Identify the product by product.id or product.lookup_key (404 when neither matches). Send recurring for a subscription price; trial_period_days needs recurring.interval. metadata is stored under the price's client metadata and returned as sent. Each bindings entry is saved only when the organization has an integration of that gateway type; others are skipped.

Body

FieldTypeWhat it is
amount_centsinteger
currencystring
lookup_key optionalstring | null
name optionalstring | null
trial_period_days optionalinteger | null
product optionalobject
recurring optionalobject
metadata optionalarray | null
bindings optionalarray | null
curl -X POST https://admin.plandalf.dev/api/v1/prices \
  -H "Authorization: Bearer $PLANDALF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount_cents":0,"currency":"string","lookup_key":"string","name":"string","trial_period_days":0,"product":{"id":0,"lookup_key":"string"},"recurring":{"interval":"day","interval_count":0},"metadata":null,"bindings":null}'

Response

{
  "id": "string",
  "lookup_key": "string",
  "amount_cents": 0,
  "currency": "string",
  "product_id": "string",
  "trial_period_days": "string",
  "metadata": "string",
  "bindings": "string"
}

Errors

StatusWhen
401The API key or OAuth token is missing or invalid.
404Nothing with that id or code exists in this organization.
422The request failed validation; errors lists the problems by field.