> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.solvimon.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.solvimon.com/_mcp/server.

# Checkout sessions

A checkout session is a checkout page you build per buyer through the API: the customers, the subscriptions and what the buyer is allowed to change, all in one call.

---

## Why this matters

A [hosted checkout](/platform-guides/customers-and-billing/hosted-checkout) link is static. One link points at one template subscription, it looks the same to everyone who opens it, and the buyer types in every detail themselves. That works for self-serve signup from a pricing page.

It does not work when you already know who you are selling to. A sales-led deal, a quote that has been agreed, or an account that buys for several of its own locations all need a page that is prepared: the company name already filled in, the agreed discount already applied, the seat count already set, and only the handful of fields the buyer still has to supply left open.

A checkout session is that page. You create one per buyer, with your API key, and get back a short-lived link. The buyer sees every customer and every subscription on one page with one combined total, fills in what you left open, and pays once. Nothing exists in Solvimon until they pay: the customers, the subscriptions, the invoice and the payment are all created at that moment.

## How it works

A session is a [portal link](/platform-guides/customers-and-billing/portal-links) of type `CHECKOUT_SESSION`, so it shares the create call, the status lifecycle, the expiry, the revoke call and the `PORTAL_URL` webhooks with every other hosted page. This guide covers what only a session does.

Two statuses matter, and they are not the same thing. The **link** has `status`, which is the lifecycle of the URL. The **session** has `checkout_session.status`, which is the lifecycle of what the session is going to create.

```mermaid
stateDiagram-v2
    state "OPEN" as Open
    state "PROCESSING" as Processing
    state "COMPLETED" as Completed
    state "FAILED" as Failed
    [*] --> Open : session created
    Open --> Processing : the customer pays
    Processing --> Completed : everything created
    Processing --> Failed : a step could not finish
    Failed --> Processing : retried
```

| `checkout_session.status` | What it means                                                                                           |
| :------------------------ | :------------------------------------------------------------------------------------------------------ |
| `OPEN`                    | The session can still be read and changed. This is the only status in which it can be paid              |
| `PROCESSING`              | The payment was authorised and Solvimon is creating the customers, subscriptions, invoice and payment   |
| `COMPLETED`               | Everything was created. `result` says what, and `completed_at` says when                                |
| `FAILED`                  | A step could not finish. `result.failure` names the step and the reason, and the session can be resumed |

`checkout_session.payment_status` is a second axis, `UNPAID` or `PAID`.

The link's own `status` runs through the [usual four](/platform-guides/customers-and-billing/portal-links#link-lifecycle), and `CLOSED` is the one that belongs to sessions: a session link closes once its session is `COMPLETED` or `FAILED`. It then never expires and stays readable, which is what lets the page the buyer is returned to show them the outcome.

> **Note**
>
> A session link is short-lived by design: `expiry_period` accepts 30 minutes to one hour, defaults to one hour, and cannot be changed afterwards. Create the session at the moment you are about to send the buyer to it.

## Create a session

A session is created with [POST /v1/portal-urls](https://docs.solvimon.com/api-docs/transaction-api/portal-urls/post-portal-urls), the same call every portal link uses. The simplest session is one customer buying one subscription. You supply the template subscription to copy and the reference the new customer gets, and leave the rest to the buyer.

**`Create a checkout session`**

```bash Create a checkout session
curl -X POST https://test.api.solvimon.com/v1/portal-urls \
  -H "X-API-KEY: <apiKey>" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "CHECKOUT_SESSION",
    "checkout_session": {
      "success_url": "https://yourapp.com/welcome?session={CHECKOUT_SESSION_ID}",
      "cancel_url": "https://yourapp.com/pricing",
      "locale": "en-US",
      "metadata": { "lead_id": "ld_8812" },
      "customers": [
        {
          "customer": {
            "reference": "acme-8812",
            "type": "ORGANIZATION",
            "organization": { "legal_name": "Acme B.V." }
          }
        }
      ],
      "pricing_plan_subscriptions": [
        {
          "template_pricing_plan_subscription_id": "ppsu_template",
          "pricing_plan_subscription": {
            "reference": "acme-8812-pro",
            "customer_reference": "acme-8812"
          },
          "options": {
            "edit_seats": [
              { "pricing_item_config_id": "pico_seats", "min": { "number": "1" }, "max": { "number": "100" } }
            ],
            "allow_promotion_codes": "SINGLE"
          }
        }
      ]
    }
  }'
```

**`Response (trimmed)`**

```json Response (trimmed)
{
  "object_type": "PORTAL_URL",
  "id": "purl_9xK",
  "type": "CHECKOUT_SESSION",
  "status": "PUBLISHED",
  "authentication": "SIGNED_TOKEN",
  "expiry_period": { "type": "HOUR", "value": 1 },
  "expires_at": "2026-12-02T15:00:00Z",
  "url": "https://portal.solvimon.com/session?h=...",
  "checkout_session": {
    "status": "OPEN",
    "payment_status": "UNPAID",
    "version": 0,
    "customers": [
      {
        "customer": { "reference": "acme-8812", "type": "ORGANIZATION", "organization": { "legal_name": "Acme B.V." } },
        "effective_display": {
          "customer_details": "READ_ONLY",
          "address": "EDITABLE",
          "tax_ids": "EDITABLE",
          "email": "EDITABLE",
          "custom_fields": "EDITABLE"
        }
      }
    ],
    "missing_fields": [
      "checkout_session.customers.0.customer.organization.registered_address.country"
    ]
  }
}
```

Take the `url` and send the buyer to it. A session is a `SIGNED_TOKEN` link, so its `url` and the handle inside it come back [only in the create response](/platform-guides/customers-and-billing/portal-links#how-the-customer-is-authenticated). Capture it now, or create a new session.

`{CHECKOUT_SESSION_ID}` in `success_url` or `cancel_url` is replaced with the session's portal URL id, which is how you reconcile the return with the session you created. Both URLs have to be absolute `http` or `https` URLs of at most 2048 characters, with an international domain written in punycode.

### What the buyer still has to do

`missing_fields` lists, as field paths, what the session cannot be paid without: the name of every customer the session creates, and the country of the customer it invoices when the session creates that customer. The country matters because it selects the billing entity, which decides the tax and the payment methods. While `missing_fields` has entries, the page cannot be paid.

### What the session tells you back

Next to what you sent, each entry of `pricing_plan_subscriptions` carries read-only fields worked out from the template, so you do not have to resolve the template yourself to know what the buyer will see:

| Field                                        | What it holds                                                                                                                                           |
| :------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `name`, `billing_currency`, `billing_period` | What the subscription gets: your override, else the template's                                                                                          |
| `billing_entity_id`                          | The billing entity it gets. Left out while that still depends on a country the buyer has to fill in                                                     |
| `pricing_plan_schedule_infos`                | The schedules it gets, dated as if the session completed now. Each `id` is the key used by `pricing_plan_schedule_customizations` and `starting_values` |
| `starting_values`                            | Per schedule, the seats and units each config starts with, recalculated on every change of the session                                                  |

`starting_values` resolves the whole fallback chain for you. Seats are the number in your customization, else the config's default seats; units are the number in your customization, else the template schedule's units, else the config's default units, else 1. A schedule with nothing to list, a rate card schedule for instance, is left out.

Expand `billing_entity` for the entity itself, and `pricing_plan_version_id` on a schedule for the version as that schedule bills it. These fields, like `missing_fields`, are only returned while the session is `OPEN`.

## Decide what the buyer may change

Two separate controls: `display` for customer fields, `options` for the subscription.

`display` sets the visibility of a group of customer fields, with `EDITABLE`, `READ_ONLY` or `HIDDEN`. It can be set for the whole session and overridden per customer.

| Group              | Covers                                                                          |
| :----------------- | :------------------------------------------------------------------------------ |
| `customer_details` | The organization's legal name and registration number, or the individual's name |
| `address`          | The registered or residential address                                           |
| `tax_ids`          | Tax IDs, tax exemption and tax registrations                                    |
| `email`            | The email address                                                               |
| `custom_fields`    | The customer custom fields the page asks for                                    |

The default is the useful one, so most sessions set nothing: **a group you supplied is `READ_ONLY`, a group you left out is `EDITABLE`**. The buyer fills in what you did not. A blank string does not count as supplied. `HIDDEN` needs a value for `customer_details` and `address`; the other three may be hidden without one.

`effective_display` is returned read-only per customer and tells you what the page will actually do with each group, after the defaults and the overrides are resolved.

`options` does the same for a subscription, and here the default is the opposite: **the buyer may change nothing unless you say so**.

* `edit_seats` gives a range per seats pricing item config. `min` and `max` are both optional: leave one out for no bound on that side.
* `edit_units` does the same for a one-off config priced `FLAT` with a per-unit amount.
* `allow_promotion_codes` decides whether the buyer may enter a code, and defaults to the template subscription's own setting.

A config you give no range to cannot be touched by the buyer. Ranges cannot be set on a rate card schedule, nor on a config the template overrides.

To ask the buyer for customer custom fields, name them with `customer_custom_field_ids`. Expand `customer_custom_fields` to get the definitions back so the page can render the right inputs.

## A session for several customers, with forward billing

This is where a session does something a checkout link cannot. A parent organization signs up, each of its locations gets its own subscription on its own customer record, and every subscription is forward billed to the parent, so the buyer sees and pays one invoice.

Customers created in the same session refer to each other by `reference`. `parent_customer` sets the hierarchy, and `forward_customer_reference` on a subscription sends its invoice to the parent.

**`A parent and two locations on one invoice`**

```bash A parent and two locations on one invoice
curl -X POST https://test.api.solvimon.com/v1/portal-urls \
  -H "X-API-KEY: <apiKey>" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "CHECKOUT_SESSION",
    "checkout_session": {
      "success_url": "https://yourapp.com/welcome?session={CHECKOUT_SESSION_ID}",
      "note": "Your **Pro** plan for Amsterdam and Utrecht, as agreed.",
      "customers": [
        {
          "customer": {
            "reference": "acme-org-8812",
            "type": "ORGANIZATION",
            "organization": { "legal_name": "Acme B.V." },
            "email": "billing@acme.example",
            "timezone": "Europe/Amsterdam"
          }
        },
        {
          "customer": { "reference": "acme-amsterdam", "type": "ORGANIZATION", "organization": { "legal_name": "Acme Amsterdam" } },
          "parent_customer": { "reference": "acme-org-8812" },
          "display": { "address": "EDITABLE", "tax_ids": "HIDDEN" }
        },
        {
          "customer": { "reference": "acme-utrecht", "type": "ORGANIZATION", "organization": { "legal_name": "Acme Utrecht" } },
          "parent_customer": { "reference": "acme-org-8812" }
        }
      ],
      "pricing_plan_subscriptions": [
        {
          "template_pricing_plan_subscription_id": "ppsu_template_a",
          "pricing_plan_subscription": {
            "reference": "acme-8812-ams",
            "customer_reference": "acme-amsterdam",
            "variant": "FORWARD_BILLING",
            "forward_customer_reference": "acme-org-8812",
            "show_original_customer_invoice_line": true
          },
          "pricing_plan_schedule_customizations": [
            {
              "pricing_plan_schedule_id": "ppsc_a",
              "seats_values": [{ "pricing_item_config_id": "pico_seats", "number": "5" }],
              "coupons": [{ "id": "coup_10pct" }]
            }
          ],
          "options": {
            "edit_seats": [{ "pricing_item_config_id": "pico_seats", "min": { "number": "1" }, "max": { "number": "100" } }]
          }
        },
        {
          "template_pricing_plan_subscription_id": "ppsu_template_b",
          "pricing_plan_subscription": {
            "reference": "acme-8812-utr",
            "customer_reference": "acme-utrecht",
            "variant": "FORWARD_BILLING",
            "forward_customer_reference": "acme-org-8812"
          }
        }
      ],
      "payment": {
        "store_payment_method": true
      }
    }
  }'
```

A few rules make this work, and a session that breaks them is refused when you create it:

* The forward customer has to be the subscriber's **direct** parent, and cannot be `NON_PROCESSING`. Leave `forward_customer_reference` out and a subscriber with exactly one parent forwards to that parent.
* The children have to share the parent's timezone, billing entity and currency. This is what lets their invoices land on one invoice; a child inherits the parent's timezone when it does not set one.
* Customer hierarchies go at most three deep.
* The parent is charged because it is the invoice customer: forward billing is what puts the invoice on it. `payment.store_payment_method` keeps the method for the renewals that follow, and `payment.payment_acceptor_ids` narrows what the page offers.

The buyer sees both subscriptions and one total, and pays once.

### Discounts you apply, and codes the buyer enters

They are different fields on purpose. `coupons`, on a schedule customization, applies a discount by id: the buyer never sees a code and cannot remove it. `promotion_codes` is the customer-facing kind. Whether the buyer may enter one of their own is `options.allow_promotion_codes`, and with `SINGLE` the subscription carries at most one code in total, including one you set yourself.

## Preview the total

[POST /v1/portal-urls/\{id}/preview](https://docs.solvimon.com/api-docs/transaction-api/portal-urls/post-portal-urls-by-resource-id-preview) runs the same preview the buyer sees, with no body. Use it to check a session before sending the link.

**`Preview a session`**

```bash Preview a session
curl -X POST https://test.api.solvimon.com/v1/portal-urls/purl_9xK/preview \
  -H "X-API-KEY: <apiKey>"
```

One invoice preview runs per subscription, from one shared start. Results that would land on the same invoice are merged the way real invoicing merges them, and summed:

**`Response`**

```json Response
{
  "invoices": [
    {
      "customer_reference": "acme-org-8812",
      "pricing_plan_subscription_references": ["acme-8812-ams", "acme-8812-utr"],
      "invoice": {}
    }
  ],
  "total": { "currency": "EUR", "amount_excl_tax": "221.49", "tax": "46.51", "amount_incl_tax": "268.00" },
  "per_subscription": [
    { "pricing_plan_subscription_reference": "acme-8812-ams", "invoice_infos": [] }
  ],
  "checkout_session": { "version": 1 }
}
```

While something in `missing_fields` is still open, the preview answers with that list instead of invoices: without a country there is no billing entity and no tax to calculate.

## Change a session before it is paid

[PATCH /v1/portal-urls/\{id}](https://docs.solvimon.com/api-docs/transaction-api/portal-urls/patch-portal-urls-by-resource-id) updates the session while its status is `OPEN`. `expiry_period` cannot be changed, and a `PATCH` on a closed link is refused.

Every change, by you or by the buyer, increases `checkout_session.version`. Send `expected_version` to make your update conditional: it is refused when the session changed since you read it, which is what keeps your edit from overwriting something the buyer just filled in.

[POST /v1/portal-urls/\{id}/revoke](https://docs.solvimon.com/api-docs/transaction-api/portal-urls/post-portal-urls-by-resource-id-revoke) ends a session you no longer want to be payable.

## When the session completes

The buyer pays on the page. Solvimon then creates, in one go: the customers, parents first; the subscriptions, all starting at the same instant; one invoice through the normal invoice consolidation; and the payment attached to it. The session moves to `COMPLETED`, the link closes, and `result` says what was created.

**`result`**

```json result
{
  "customers": [
    { "reference": "acme-org-8812", "id": "cust_a" },
    { "reference": "acme-amsterdam", "id": "cust_b" }
  ],
  "pricing_plan_subscriptions": [
    { "reference": "acme-8812-ams", "id": "ppsu_a", "pricing_plan_schedule_ids": ["ppsc_a"] }
  ],
  "invoice_ids": ["invo_a"],
  "payment_id": "paym_a",
  "payment_method_id": "pmet_a"
}
```

Completion is resumable rather than all-or-nothing in the moment: each step records what it created, so nothing is made twice. A session that cannot finish reports `FAILED` with `result.failure.step` and `result.failure.message`, and can be resumed with [POST /v1/portal-urls/\{id}/complete](https://docs.solvimon.com/api-docs/transaction-api/portal-urls/post-portal-urls-by-resource-id-complete).

### Webhooks

Next to the `PORTAL_URL.CREATED`, `UPDATED` and `EXPIRED` events [every link raises](/platform-guides/customers-and-billing/portal-links#webhooks), with `UPDATED` firing on each edit the buyer makes, a session has two of its own:

| Event                                   | Fires when                                                                       |
| :-------------------------------------- | :------------------------------------------------------------------------------- |
| `PORTAL_URL.CHECKOUT_SESSION_COMPLETED` | A paid session finished. Its customers, subscriptions, invoice and payment exist |
| `PORTAL_URL.CHECKOUT_SESSION_FAILED`    | A paid session could not finish                                                  |

Fulfil on `CHECKOUT_SESSION_COMPLETED` rather than on the buyer reaching your `success_url`: the redirect can be lost and the webhook cannot. See [Webhook event types](/platform-guides/for-developers/webhook-event-types).

## Limits

The whole session travels in every webhook and every internal record of its portal URL, so its free-form parts are bounded.

| Field                        | Limit                                                                          |
| :--------------------------- | :----------------------------------------------------------------------------- |
| `customers`                  | 10 entries                                                                     |
| `pricing_plan_subscriptions` | 10 entries                                                                     |
| `metadata`                   | 50 entries, key 1 to 40 characters and not blank, value at most 500 characters |
| `note`                       | 2000 characters, multi-line Markdown shown on the page                         |
| `success_url`, `cancel_url`  | 2048 characters, absolute `http` or `https` with a host                        |
| `expiry_period`              | 30 minutes to 1 hour, default 1 hour                                           |

Going over any of them is refused with a `400` naming the field at fault.

## Edge cases

* **The template must be a template.** `template_pricing_plan_subscription_id` has to point at an `ACTIVE` subscription of type `TEMPLATE` with variant `DEFAULT`. The template stays the source of truth for pricing; the session only overrides the subscription fields around it.
* **Only some subscription fields can be overridden.** `reference`, which is required, `customer_id` or `customer_reference`, exactly one of the two, `variant`, `forward_customer_id` or `forward_customer_reference`, `show_original_customer_invoice_line`, `display_invoice_sub_lines_per_processing_only_customer`, `billing_entity_id` or `billing_entity_reference`, `billing_currency`, `combine`, `custom_fields`, `payment_acceptor_ids`, `purchase_order_number`, `name` and `description`. Anything else, `billing_period` and `status` included, is refused as an unknown field. `default_shipping_address_id` is a field of the shape but is refused in a session, with "existing shipping addresses are not supported in checkout sessions".
* **A session needs at least one subscription.** `pricing_plan_subscriptions` missing or empty is refused with "value required". A session is a thing being sold, not an empty page.
* **References have to be unique within the session.** Two customers cannot share a `reference`, and the same `customer_id` cannot be listed twice, because a reference is how the subscriptions point at their customer.
* **A session needs a payment gateway.** Only `ACTIVE` acceptors of type `PAYMENT_GATEWAY` are offered. A session left with none to offer is refused when you create it.
* **The buyer cannot apply coupons.** A coupon sent from the page is refused. Only promotion codes are customer-facing, and only when `allow_promotion_codes` permits.
* **A quantity has to fit its range,** including the quantity the config starts with by default. A default outside the range you set is refused at creation, not silently clamped.
* **Nothing is created early.** Until the payment is authorised there is no customer, no subscription and no invoice, so an abandoned session leaves nothing behind to clean up.