---
name: longplay
description: Integrate Longplay customer identity, entitlements, usage billing, paywalls, offers, experiments, funnels or build-time App page maps (IAM) into an application using its official SDKs, HTTP API and scoped management CLI. Use when a user asks to connect an application to Longplay or extend an existing Longplay integration.
---

# Longplay integration

Read the [official agent guide](https://www.longplayai.com/docs/guides/agents.md) first. Discover task references through [llms.txt](https://www.longplayai.com/llms.txt). Each public article has an English Markdown address at `/docs/{path}.md` and a Simplified Chinese address at `/zh-hans/docs/{path}.md`. The documentation home is `/docs/index.md` or `/zh-hans/docs/index.md`. Category pages use `/docs/guides.md`, `/docs/sdk.md` and `/docs/api.md`, with `/zh-hans` prefixed for Simplified Chinese. Language is chosen only by the path; query parameters do not select a language.

Inspect the host application's language, platform, backend and authenticated user identity. Follow its existing structure. Select only the capabilities the user needs. Use the guide's platform support table and exact public installation versions; do not infer a language method from the TypeScript SDK or an unreleased source checkout. Read the linked operation reference for credential, permissions, input, output and unavailable branches.

## Choose a task

- Customer identity, entitlement checks and usage: [quickstart](https://www.longplayai.com/docs/quickstart.md).
- Browser identity and Customer Tokens: [customers](https://www.longplayai.com/docs/guides/customers.md).
- Longplay-managed Stripe payments, restricted-key permissions, webhook setup, API versions and credential activation: [Stripe integration](https://www.longplayai.com/docs/guides/stripe.md).
- Offering, Paywall and purchase: [commerce](https://www.longplayai.com/docs/guides/commerce.md).
- Merchant-executed purchases with `record_only`: [merchant execution specification](https://www.longplayai.com/docs/guides/merchant-execution.md). Check its protocol and release prerequisites before calling Longplay; the merchant bridge endpoints belong to the merchant.
- Coupons, rewards and referrals: [offers](https://www.longplayai.com/docs/guides/offers.md).
- Feature evaluation, experiments and events: [features](https://www.longplayai.com/docs/guides/features.md).
- Build-time App page maps, framework integration and visual release binding: [IAM](https://www.longplayai.com/docs/iam.md).
- Funnel execution: [funnels](https://www.longplayai.com/docs/guides/funnels.md).
- Management and authoring: [CLI](https://www.longplayai.com/docs/cli.md). Discover supported operations and required grants before requesting authorization.

## Establish scope before calling

Confirm the exact API origin, App and Sandbox/Live environment. Sandbox is a business environment inside a deployment; it does not change the API host. Credentials and resource IDs must belong to that same scope. Follow [environments](https://www.longplayai.com/docs/guides/environments.md) and [Server Key setup](https://www.longplayai.com/docs/guides/server-auth.md).

Server Keys belong on a trusted backend. Authenticate the merchant's user before mapping their stable identity to a Customer and issuing a Customer Token. Browser/native clients receive only their Customer credentials. Management uses the existing user-approved CLI delegation, not a runtime Server Key. Store secrets in ignored backend environment files or the existing credential store; do not request secrets in chat or print them.

Resource creation, payment connections and publication require the user's business choices and authority. Request missing information when it blocks progress. An integration request does not authorize real charges, deployment, package publication, messages or data deletion.

## Implement and verify

Read the task's prerequisites before writing code: configured Products and commercial Features, published Offering Versions, Paywalls pinned to those versions, and published feature flag or experiment definitions cannot be replaced by invented IDs. Preserve each resource's existing publication and commercial rules.

Keep business request/event/idempotency IDs stable after a timeout. Reconcile the original operation before attempting another mutation. Handle structured error codes and recovery actions using [errors](https://www.longplayai.com/docs/api/errors.md); unavailable operations are not fallback implementations.

Run the host project's relevant permitted checks. Local types and fixtures prove local integration behavior; real API/business results need authorized calls and configured resources. Browser verification requires the user's permission when the project requires it. Report completed code, missing configuration, checks actually run and unverified behavior in the conversation. Do not claim a payment or usage debit succeeded from HTTP success alone.
