> For the complete documentation index, see [llms.txt](https://docs.peakcommerce.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.peakcommerce.com/developers/reference-pages/pricing-previews.md).

# Pricing previews

Preview endpoints are read-only operations that return what *would* happen if you executed a plan change, add-on attach, or cancellation — including effective date, proration, applicable business rule, plan dependency adjustments, and policy evaluation.

The pricing-resolve endpoint returns the effective price for a product given a customer context.

* [`POST /api/v1/preview/plan-change`](#post-apiv1previewplan-change)
* [`POST /api/v1/preview/add-on`](#post-apiv1previewadd-on)
* [`POST /api/v1/preview/cancellation`](#post-apiv1previewcancellation)
* [`GET /api/v1/pricing/resolve`](#get-apiv1pricingresolve)

***

## `POST /api/v1/preview/plan-change`

Preview a plan change. No state changes.

* **Auth scope:** `read`

### Body

| Field             | Type | Required |
| ----------------- | ---- | -------- |
| `subscriptionId`  | UUID | yes      |
| `targetProductId` | UUID | yes      |

### Response `200`

```json
{
  "data": {
    "subscriptionId": "sub_01H...",
    "currentProduct": { "id": "prod_a", "name": "Starter", "priceCents": 1900 },
    "targetProduct":  { "id": "prod_b", "name": "Pro",     "priceCents": 4900 },
    "direction": "upgrade",
    "effectiveDate": "2026-05-02T14:01:23Z",
    "planDependencyAdjustments": [
      {
        "linkId": "ln_01H...",
        "sourceChargeId": "ch_a",
        "targetChargeId": "ch_b",
        "targetField": "quantity",
        "explanation": "Will keep quantity in sync after plan change via \"Base ↔ add-on seats\""
      }
    ],
    "financialImpact": {
      "currentPriceCents": 1900,
      "newPriceCents": 4900,
      "creditCents": 950,
      "chargeCents": 2450,
      "netCents": 1500,
      "currency": "USD"
    },
    "businessRule": {
      "ruleId": "br_01H...",
      "ruleName": "Default upgrade",
      "direction": "upgrade",
      "changeTiming": "immediate",
      "prorationType": "prorated"
    },
    "policyEvaluation": {
      "allowed": true,
      "evaluations": [
        { "policyId": "pol_01H...", "policyName": "...", "policyType": "plan_change", "result": "allow" }
      ]
    },
    "resolvedPrice": {
      "basePriceCents": 4900,
      "pricingTierCount": 3,
      "tiers": [
        { "id": "pt_01H...", "name": "Default", "price": "4900", "currency": "USD", "chargeModel": "flat" }
      ]
    }
  }
}
```

### Errors

| Status | When                                     |
| ------ | ---------------------------------------- |
| `404`  | Subscription or target product not found |

### cURL

```bash
curl -X POST https://api.example.com/api/v1/preview/plan-change \
  -H "Authorization: Bearer $PEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "subscriptionId": "sub_uuid", "targetProductId": "prod_uuid" }'
```

***

## `POST /api/v1/preview/add-on`

Preview attaching an add-on.

* **Auth scope:** `read`

### Body

| Field            | Type | Required |
| ---------------- | ---- | -------- |
| `subscriptionId` | UUID | yes      |
| `addOnProductId` | UUID | yes      |

### Response `200`

```json
{
  "data": {
    "subscriptionId": "sub_01H...",
    "addOnProduct": { "id": "prod_c", "name": "Extra Seats", "priceCents": 1500, "currency": "USD" },
    "effectiveDate": "2026-05-02T14:01:23Z",
    "coTermToBase": true,
    "financialImpact": {
      "firstChargeCents": 750,
      "recurringPriceCents": 1500,
      "currency": "USD"
    },
    "businessRule": {
      "ruleId": "br_01H...",
      "ruleName": "Default add-on",
      "direction": "add_on",
      "changeTiming": "immediate",
      "prorationType": "prorated",
      "coTermToBase": true
    },
    "planDependencyAdjustments": []
  }
}
```

### Errors

| Status | When                                     |
| ------ | ---------------------------------------- |
| `404`  | Subscription or add-on product not found |

### cURL

```bash
curl -X POST https://api.example.com/api/v1/preview/add-on \
  -H "Authorization: Bearer $PEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "subscriptionId": "sub_uuid", "addOnProductId": "prod_uuid" }'
```

***

## `POST /api/v1/preview/cancellation`

Preview cancelling a subscription.

* **Auth scope:** `read`

### Body

| Field            | Type | Required |
| ---------------- | ---- | -------- |
| `subscriptionId` | UUID | yes      |

### Response `200`

```json
{
  "data": {
    "subscriptionId": "sub_01H...",
    "currentProduct": { "id": "prod_a", "name": "Starter", "priceCents": 1900 },
    "status": "active",
    "effectiveDate": "2026-06-01T00:00:00Z",
    "financialImpact": {
      "currentPriceCents": 1900,
      "refundCreditCents": 633,
      "currency": "USD"
    },
    "businessRule": {
      "ruleId": "br_01H...",
      "ruleName": "Standard cancellation",
      "direction": "cancellation",
      "changeTiming": "at_period_end",
      "prorationType": "none"
    },
    "policyEvaluation": {
      "allowed": true,
      "evaluations": []
    }
  }
}
```

### Errors

| Status | When                   |
| ------ | ---------------------- |
| `404`  | Subscription not found |

### cURL

```bash
curl -X POST https://api.example.com/api/v1/preview/cancellation \
  -H "Authorization: Bearer $PEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "subscriptionId": "sub_uuid" }'
```

***

## `GET /api/v1/pricing/resolve`

Resolve the effective price for a product given a customer context. Applies pricing tiers, quantity multipliers, and active offers.

* **Auth scope:** `read`

### Query

| Param       | Type          | Required | Description           |
| ----------- | ------------- | -------- | --------------------- |
| `productId` | UUID          | yes      | Catalog product       |
| `segment`   | string (≤100) | no       | Customer segment      |
| `locale`    | string (≤20)  | no       | e.g. `en-US`, `de-DE` |
| `partner`   | string (≤255) | no       | Partner ID            |
| `quantity`  | integer ≥ 1   | no       | Defaults to `1`       |

### Response `200`

```json
{
  "data": {
    "productId": "prod_01H...",
    "productName": "Pro Plan",
    "basePriceCents": 4900,
    "resolvedPriceCents": 4410,
    "currency": "USD",
    "quantity": 1,
    "context": { "segment": "smb", "locale": "en-US" },
    "rulesApplied": [
      {
        "rule": "Pricing tier: SMB monthly",
        "type": "pricing_tier",
        "adjustment": "+0 cents",
        "detail": "Matched tier \"SMB monthly\" (flat)"
      },
      {
        "rule": "Offer: Welcome 10% off (WELCOME10)",
        "type": "offer_discount",
        "adjustment": "-490 cents",
        "detail": "percentage discount of 10%"
      }
    ],
    "availableOffers": [
      { "id": "off_01H...", "code": "WELCOME10", "name": "Welcome 10% off", "discountType": "percentage", "discountValue": "10" }
    ]
  }
}
```

### Errors

| Status | When              |
| ------ | ----------------- |
| `400`  | Validation failed |
| `404`  | Product not found |

### cURL

```bash
curl -G https://api.example.com/api/v1/pricing/resolve \
  -H "Authorization: Bearer $PEAK_API_KEY" \
  --data-urlencode 'productId=prod_uuid' \
  --data-urlencode 'segment=smb' \
  --data-urlencode 'locale=en-US' \
  --data-urlencode 'quantity=2'
```

***

## Related

* [Subscriptions](/developers/reference-pages/subscriptions.md) — execute a previewed change
* [Orders](/developers/reference-pages/orders.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.peakcommerce.com/developers/reference-pages/pricing-previews.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
