> Search your prices, and create or update one-off and subscription prices on a product, matched by lookup key.

Source: https://plandalf.com/docs/api/prices

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](https://plandalf.com/docs/api/products):

```bash
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

Name

In

Type

What it is

`search` optional

query

`string | null`

`ids[]` optional

query

`integer[]`

```bash
curl https://admin.plandalf.dev/api/v1/prices \
  -H "Authorization: Bearer $PLANDALF_API_KEY"
```

#### Response

```json
{
  "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

Status

When

`401`

The API key or OAuth token is missing or invalid.

`422`

The 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

Field

Type

What it is

`amount_cents`

`integer`

`currency`

`string`

`lookup_key` optional

`string | null`

`name` optional

`string | null`

`trial_period_days` optional

`integer | null`

`product` optional

`object`

`recurring` optional

`object`

`metadata` optional

`array | null`

`bindings` optional

`array | null`

```bash
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

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

#### Errors

Status

When

`401`

The API key or OAuth token is missing or invalid.

`404`

Nothing with that id or code exists in this organization.

`422`

The request failed validation; `errors` lists the problems by field.

Something wrong or missing? Email [hello@plandalf.com](mailto:hello@plandalf.com).
