npx @insforge/cli secrets get ANON_KEY, or in the dashboard: click Install and open API Keys.
Overview
The TypeScript SDK exposes Stripe runtime helpers for generated app frontends:insforge.payments.stripe.createCheckoutSession(...)insforge.payments.stripe.createCustomerPortalSession(...)
See Stripe Payments for setup, database
tables, webhook projections, and fulfillment patterns.
createCheckoutSession()
Create a Stripe Checkout Session through the InsForge backend.Parameters
Returns
One-time checkout
subject and pass customerEmail when available.
If one-time checkout includes a subject and there is no existing Stripe customer mapping yet, InsForge lets Stripe create the customer during Checkout and backfills the subject mapping from the completion webhook.
Subscription checkout
subject because recurring access belongs to an app-defined billing owner, such as a user, team, organization, workspace, tenant, or group.
createCustomerPortalSession()
Create a Stripe Billing Portal Session for a mapped billing subject.Parameters
Returns
Example
Authorization and RLS
The SDK methods call runtime routes using the current InsForge token. The backend inserts local session rows using the caller context:payments.stripe_checkout_sessionsfor Checkout attemptspayments.stripe_customer_portal_sessionsfor Billing Portal attempts
SELECT policies to rows returned by INSERT ... RETURNING and to idempotent retry lookups. If an RLS error appears even though an INSERT policy exists, add a matching SELECT policy for the same billing subject and idempotency key.
Reading payment state
The Payments SDK does not expose generic end-user reads forpayments.customers, payments.stripe_subscriptions, or payments.transactions. Those tables are operational records used for dashboard visibility and reporting.
For user-facing billing state, create app-owned tables with RLS and populate them from provider webhook event triggers:
public.orderspublic.credit_ledgerpublic.user_entitlementspublic.team_billing_status
Live/test environment
Pass'test' as the first SDK argument while developing. Only switch to 'live' after the developer explicitly approves production Stripe changes and live Prices are configured.