# Load a Paywall and its Offering

Operation / SDK: `resolvePaywall` · `resolve_paywall` · `ResolvePaywall`

Resolve a standalone Paywall, its pinned Offering Version and presentation.

Last updated: 2026-11-06

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

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

## Request

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

The response shows example data.

**cURL: request.sh**

```bash
curl -X POST "$LONGPLAY_API_URL/api/v1/paywalls/resolve" \
  -H "Authorization: Bearer $LONGPLAY_SERVER_KEY" \
  -H "X-Indiana-Protocol: 0.10" \
  -H "Content-Type: application/json" \
  -d '{
  "selector": {
    "type": "paywall",
    "paywallId": "31a2b083-2ecf-4b52-8431-a3141dab0bc1"
  },
  "commerce": {
    "provider": "stripe",
    "currency": "USD"
  },
  "locale": "en",
  "customerId": "8b258f8b-4228-40fa-8d24-5b16428e686d"
}'
```

**TypeScript: resolvePaywall.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 resolvePaywall() {
  return longplay.resolvePaywall({
    selector: {
      type: "paywall",
      paywallId: "31a2b083-2ecf-4b52-8431-a3141dab0bc1",
    },
    commerce: {
      provider: "stripe",
      currency: "USD",
    },
    locale: "en",
    customerId: "8b258f8b-4228-40fa-8d24-5b16428e686d",
  });
}
```

**Request body: request.json**

```json
{
  "selector": {
    "type": "paywall",
    "paywallId": "31a2b083-2ecf-4b52-8431-a3141dab0bc1"
  },
  "commerce": {
    "provider": "stripe",
    "currency": "USD"
  },
  "locale": "en",
  "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"
  },
  "paywall": {
    "id": "31a2b083-2ecf-4b52-8431-a3141dab0bc1",
    "paywallId": "31a2b083-2ecf-4b52-8431-a3141dab0bc1",
    "version": 1,
    "content": {
      "environmentId": "c109bd50-5064-4390-8761-1589f2515d2d",
      "offeringVersionId": "6e6729ef-d2ca-4b2a-823b-5a44b9f6bfc1",
      "artifact": {
        "kind": "paywall",
        "formatVersion": 1,
        "url": "1Example",
        "sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
        "byteLength": 1
      }
    },
    "capabilities": {
      "nodes": {},
      "plans": {},
      "pickers": {},
      "diagnostics": [
        {
          "nodeId": "1Example",
          "message": "1Example"
        }
      ]
    },
    "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, required): How to select the Offering or Paywall.
- `selector.type` ("paywall" | "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.paywallId` (uuid, optional): Paywall ID.
- `selector.versionId` (uuid, optional): Immutable product_versions.id, including historical versions.
- `customerId` (uuid, optional): The Customer's UUID.
- `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.
- `locale` (string, required): Display-language hint. Content language is independent of console and documentation language. minLength: 1 · maxLength: 35
- `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"`.
- `paywall` (object, required): Paywall; fields below.
- `paywall.id` (uuid, required): The Paywall's ID.
- `paywall.paywallId` (uuid, required): Paywall ID.
- `paywall.version` (integer, required): Version number. max: 9007199254740991
- `paywall.content` (object, required): Locator for this Paywall Version's immutable public content: the environment, the pinned Offering Version and the content file to download without credentials.
- `paywall.content.environmentId` (uuid, required): environment ID.
- `paywall.content.offeringVersionId` (uuid, required): UUID of the Offering Version this Paywall Version is pinned to; the downloaded content must reference the same Version.
- `paywall.content.artifact` (object, required): The public content file: `url` is a credential-free path on the API origin, and the downloaded bytes must match `byteLength` and `sha256`.
- `paywall.content.artifact.kind` (enum, required): Kind; see the allowed values. Values: `"funnel"`, `"paywall"`, `"gb_features"`, `"gb_page_experiments"`.
- `paywall.content.artifact.formatVersion` (integer, required): Version of the content file format; `1` for Paywall content. max: 9007199254740991
- `paywall.content.artifact.url` (string, required): Hosted checkout URL. Verified provider notifications confirm payment. minLength: 1 · maxLength: 2048
- `paywall.content.artifact.sha256` (string, required): Lowercase hexadecimal SHA-256 digest of the file bytes, also used as the last segment of `url`; discard a download whose digest differs. pattern: ^[a-f0-9]{64}$
- `paywall.content.artifact.byteLength` (integer, required): Exact file size in bytes, at most 1,048,576; discard a download of any other length. max: 1048576
- `paywall.content.artifact.generation` (string, optional): Configuration generation; changes when configuration changes. pattern: ^[a-f0-9]{64}$
- `paywall.capabilities` (object, required): Server-resolved display data for the Paywall screen: node values (`nodes`), Product prices (`plans`), plan pickers (`pickers`) and `diagnostics`; when a requirement applies, `paywall` holds the access check.
- `paywall.capabilities.paywall` (object, optional): Paywall; fields below.
- `paywall.capabilities.paywall.internal_feature_id` (string, required): Feature ID. minLength: 1
- `paywall.capabilities.paywall.name` (string, required): Display name; not a unique identifier. minLength: 1 · maxLength: 120
- `paywall.capabilities.paywall.kind` (enum, required): Kind; see the allowed values. Values: `"access"`, `"metered"`, `"credit"`.
- `paywall.capabilities.paywall.quantity` (string, required): Quantity as a decimal string, avoiding floating-point error. pattern: ^(0|[1-9]\d{0,11})(\.\d{1,6})?$
- `paywall.capabilities.paywall.allowed` (boolean, required): Whether this Feature is allowed at evaluation time. Use for display; your backend still authorizes business operations.
- `paywall.capabilities.paywall.observation` (object, optional): Authority and revision of this Paywall decision; required when the merchant decides.
- `paywall.capabilities.paywall.reason` (enum | null, required): Rejection reason or ledger operation description; interpret with accepted and status.
- `paywall.capabilities.paywall.preview` (object | null, required): Purchase recommendation from the Paywall's access check: the `scenario` and the Products the Paywall displays that would grant access, priced in the request's `commerce.currency` (the same rules as `check.preview` from `checkEntitlement`). When a requirement applies, only these Products are purchasable in `plans` and `pickers`. `null` when access is allowed, in which case no plan is purchasable.
- `paywall.capabilities.nodes` (object, required): Resolved values keyed by screen node ID: `base` is the value to render; nodes tied to a plan picker also carry `picker` and per-plan values in `byPlan`.
- `paywall.capabilities.plans` (object, required): Product Versions to buy, optionally with seat and Feature quantities.
- `paywall.capabilities.pickers` (object, required): Plan pickers keyed by picker ID: `options` lists up to 20 purchasable plans (keys of `plans`), and `selected` is the default option or `null`.
- `paywall.capabilities.quantities` (object, optional): Current value, minimum, maximum, step, display label and availability keyed by quantity control ID.
- `paywall.capabilities.diagnostics` (array, required): Problems found while resolving the screen; each entry names the affected `nodeId` and a `message`. Empty when everything resolved.
- `paywall.capabilities.diagnostics.nodeId` (string, required): Component node ID in the published document.
- `paywall.capabilities.diagnostics.message` (string, required): Developer-facing description of the problem, such as missing data or an unavailable bound Product or coupon; it is not localized, so do not show it to Customers.
- `paywall.check` (object | null, required): Access check result.
- `paywall.check.internal_feature_id` (string, required): Feature ID. minLength: 1
- `paywall.check.name` (string, required): Display name; not a unique identifier. minLength: 1 · maxLength: 120
- `paywall.check.kind` (enum, required): Kind; see the allowed values. Values: `"access"`, `"metered"`, `"credit"`.
- `paywall.check.quantity` (string, required): Quantity as a decimal string, avoiding floating-point error. pattern: ^(0|[1-9]\d{0,11})(\.\d{1,6})?$
- `paywall.check.allowed` (boolean, required): Whether this Feature is allowed at evaluation time. Use for display; your backend still authorizes business operations.
- `paywall.check.observation` (object, optional): Authority, revision and observation time of this check; required when the merchant decides.
- `paywall.check.observation.subject` (object, required): App, environment and Customer of this entitlement decision; must match the original request.
- `paywall.check.observation.authority` (enum, required): Authority that produced this decision. Values: `"longplay"`, `"merchant"`.
- `paywall.check.observation.observedAt` (date-time, required): Timestamp (ISO 8601).
- `paywall.check.observation.sourceRevision` (string, required): Authoritative data revision, used to detect a stale result. minLength: 1 · maxLength: 128
- `paywall.check.observation.requirementDigest` (string, required): Digest of the original requirement; the response must match it. pattern: ^[a-f0-9]{64}$
- `paywall.check.reason` (enum | null, required): Rejection reason or ledger operation description; interpret with accepted and status.
- `paywall.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`.
- `paywall.check.preview.scenario` (enum, required): Scenario; see the allowed values. Values: `"feature_flag"`, `"usage_limit"`.
- `paywall.check.preview.candidates` (array, required): Candidate Products. maxItems: 20

<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)
