Skip to content
Indiana
Dashboard
Docs
Browse docs / Code examples

Code examples

Connect the verified HTTP flow to your Next.js login and Web UI.

Download HTTP integration example
API v1Updated

Next.js: HTTP integration files

Prerequisites: complete the quickstart and have a Next.js App Router app with server authentication. These files use native fetch and no Indiana SDK; configure @/ for src or your app root.

  • Copy configuration, server helper and session route. Implement getSignedInUser with your existing auth module; its declaration is a contract, not a login implementation.
  • Copy the browser module and mount GenerationAccess on a signed-in page. A generations Feature and granting Product enable access; empty holdings display unavailable.
.env.localShell
# Copy these values from your App → Sandbox → SDK setupINDIANA_BASE_URL=https://your-indiana-host.exampleINDIANA_PROJECT_ID=your-project-idINDIANA_SECRET_KEY=your-sandbox-server-key # Public browser configuration; no secret keyNEXT_PUBLIC_INDIANA_BASE_URL=https://your-indiana-host.exampleNEXT_PUBLIC_INDIANA_PROJECT_ID=your-project-id

Sessions and account changes

connectIndiana obtains a short-lived session and reads once. disconnectIndiana clears the in-memory token, aborts requests and rejects late responses. This minimal recipe assumes one mounted host; multiple components should share an application identity provider.

On 401, confirm host login remains valid, then obtain a new session. Show an error on failure rather than retrying indefinitely. Keep the original requestId/idempotencyKey for write retries to avoid duplicate purchases or consumption.

Verify the result

Check anonymous 401, signed-in 200, no-store responses, no browser Secret Key and rejection of late responses after sign-out/account changes.

Add independent capabilities

After identity reads work, select a task guide. Purchases, Coupon grants and consumption do not require a Funnel; add one for multi-step orchestration.

Related:Purchases and Stripe Checkout

Related:Balances, consumption and reservations

Related:Resolve an Offering for your UI

Related:Present a standalone Paywall