Create the required Features and Products in the same App/environment, save their prices and entitlements, and use the returned Product identity and version. Products have no separate publish action.
Create an Offering from those Products and publish an Offering Version. Publish a Paywall pinned to one published Offering Version, selecting its displayed Products, order and default choice.
Save the Paywall ID. Publishing a new Offering does not update an existing Paywall's version pin. A Paywall does not require a Funnel.
Identify the authenticated user as a Customer on your backend and issue a session with a Key holding sessions:create, entitlements:read, billing:read and billing:write. Configure the exact browser Origin. For payments, configure Stripe for that same App/environment and validate in Sandbox first.
Saving a Product returns its identity and version without an additional publication step. Offerings and Paywalls still publish independent versions. Creating a Product version does not automatically migrate existing customer holdings to it.
Version options belong to the Product update write operation's query object. Console exposes only the “Save these changes as a new version” checkbox, which sets query.force_version; disable_version and all_versions can only be set in the write operation's query object and have no Console controls.
Update behavior and affected versions
Change
Behavior
Prices, entitlements, trials or licenses
With the default update options, changed price/entitlement items or trial terms create a new version when the selected version has active, past_due, scheduled or paused customer holdings. Supplying licenses also creates a new version under these conditions, even if unchanged. Expired-only holdings do not meet this condition. Historical holdings continue to reference their original price and entitlement definitions.
Billing-controls-only changes
If only billing controls change and the selected version has customer holdings in the states above, the default update still creates a new version.
force_version
Creates a new version even when the supplied field values are unchanged, except for an empty update or an update containing only base_plan_id. It cannot be combined with disable_version or all_versions. Product details and metadata still follow the in-place rules below.
disable_version
Uses the in-place update path and can change the version used by existing customers.
all_versions
Applies the update's changes in place to historical versions. It cannot be combined with force_version or disable_version and does not support updating licenses across all versions.
Product details and metadata
Changes to details such as name, description, group, default flag, archive status and config apply to the selected version in place, including some updates that also create a new version. Metadata is shared across all versions of the Product identity.
Update behavior and affected versions
Prices, entitlements, trials or licenses
Behavior
With the default update options, changed price/entitlement items or trial terms create a new version when the selected version has active, past_due, scheduled or paused customer holdings. Supplying licenses also creates a new version under these conditions, even if unchanged. Expired-only holdings do not meet this condition. Historical holdings continue to reference their original price and entitlement definitions.
Billing-controls-only changes
Behavior
If only billing controls change and the selected version has customer holdings in the states above, the default update still creates a new version.
force_version
Behavior
Creates a new version even when the supplied field values are unchanged, except for an empty update or an update containing only base_plan_id. It cannot be combined with disable_version or all_versions. Product details and metadata still follow the in-place rules below.
disable_version
Behavior
Uses the in-place update path and can change the version used by existing customers.
all_versions
Behavior
Applies the update's changes in place to historical versions. It cannot be combined with force_version or disable_version and does not support updating licenses across all versions.
Product details and metadata
Behavior
Changes to details such as name, description, group, default flag, archive status and config apply to the selected version in place, including some updates that also create a new version. Metadata is shared across all versions of the Product identity.
Default Products are assigned by eligibility when a Customer is created or a Guest is identified; a default can include a no-card trial of a paid recurring Product. Default Products are not reassigned when an existing Customer signs in again. Changing a default flag does not reinitialize Products for existing Customers.
Call previewAttach to get a quote and an operationId; nothing is charged yet.
Call attach to confirm; when it returns a checkoutUrl, redirect to the Stripe payment page.
Save the operationId before redirecting. The return is a new page load, so call identify again, then readSubscriptionOperation; complete means paid and active, and pending means read again later.
purchase.tsTypeScript
1import { createLongplay } from"@tinkerlandai/longplay-sdk";23const longplay = createLongplay({4 baseUrl: "https://api.longplayai.com",5 scope: { projectId: "<APP_UUID>", environment: "sandbox" },6});78exportasyncfunctionbuy(customerToken: string, requestId: string) {9 longplay.identify(customerToken);10const { quote } = await longplay.previewAttach({11 requestId, // persisted before the first attempt12 plans: [{ productVersionId: "<PRODUCT_VERSION_UUID>" }],13 provider: "stripe",14 currency: "USD",15 });16const { operation } = await longplay.attach({ operationId: quote.operationId });17// Checkout leaves this page, so keep the operation ID for the return page.18 sessionStorage.setItem("indiana-operation", operation.operationId);19if (operation.checkoutUrl) window.location.assign(operation.checkoutUrl);20return operation.operationId;21}2223// The return from checkout is a new page load: identify again before reading.24exportasyncfunctionafterReturn(customerToken: string) {25const operationId = sessionStorage.getItem("indiana-operation");26if (!operationId) returnnull;27 longplay.identify(customerToken);28const { operation } = await longplay.readSubscriptionOperation({ operationId });29if (operation.status !== "pending") sessionStorage.removeItem("indiana-operation");30return operation.status; // "pending" | "complete" | "cancelled" | "failed"31}
First connect Stripe for the App and environment under Payment connections in Console; Sandbox uses Stripe test mode.
A browser buys only for the current user; a backend using a Server Key passes customerId.
Save the requestId and reuse it on retries; never infer payment from the redirect.
When the merchant executes payments (record_only), Stripe is not needed: the quote returns the merchant-prepared merchantTerms; when those terms include requiredConsents, confirming attach, update or refund requires the matching merchantConfirmation. The merchant takes payment, and the operation completes after you report the result with recordMerchantEvent. See the merchant execution specification.
Provide a real container and call openPaywall(container, customerToken). Keep the returned host handle and clean it up using the SDK lifecycle on unmount or Customer changes.
After display, verify that the choices come from the pinned Offering Version. Confirm a purchase from the original commercial operation and current entitlements; display, dismissal or a return page is not payment confirmation.
Integration troubleshooting
Problem
Check
401 / 403
Session expiry, Origin, Key permissions and matching App/environment.
Paywall missing or unexpected choices
Publication state, Paywall ID, pinned Offering Version and displayed subset.
Purchase pending or timed out
Keep the original operationId/requestId and read its result; follow error recovery without creating another purchase.
Integration troubleshooting
401 / 403
Check
Session expiry, Origin, Key permissions and matching App/environment.
Paywall missing or unexpected choices
Check
Publication state, Paywall ID, pinned Offering Version and displayed subset.
Purchase pending or timed out
Check
Keep the original operationId/requestId and read its result; follow error recovery without creating another purchase.
When the balance falls below threshold, Longplay buys more with the user's saved payment method. Show prepared.terms to the user and confirm only after they accept.
auto-topup.tsTypeScript
1import { createLongplay } from"@tinkerlandai/longplay-sdk";23const longplay = createLongplay({4 baseUrl: "https://api.longplayai.com",5 scope: { projectId: "<APP_UUID>", environment: "sandbox" },6});78typeUUID = ReturnType<typeof crypto.randomUUID>;910exportasyncfunctionprepareAutoTopup(customerToken: string, requestId: UUID) {11 longplay.identify(customerToken);12const { prepared } = await longplay.prepareBillingAuthorization({13 requestId,14 kind: "auto_topup",15 productVersionId: "<CREDIT_PACK_VERSION_UUID>",16 internal_feature_id: "<CREDIT_FEATURE_UUID>",17 currency: "USD",18 threshold: "100",19 quantity: "1",20 });21return prepared; // show prepared.terms to the Customer22}2324// Call only after the Customer explicitly accepts the displayed terms.25exportasyncfunctionacceptAutoTopup(authorizationId: string) {26return longplay.confirmBillingAuthorization({ authorizationId, accepted: true });27}