# Load an Offering and its Product availability

Operation / SDK: `resolveOffering` · `resolve_offering` · `ResolveOffering`

Resolve a published Offering Version, its candidate Products and availability.

Last updated: 2026-11-06

[Web version](https://www.longplayai.com/docs/api/resolve-offering)

<a id="request"></a>

## Request

- **Credential**: Server Key (with `customerId`) or Customer Token, scope `entitlements:read`.
- **SDK**: JavaScript `createLongplayServer().resolveOffering` · JavaScript `createLongplay().resolveOffering` · Python `resolve_offering` · Go `ResolveOffering`
- **Success**: HTTP 200

The response shows example data.

**cURL: request.sh**

```bash
curl -X POST "$LONGPLAY_API_URL/api/v1/offerings/resolve" \
  -H "Authorization: Bearer $LONGPLAY_SERVER_KEY" \
  -H "X-Indiana-Protocol: 0.10" \
  -H "Content-Type: application/json" \
  -d '{
  "selector": {
    "type": "version",
    "versionId": "2d393025-cac1-4672-8ea7-31dada869245"
  },
  "commerce": {
    "provider": "stripe",
    "currency": "USD"
  },
  "customerId": "8b258f8b-4228-40fa-8d24-5b16428e686d"
}'
```

**TypeScript: resolveOffering.ts**

```ts
import { createLongplayServer } from "@tinkerlandai/longplay-sdk/server";

const longplay = createLongplayServer({
  baseUrl: process.env.LONGPLAY_API_URL!,
  apiKey: process.env.LONGPLAY_SERVER_KEY!,
  scope: { projectId: process.env.LONGPLAY_PROJECT_ID!, environment: "sandbox" },
});

export async function resolveOffering() {
  return longplay.resolveOffering({
    selector: {
      type: "version",
      versionId: "2d393025-cac1-4672-8ea7-31dada869245",
    },
    commerce: {
      provider: "stripe",
      currency: "USD",
    },
    customerId: "8b258f8b-4228-40fa-8d24-5b16428e686d",
  });
}
```

**Request body: request.json**

```json
{
  "selector": {
    "type": "version",
    "versionId": "2d393025-cac1-4672-8ea7-31dada869245"
  },
  "commerce": {
    "provider": "stripe",
    "currency": "USD"
  },
  "customerId": "8b258f8b-4228-40fa-8d24-5b16428e686d"
}
```

**Response: response.json**

```json
{
  "requestId": "44f5fcb8-6ed8-41b8-818f-7571941c5fd5",
  "scope": {
    "projectId": "df5426d6-b335-403c-8f3e-b0f73d2e3511",
    "environment": "sandbox"
  },
  "offering": {
    "id": "2bd9a6d1-333e-46ea-8850-4480295cc169",
    "offeringId": "2bd9a6d1-333e-46ea-8850-4480295cc169",
    "version": 1,
    "document": {
      "lookupKey": "1Example",
      "displayName": "1Example",
      "items": [
        {
          "type": "product",
          "productId": "2fd314d6-0f91-46cc-8882-ae8b3cc3bd21"
        }
      ],
      "metadata": {}
    }
  },
  "candidates": [
    {
      "productId": "1Example",
      "productVersionId": "1Example",
      "name": "Pro",
      "action": "purchase",
      "membershipId": null,
      "currency": "USD",
      "amountMinor": "1",
      "interval": "free",
      "intervalCount": 1
    }
  ],
  "availability": [
    {
      "productVersionId": "8c489a1a-5542-44fe-8e80-da2f6a319d01",
      "available": true,
      "reason": null
    }
  ],
  "check": null
}
```

<a id="parameters"></a>

## Body parameters

**application/json**

- `processContext` (object, optional): Accepted Funnel commercial invocation, identified by its original Run, Customer binding and operation receipt; valid Customer credentials remain required.
- `processContext.runId` (uuid, required): Run ID.
- `processContext.bindingId` (uuid, required): Immutable Run-to-Customer binding ID captured for the invocation, checked against the Run, receipt and current authorization.
- `processContext.receiptId` (uuid, required): receipt ID.
- `funnelId` (uuid, optional): Funnel ID.
- `funnelVersionId` (uuid, optional): Funnel Version ID.
- `selector` (object | object | object | object, required): How to select the Offering or Paywall.
- `selector.type` ("current" | "id" | "lookup_key" | "version", required): Selection mode. For an Offering, `current` (the environment's current Offering), `id` and `lookup_key` resolve that Offering's published Version and `version` pins an exact Offering Version; for a Paywall, `paywall` resolves its published Version and `version` pins an exact Paywall Version. For a Page, Popup or Banner, `resource` resolves its currently published Version and `version` pins a published Version.
- `selector.id` (uuid, optional): Offering UUID in an Offering selector. For a Page, Popup or Banner, the resource or published Version UUID selected by selector.type; an archived or unpublished resource returns not found.
- `selector.lookupKey` (string, optional): Stable lookup key. minLength: 1 · maxLength: 200
- `selector.versionId` (uuid, optional): Immutable product_versions.id, including historical versions.
- `customerId` (string, optional): The Customer UUID. Required with a Server Key; omit it with a Customer Token. minLength: 1
- `commerce` (object, required): Provider and currency, for example `{ "provider": "stripe", "currency": "USD" }`.
- `commerce.provider` (enum, required): Payment provider; see the allowed values. Values: `"stripe"`, `"apple"`, `"google"`, `"merchant"`.
- `commerce.currency` (enum, required): Currency code supported by the published price. Values: `"USD"`, `"EUR"`, `"CNY"`, `"GBP"`, `"JPY"`, `"CAD"`, `"AUD"`, `"NZD"`, `"CHF"`, `"HKD"`, `"SGD"`, `"KRW"`, `"INR"`, `"BRL"`, `"MXN"`, `"TWD"`, `"THB"`, `"IDR"`, `"MYR"`, `"PHP"`, `"VND"`, `"ZAR"`, `"AED"`, `"SAR"`, `"SEK"`, `"NOK"`, `"DKK"`, `"PLN"`, `"CZK"`, `"HUF"`, `"ILS"`, `"TRY"`, `"RON"`.
- `commerce.intent` ("subscription_change", optional): Intent; see the allowed values.
- `requirement` (object, optional): The requirement to check: Feature, quantity and pricing properties.
- `requirement.internal_feature_id` (uuid, required): Feature ID.
- `requirement.quantity` (string, required): Quantity as a decimal string, avoiding floating-point error. pattern: ^(0|[1-9]\d{0,11})(\.\d{1,6})?$
- `requirement.properties` (object, required): Validated pricing properties used to match dimensions and multipliers.
- `requirement.entityId` (uuid, optional): Entity ID within the current customer scope, for configured Entity and license Features.

<a id="response"></a>

## Response fields

Every successful response includes `requestId` (this request's ID, for support) and `scope` (App and environment).

**HTTP 200 · application/json**

- `requestId` (uuid, required): UUID the server generated for this HTTP request; include it when reporting a problem. It is not your business requestId.
- `scope` (object, required): The App and environment of this response. Headers only verify scope; they cannot switch key scope.
- `scope.projectId` (string, required): App ID bound to the credential. minLength: 1
- `scope.environment` (enum, required): Separate data scope: sandbox or live. Values: `"sandbox"`, `"live"`.
- `offering` (object, required): Offering; fields below.
- `offering.id` (uuid, required): The Offering's ID.
- `offering.offeringId` (uuid, required): Offering ID.
- `offering.version` (integer, required): Version number. max: 9007199254740991
- `offering.document` (object, required): Published schemaVersion 3 design. May be null on a cache hit; direct HTTP callers must hydrate from the matching cache.
- `offering.document.lookupKey` (string, required): Stable lookup key. minLength: 1 · maxLength: 200
- `offering.document.displayName` (string, required): Display name. minLength: 1 · maxLength: 1500
- `offering.document.items` (array, required): List items. maxItems: 20
- `offering.document.items.type` ("product" | "group", required): `product` is a leaf that references one Product Version by `productId`; `group` is a named group local to this Offering document, with its own `key`, `name` and nested `items` (at most three levels below the root).
- `offering.document.items.productId` (uuid, optional): Product ID.
- `offering.document.items.key` (string, optional): Key of this item. On an Offering `group` item it is the group key (a letter followed by up to 63 letters, digits, `_` or `-`), unique within the Offering; on an invoice detail item it identifies the invoice line. pattern: ^[a-zA-Z][a-zA-Z0-9_-]{0,63}$
- `offering.document.items.name` (string, optional): Display name; not a unique identifier. minLength: 1 · maxLength: 80
- `offering.document.items.items` (array, optional): List items. maxItems: 20
- `offering.document.metadata` (object, required): Custom key-value data.
- `candidates` (array, required): Candidate Products. maxItems: 20
- `candidates.productId` (string, required): Product ID. minLength: 1
- `candidates.productVersionId` (string, required): Product Version ID. minLength: 1
- `candidates.name` (string, required): Display name; not a unique identifier. minLength: 1 · maxLength: 120
- `candidates.action` (enum, required): Business action. Target fields and quantity requirements vary by action; see the request structure and example. Values: `"purchase"`, `"upgrade"`, `"addon"`, `"topup"`.
- `candidates.membershipId` (string | null, required): membership ID.
- `candidates.featureQuantities` (object, optional): Prepaid Feature quantities by internal Feature ID.
- `candidates.currency` (enum, required): Currency code supported by the published price. Values: `"USD"`, `"EUR"`, `"CNY"`, `"GBP"`, `"JPY"`, `"CAD"`, `"AUD"`, `"NZD"`, `"CHF"`, `"HKD"`, `"SGD"`, `"KRW"`, `"INR"`, `"BRL"`, `"MXN"`, `"TWD"`, `"THB"`, `"IDR"`, `"MYR"`, `"PHP"`, `"VND"`, `"ZAR"`, `"AED"`, `"SAR"`, `"SEK"`, `"NOK"`, `"DKK"`, `"PLN"`, `"CZK"`, `"HUF"`, `"ILS"`, `"TRY"`, `"RON"`.
- `candidates.amountMinor` (string, required): Amount in the currency's minor unit, such as cents. pattern: ^(0|[1-9]\d{0,8})$
- `candidates.interval` (enum, required): Interval; see the allowed values. Values: `"free"`, `"week"`, `"month"`, `"year"`, `"one_time"`.
- `candidates.intervalCount` (integer, required): Charging interval count: up to 156 weeks, 36 months or 3 years; omitted means 1. Not accepted for free or one_time. Allowance resets remain independent. min: 1 · max: 156
- `availability` (array, required): Availability. maxItems: 20
- `availability.productVersionId` (uuid, required): Product Version ID.
- `availability.available` (boolean, required): Available quantity.
- `availability.reason` (enum | null, required): Rejection reason or ledger operation description; interpret with accepted and status.
- `check` (object | null, required): Access check result.
- `check.internal_feature_id` (string, required): Feature ID. minLength: 1
- `check.name` (string, required): Display name; not a unique identifier. minLength: 1 · maxLength: 120
- `check.kind` (enum, required): Kind; see the allowed values. Values: `"access"`, `"metered"`, `"credit"`.
- `check.quantity` (string, required): Quantity as a decimal string, avoiding floating-point error. pattern: ^(0|[1-9]\d{0,11})(\.\d{1,6})?$
- `check.allowed` (boolean, required): Whether this Feature is allowed at evaluation time. Use for display; your backend still authorizes business operations.
- `check.observation` (object, optional): Authority, revision and observation time of this check; required when the merchant decides.
- `check.observation.subject` (object, required): App, environment and Customer of this entitlement decision; must match the original request.
- `check.observation.subject.scope` (object, required): The App and environment of this response. Headers only verify scope; they cannot switch key scope.
- `check.observation.subject.customerId` (uuid, required): The Customer's UUID.
- `check.observation.authority` (enum, required): Authority that produced this decision. Values: `"longplay"`, `"merchant"`.
- `check.observation.observedAt` (date-time, required): Timestamp (ISO 8601).
- `check.observation.sourceRevision` (string, required): Authoritative data revision, used to detect a stale result. minLength: 1 · maxLength: 128
- `check.observation.requirementDigest` (string, required): Digest of the original requirement; the response must match it. pattern: ^[a-f0-9]{64}$
- `check.reason` (enum | null, required): Rejection reason or ledger operation description; interpret with accepted and status.
- `check.preview` (object | null, required): Purchase recommendation for denied access, present when the request includes `commerce`. `scenario` is `usage_limit` when the Customer has a balance for the Feature (or the credit Feature that funds it) and `feature_flag` otherwise. `candidates` lists, in order, up to 20 Products that grant that Feature or credit Feature, priced in `commerce.currency`: main Products the Customer does not hold that upgrade its current main Product (every main Product when it holds none), then add-ons it does not hold and one-time add-ons. Products without a single fixed price in that currency are left out, and a `paywallId`, Paywall or Offering limits the list to the Products it presents, so `candidates` can be empty. `null` when `allowed` is `true` or the request has no `commerce`.
- `check.preview.scenario` (enum, required): Scenario; see the allowed values. Values: `"feature_flag"`, `"usage_limit"`.
- `check.preview.candidates` (array, required): Candidate Products. maxItems: 20
- `check.preview.candidates.productId` (string, required): Product ID. minLength: 1
- `check.preview.candidates.productVersionId` (string, required): Product Version ID. minLength: 1
- `check.preview.candidates.name` (string, required): Display name; not a unique identifier. minLength: 1 · maxLength: 120
- `check.preview.candidates.action` (enum, required): Business action. Target fields and quantity requirements vary by action; see the request structure and example. Values: `"purchase"`, `"upgrade"`, `"addon"`, `"topup"`.
- `check.preview.candidates.membershipId` (string | null, required): membership ID.
- `check.preview.candidates.featureQuantities` (object, optional): Prepaid Feature quantities by internal Feature ID.
- `check.preview.candidates.currency` (enum, required): Currency code supported by the published price. Values: `"USD"`, `"EUR"`, `"CNY"`, `"GBP"`, `"JPY"`, `"CAD"`, `"AUD"`, `"NZD"`, `"CHF"`, `"HKD"`, `"SGD"`, `"KRW"`, `"INR"`, `"BRL"`, `"MXN"`, `"TWD"`, `"THB"`, `"IDR"`, `"MYR"`, `"PHP"`, `"VND"`, `"ZAR"`, `"AED"`, `"SAR"`, `"SEK"`, `"NOK"`, `"DKK"`, `"PLN"`, `"CZK"`, `"HUF"`, `"ILS"`, `"TRY"`, `"RON"`.
- `check.preview.candidates.amountMinor` (string, required): Amount in the currency's minor unit, such as cents. pattern: ^(0|[1-9]\d{0,8})$
- `check.preview.candidates.interval` (enum, required): Interval; see the allowed values. Values: `"free"`, `"week"`, `"month"`, `"year"`, `"one_time"`.
- `check.preview.candidates.intervalCount` (integer, required): Charging interval count: up to 156 weeks, 36 months or 3 years; omitted means 1. Not accepted for free or one_time. Allowance resets remain independent. min: 1 · max: 156

<a id="errors"></a>

## Errors

Failures return an error object; handle them by `error.code` and `error.recovery`. The table lists the errors that follow from this operation's credential, scope and idempotency fields; depending on the request it can also return `NOT_FOUND` (a referenced resource doesn't exist), `NOT_CONFIGURED` (a required integration isn't connected) or `PAYLOAD_TOO_LARGE`. Some refusals, such as insufficient balance, are not errors but a `reason` in a successful response.

**Possible errors**

| code | HTTP | When | recovery |
| --- | --- | --- | --- |
| `INVALID_REQUEST` | 400 | The request doesn't match this page's parameters. A missing or malformed protocol header returns `UNSUPPORTED_PROTOCOL_VERSION` or `INVALID_PROTOCOL_VERSION` instead. | `fix_request` |
| `UNAUTHENTICATED` | 401 | The credential is missing, invalid, expired or revoked. | `authenticate` |
| `FORBIDDEN` | 403 | The credential lacks `entitlements:read`. | `check_permissions` |
| `SCOPE_MISMATCH` | 403 | `X-Indiana-Project` or `X-Indiana-Environment` doesn't match the credential's App and environment. | `check_scope` |
| `RATE_LIMITED` | 429 | Too many requests; wait for `Retry-After` and retry the same request. | `retry_same_request` |
| `SERVICE_UNAVAILABLE` | 503 | The service is temporarily unavailable; retry the same request. | `retry_same_request` |
| `INTERNAL_ERROR` | 500 | The outcome is unknown; retry later. | `recover_operation` |

- [Error codes and recovery](https://www.longplayai.com/docs/api/errors.md)
- [Request conventions](https://www.longplayai.com/docs/api.md)
- [All operations](https://www.longplayai.com/docs/api/operations.md#access)
