Skip to content
Indiana
Dashboard
Docs
Browse docs / Browser client

Browser client

Read the current Customer’s holdings, Offering, Paywall, ledger and offers.

SDK examples target the current API. Check matching SDK versions and HTTP alternatives

API v1Updated

Browser SDK

This reference targets protocol 0.5. See version information for SDK availability and HTTP examples.

Related:Versions and integration

Verify host login and issue the current customer's session on your backend. Browsers cannot choose an arbitrary customerId.

Current exports and methods

  • await indiana.features({ attributes? })

    Permissionsfeatures:read

    Load flags with the existing Customer or Guest session. isOn/getFeatureValue synchronously use local rules or the latest remote result, with a fallback while remote evaluation is pending. Attribute changes discard previous remote results; subscribe observes updates and destroy releases refresh listeners.

    Returns FeatureClient

  • indiana.track(name, properties); await indiana.flush()

    Permissionsevents:write

    Batch by 100 events and request size, flushing periodically and when the page is hidden. Failures retain event IDs; identify/reset clears previous identity queues and flag results. The server fixes the Customer from the session; browsers cannot select another Customer. The unpublished 0.4 source candidate adds environment collection controls: enable the required categories in the selected environment's integration settings. Disabled collection is acknowledged as skipped and preserves history.

    Returns { inserted, duplicates, rejected }

  • resolvePaywall({ selector, locale, commerce, requirement? })

    Permissionsentitlements:read

    Resolve the independent Paywall, pinned Offering Version and current presentation capabilities without a Funnel or purchase.

    Returns { paywall }

  • setupPayment({ requestId, currency, makeDefault })

    Permissionsbilling:write

    Create a standalone card setup, without a subscription, entitlement or usage billing consent.

    Returns { setup }

  • readPaymentSetup({ setupId })

    Permissionsbilling:read

    Verify the actual provider result of the original setup without duplicate charges.

    Returns { setup }

  • readBillingInvoice({ invoiceId, after, limit })

    Permissionsbilling:read

    Page through all verified invoice items with nextCursor, without charging.

    Returns { detail }

  • readCreditStatement({ from, to, entityId?, snapshotAt, after, limit })

    Permissionscredits:read

    Up to 366 days. The first page uses null snapshotAt/after; subsequent pages retain the original snapshot and complete cursor.

    Returns { statement }

  • previewUpdate({ requestId, membershipId, timing, change })

    Permissionsbilling:read

    Quote a plan, seat or cancellation change for a membership billed by a Stripe subscription; upgrades are immediate and prorated, downgrades take effect at the end of the cycle.

    Returns { quote }

  • update({ operationId })

    Permissionsbilling:write

    Confirm the quote: Indiana execution runs it once in Stripe; record-only mode returns the Stripe instructions for the merchant.

    Returns { operation }

  • readSubscriptionUpdate({ operationId })

    Permissionsbilling:read

    Read the change status; a booked downgrade or cancellation is scheduled until it takes effect.

    Returns { operation }

  • previewAttach({ entityId?, requestId, plans, provider, currency, offerId? })

    Permissionsbilling:read

    Save a quote of up to 24 hours with the identified customer session and hold the selected offer. Omit customerId; preview initiates no payment. In record-only mode, quote.execution tells your backend how to create the Stripe Checkout Session with its own Stripe key.

    Returns { quote }

  • attach({ operationId, intent? })

    Permissionsbilling:write

    Execute after explicit quote acceptance; intent cancel abandons the quote and releases its held offer. While pending, it returns checkoutUrl when Indiana executes Stripe, or the same execution in record-only mode; it becomes complete once verified Stripe notifications are recorded. Retry the same operationId after a lost response.

    Returns { operation }

  • restoreNativePurchase({ requestId, provider, purchaseIntentId, productId, signedTransaction?, purchaseToken? })

    Permissionsbilling:write

    Recover a store-verified purchase under the identified customer session.

    Returns { restore }

  • readSubscriptionOperation({ operationId })

    Permissionsbilling:read

    Recover the original order status and verified delivery without initiating a new charge.

    Returns { operation }

  • setBillingCoupons({ membershipId, requestId, grantIds })

    Permissionsbilling:write

    Set ordered discounts for the current customer's active authorization using owned grants. Retrying requestId retains the original receipt; discounts cannot change during collection.

    Returns { coupons }

  • confirmBillingAdjustment({ invoiceId, accepted: true })

    Permissionsbilling:write

    Call only after the customer reviews and accepts the fixed additional invoice; loading or automatic retry does not imply consent.

    Returns { invoice }

  • readBillingControls(input?)

    Permissionsbilling:read

    Read the verified customer's authorizations, limits, usage windows and automatic top-up state.

    Returns { controls }

  • prepareBillingAuthorization(input)

    Permissionsbilling:write

    Retain requestId to prepare fixed version and limit terms; preparation is not customer consent.

    Returns { prepared }

  • confirmBillingAuthorization({ authorizationId, accepted: true })

    Permissionsbilling:write

    Call after explicit customer consent; the server rechecks the current authorization and provider setup.

    Returns { authorization }

  • revokeBillingAuthorization({ authorizationId, requestId })

    Permissionsbilling:write

    Revoke the current customer's authorization; retries retain the request UUID.

    Returns { authorization }

  • listBillingInvoices({ after, limit }?)

    Permissionsbilling:read

    Read usage invoices for the current customer; page with nextCursor and a maximum limit of 100.

    Returns { invoices }

  • readBillingControls(input) / listBillingInvoices({ after, limit })

    Permissionsbilling:read

    Read the authenticated customer's payment authorizations, usage windows, limits and paginated invoices. Reads, refreshes and pagination do not charge.

    Returns { controls } / { invoices }

  • prepareBillingAuthorization(input) / confirmBillingAuthorization({ authorizationId, accepted: true }) / revokeBillingAuthorization({ authorizationId, requestId })

    Permissionsbilling:write

    Prepare fixed terms and a Sandbox payment method with a persistent requestId. Payments require completed setup and explicit customer acceptance. Revocation blocks subsequent automatic charges and retains existing financial facts.

    Returns { prepared } / { authorization }

  • identify(customerToken) / reset()

    Keep the token in memory only. Reset or identity changes abort old requests; destroy and discard active Funnel runs too.

    Returns void

  • subscribeIdentity(listener)

    Observe identify/reset to clear host UI; returns an unsubscribe function.

    Returns Unsubscribe function

  • resolveOffering({ selector, commerce, requirement? })

    Permissionsentitlements:read

    Resolve a published Offering and Product availability for the verified current Customer. Browsers cannot override customerId. Preserve document.items and the returned Version; resolving does not purchase.

    Returns { offering, candidates, availability, check }

  • checkEntitlement({ requirement, commerce?, paywallId? })

    Permissionsentitlements:read

    Available in npm 0.1.0 beta. With a matching server, use the current customer token to read allowed, denial reason and product recommendations. Browsers cannot choose a customer identity.

    Returns { check }

  • readHoldings()

    Permissionsentitlements:read

    Read memberships and balances for the authenticated customer; no customerId is accepted.

    Returns { holdings }

  • readLedger(query)

    Permissionscredits:read

    Page the authenticated customer's full history; cursors retain entry type and precise timestamp.

    Returns { ledger }

  • quoteBalance(command)

    Permissionscredits:read

    Supply operation: quote, internal_feature_id, decimal quantity and properties. Quotes do not consume funds.

    Returns { quote }

  • listOffers()

    Permissionsoffers:resolve

    Read the current customer's available offers. Claims and purchases execute through published Funnel nodes.

    Returns Offer[]

  • redeemCoupon(code, requestId)

    Permissionsoffers:resolve

    Redeem a code in the current scope; retain requestId for retries after lost responses.

    Returns { offer, reason }

  • redeemReward(input) / createReferralCode(input)

    Permissionsoffers:resolve

    Use configured reward and referral programs; referral-code creation also requires offers:resolve.

    Returns Reward / referral code

  • setBillingCoupons(input)

    Permissionsbilling:write

    Replace the ordered coupon list for future collections on a confirmed authorization. An empty list removes attachments. Retain requestId for retries; changes wait for an active collection.

    Returns BillingCoupons

  • claimRewardProduct(input)

    Permissionsoffers:resolve

    Pass accepted: true after reviewing the reward and renewal terms. Retain redemptionId and requestId for retries. New subscriptions return type: checkout. Matching paid subscriptions return type: subscription and the discount operation status, retaining their native subscription and existing discounts.

    Returns RewardProductCheckout

  • formatCouponTerms / formatCouponDiscount / formatCouponMoney

    Format the authoritative coupon terms returned by the server; labels do not determine eligibility or actual charges.

    Returns string