> This page is for version Preview (default).
> For other versions, use one of these documentation indexes:
> - Preview (default): https://docs.preview.paid.ai/preview/llms.txt
> - Current: https://docs.preview.paid.ai/current/llms.txt

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

# Outcome pricing for a support agent

> Bill a support agent per resolved and escalated ticket, plus a monthly platform fee, and pass inference through at cost plus a markup.

Resolvio's agent answers support tickets for e-commerce brands. Customers pay \$1.50 for each ticket the agent resolves and \$0.25 for each ticket it escalates to a human, plus a \$500 monthly platform fee. Resolvio pays a model provider for inference, so it also records what each agent turn cost, and its customers see their tickets and spend inside Resolvio's app.

This example uses:

* [Products](../../api-reference/catalog/products/create)
* [Meters](../../api-reference/metering/meters/create), including a workflow meter that turns ticket events into one outcome per ticket
* [Prices](../../api-reference/catalog/prices/create): usage prices per outcome, recurring platform fees and a cost-plus price
* [Customers](../../api-reference/customers/customers/create)
* [Orders](../../api-reference/billing/orders/create) and [amendments](../../api-reference/billing/amendments/create)
* [Events](../../api-reference/metering/events/create), with cost lines
* [Usage summaries](../../api-reference/metering/usage-summaries/list)

> **Note**
>
> The calls below show only the request body. Every request also sends the headers described in [Request headers](../../api-reference/introduction#request-headers): `Authorization`, `Paid-Version`, and a `Paid-Beta` opt-in for the resource you call (`products=v1`, `meters=v1`, `prices=v1`, `customers=v1`, `orders=v1`, `events=v1` or `usage_summaries=v1`, plus `event_costs=v1` on events that carry cost lines). Writes also send an `Idempotency-Key`, so a retry never creates a second object; see [Idempotency](../../api-reference/idempotency).

Money amounts in this example are in cents. A price's `unitAmount` is a decimal string of cents (`"150"` is \$1.50), and amounts returned by Paid, such as an amendment's `moneyEffects`, are integer cents.

## Setup \[#setup]

[Create a product](../../api-reference/catalog/products/create) for the agent:

**`POST /v1/products`**

```json title="POST /v1/products"
{
  "externalId": "support_agent",
  "name": "Support agent"
}
```

[Create a meter](../../api-reference/metering/meters/create) that follows each ticket from its first event until it closes. Every event about a ticket carries the same `ticket_id`, which the meter uses as the workflow identifier. When a ticket closes, the meter classifies it by the first outcome whose conditions all hold and emits one ticket under that outcome. Tickets that match neither outcome, or that get no close event within 7 days, are discarded.

**`POST /v1/meters`**

```json title="POST /v1/meters"
{
  "key": "support_tickets",
  "name": "Support tickets",
  "eventNames": ["ticket.message", "ticket.status_changed", "ticket.closed"],
  "measure": {
    "type": "workflows",
    "workflows": {
      "identifier": "payload.ticket_id",
      "close": {
        "eventName": "ticket.closed",
        "timeout": { "value": "7", "unit": "day" },
        "onTimeout": "discard"
      },
      "outcomes": [
        {
          "key": "resolved",
          "conditions": [
            {
              "type": "lastValue",
              "lastValue": { "path": "payload.status", "op": "eq", "value": "resolved" }
            }
          ]
        },
        {
          "key": "escalated",
          "conditions": [
            {
              "type": "anyEvent",
              "anyEvent": {
                "eventName": "ticket.status_changed",
                "filters": [
                  { "path": "payload.status", "op": "eq", "value": "escalated" }
                ]
              }
            }
          ]
        }
      ],
      "catchAll": { "action": "discard" },
      "derivedEvent": {
        "quantity": { "type": "count", "unit": "ticket" }
      }
    }
  }
}
```

[Create a price](../../api-reference/catalog/prices/create) for each outcome. `usage.outcome` names the outcome the price charges for. This one is `prc_resolved`:

**`POST /v1/prices`**

```json title="POST /v1/prices"
{
  "product": "support_agent",
  "name": "Resolved ticket",
  "currency": "usd",
  "type": "usage",
  "usage": {
    "meter": "support_tickets",
    "outcome": "resolved",
    "pricing": { "type": "perUnit", "perUnit": { "unitAmount": "150" } }
  }
}
```

The escalated price, `prc_escalated`, is the same with `"name": "Escalated ticket"`, `"outcome": "escalated"` and `"unitAmount": "25"`.

The platform fee is a `recurring` price, invoiced in advance at the start of each month. This one is `prc_platform`:

**`POST /v1/prices`**

```json title="POST /v1/prices"
{
  "product": "support_agent",
  "name": "Platform fee",
  "currency": "usd",
  "type": "recurring",
  "recurring": {
    "interval": "month",
    "pricing": { "type": "perUnit", "perUnit": { "unitAmount": "50000" } }
  }
}
```

Resolvio also offers a Pro tier. Its fee, `prc_platform_pro`, is the same request with `"name": "Platform fee (Pro)"` and `"unitAmount": "80000"`.

## Signing Acme Retail \[#signing-acme-retail]

[Create the customer](../../api-reference/customers/customers/create):

**`POST /v1/customers`**

```json title="POST /v1/customers"
{
  "externalId": "acme-retail",
  "name": "Acme Retail",
  "currency": "usd"
}
```

[Create an order](../../api-reference/billing/orders/create) with the two outcome prices and the platform fee. It runs month to month with no `endsAt`, and invoices are due on receipt:

**`POST /v1/orders`**

```json title="POST /v1/orders"
{
  "customer": "acme-retail",
  "startsAt": "2026-04-01T00:00:00Z",
  "billingCycle": { "interval": "month" },
  "paymentTerms": "dueOnReceipt",
  "lines": [
    { "type": "price", "price": { "price": "prc_resolved" } },
    { "type": "price", "price": { "price": "prc_escalated" } },
    { "type": "price", "price": { "price": "prc_platform" } }
  ]
}
```

The order is created as a draft, with the ID `ord_acme` in this example. [Activate it](../../api-reference/billing/orders/activate) with `POST /v1/orders/ord_acme/activate`, which takes no body, to start billing.

## Every agent turn \[#every-agent-turn]

Resolvio [sends an event](../../api-reference/metering/events/create) for each message on a ticket, each status change, and when the ticket closes. The meter reads `payload.ticket_id` and `payload.status`. When an event comes from a model call, Resolvio adds a `cost` line for the inference it paid for:

**`POST /v1/events`**

```json title="POST /v1/events"
{
  "eventName": "ticket.message",
  "customer": "acme-retail",
  "product": "support_agent",
  "dedupeKey": "msg_7c41e2",
  "correlationId": "conv_5520",
  "payload": {
    "ticket_id": "T-1009",
    "channel": "email",
    "status": "open"
  },
  "cost": [
    {
      "type": "inference",
      "inference": {
        "operation": "chat",
        "provider": "trey",
        "model": "model-medium-20260929",
        "inputTokens": 9000,
        "cacheReadInputTokens": 6000,
        "outputTokens": 450
      }
    }
  ]
}
```

The cost line has no `amount`, so Paid prices it from its model catalog. The returned event carries the priced line, with `pricing.source` set to `paidCatalog`, and adds `uncachedInputTokens: 3000` so cached tokens are counted once.

When the agent hands a ticket to a human, Resolvio sends a `ticket.status_changed` event with `"status": "escalated"`. When the ticket is done, it sends `ticket.closed` with the final status, which closes the workflow and prices the ticket.

## Acme Retail's month \[#acme-retails-month]

| Tickets | Outcome                                 | Price                         | Charge     |
| ------- | --------------------------------------- | ----------------------------- | ---------- |
| 2,450   | `resolved`                              | \$1.50                        | \$3,675.00 |
| 610     | `escalated`                             | \$0.25                        | \$152.50   |
| 140     | closed with neither outcome (catch-all) | discarded                     | \$0.00     |
| 85      | no close event within 7 days            | discarded (`onTimeout`)       | \$0.00     |
|         | Platform fee                            | \$500.00 a month, `recurring` | \$500.00   |

* **Usage total: \$3,827.50** (\$3,675.00 + \$152.50). Each ticket is billed once, under its first matching outcome, in the period it closed.
* **Invoice total: \$4,327.50**, the outcomes plus the \$500.00 platform fee. The fee is invoiced in advance at the start of the month and the outcomes in arrears at the end.
* **Margin:** the priced inference lines on Acme's events come to \$612.40 for the month (illustrative), against \$4,327.50 billed.

To show Acme its tickets and spend by month, Resolvio [lists usage summaries](../../api-reference/metering/usage-summaries/list) with these query parameters:

**`GET /v1/usage-summaries`**

```text title="GET /v1/usage-summaries"
?customer=acme-retail
&meters[]=support_tickets
&startsAt=2026-04-01T00:00:00Z
&endsAt=2026-10-01T00:00:00Z
&granularity=month
&groupBy[]=outcome
```

Each row has a ticket `quantity` and `spend` for one outcome in one month, with `status: "provisional"` on the month that is still open.

## Acme upgrades mid-month \[#acme-upgrades-mid-month]

On 16 November, Acme moves to the Pro platform fee (\$800 a month). Resolvio [previews the amendment](../../api-reference/billing/amendments/preview), replacing the price on the platform-fee line (`ordl_4Tm8Qc`, from the order's `lines`). `expectedVersion` is the order's current `version`, so the change fails if the order changed in the meantime:

**`POST /v1/orders/ord_acme/amendments/preview`**

```json title="POST /v1/orders/ord_acme/amendments/preview"
{
  "expectedVersion": 1,
  "changes": [
    {
      "type": "replacePrice",
      "replacePrice": { "line": "ordl_4Tm8Qc", "price": "prc_platform_pro" }
    }
  ],
  "proration": "prorate"
}
```

The preview's `moneyEffects` show the proration before anything changes. November has 30 days, and 16 to 30 November is 15 days, including the effective day:

| Effect                             | Calculation        | Amount               |
| ---------------------------------- | ------------------ | -------------------- |
| Credit for the unused Platform fee | \$500.00 × 15 ÷ 30 | −\$250.00 (`-25000`) |
| Charge for Platform fee (Pro)      | \$800.00 × 15 ÷ 30 | \$400.00 (`40000`)   |
| Net                                |                    | \$150.00             |

To apply it, Resolvio [creates the amendment](../../api-reference/billing/amendments/create) at `POST /v1/orders/ord_acme/amendments` with the same body plus the preview's `previewToken`, so what is applied is exactly what was previewed.

* **Usage isn't touched.** The outcome prices stay on the order, so tickets bill the same before and after.
* **History is kept.** The old platform-fee line stays on the order with `endedByAmendment` set, and December's invoice charges \$800.00 in advance.

## Globex: inference passed through at cost plus 20% \[#globex-cost-plus]

Globex runs high volumes and wants a lower outcome rate in exchange for paying for the model calls. Resolvio charges \$0.50 per resolved ticket and passes inference through at cost plus 20%, using the `cost` lines it already sends.

First, a meter that counts agent turns:

**`POST /v1/meters`**

```json title="POST /v1/meters"
{
  "key": "agent_turns",
  "name": "Agent turns",
  "eventNames": ["ticket.message"],
  "measure": {
    "type": "events",
    "events": {
      "aggregation": { "type": "count" },
      "unit": "turn"
    }
  }
}
```

Then a `costPlus` price on that meter, `prc_model_usage`, which bills the inference cost lines on the metered events multiplied by 1.2:

**`POST /v1/prices`**

```json title="POST /v1/prices"
{
  "product": "support_agent",
  "name": "Model usage",
  "currency": "usd",
  "type": "usage",
  "usage": {
    "meter": "agent_turns",
    "pricing": {
      "type": "costPlus",
      "costPlus": { "multiply": "1.2", "costTypes": ["inference"] }
    }
  }
}
```

The volume resolved-ticket price, `prc_resolved_volume`, is the `resolved` outcome price from setup with `"unitAmount": "50"`. Globex's order has three lines: `prc_resolved_volume`, `prc_platform` and `prc_model_usage`. It has no escalated price, so escalated tickets aren't charged. Its month:

| Line              | Calculation                                                 | Charge         |
| ----------------- | ----------------------------------------------------------- | -------------- |
| Resolved tickets  | 9,800 × \$0.50                                              | \$4,900.00     |
| Model usage       | 41,200 turns whose inference lines sum to \$1,940.25, × 1.2 | \$2,328.30     |
| Platform fee      |                                                             | \$500.00       |
| **Invoice total** |                                                             | **\$7,728.30** |

Resolvio's margin on inference is the \$388.05 markup (\$2,328.30 − \$1,940.25).