# preview_order

> Price a cart before buying — the mandatory first step before `create_order`.

- Tier: R
- Required scope: read:orders
- Annotations: readOnlyHint, idempotentHint
- Docs: https://api.inleed.com/tools/preview-order

## Description

Price a cart before buying — the mandatory first step before `create_order`. Give it the line items (each a catalogue `service_plan_id` from `list_products`/`get_product`, plus an optional quantity and domain) and it returns the exact line items, the VAT breakdown, the total, the first-invoice date and what each line provisions. It creates nothing: no order, no invoice, no charge. Use it to show the human the price, then call `create_order` to hand them a payment link.

## Input schema

- `items` — object[] (required). The cart: one entry per plan you want to price. At least one, at most 50.
  - `service_plan_id` — integer (required). The catalogue plan id to buy — a plan's servicePlanId from list_products or get_product. It fixes the product and billing period.
  - `quantity` — integer. How many of this plan (1–99). Defaults to 1.
  - `domain` — string. The domain this line is for, where the product needs one (e.g. a hosting plan), like example.com.
  - `addons` — object[]. Addon services ordered together with this line (e.g. an extra IP, DirectAdmin on a VPS). Get valid options from get_addon_suggestions first.
    - `service_plan_id` — integer (required). The addon plan id — an options[].servicePlanId from get_addon_suggestions for this line's plan.
    - `quantity` — integer. How many of this addon (bounds come from get_addon_suggestions). Defaults to 1.
  - `config` — object. Per-product provisioning options. Only the keys valid for the line's product category are accepted — a wrong key is refused, never dropped.
    - `php_version` — string. Hosting lines only: the PHP version to provision with, e.g. 8.3.
    - `preinstall` — string. Hosting lines only: preinstall an application, e.g. wordpress.
    - `hostname` — string. VPS/dedicated lines only: the server hostname, e.g. vps1.example.com.
    - `operative_system` — string. VPS/dedicated lines only: the OS template name from list_vps_templates.
- `billing_address_id` — integer. Which billing profile to price against (currency and VAT come from it). Omit to use the account default.

## Example call

```json
{
  "name": "preview_order",
  "arguments": {
    "items": [
      {
        "service_plan_id": 1,
        "quantity": 1,
        "domain": "example.se",
        "addons": [
          {
            "service_plan_id": 1,
            "quantity": 1
          }
        ],
        "config": {
          "php_version": "8.3",
          "preinstall": "example.se",
          "hostname": "example.se",
          "operative_system": "example.se"
        }
      }
    ]
  }
}
```

