The Payments CLI is the admin and agent control surface for Stripe setup. Use it to configure Stripe keys, sync Stripe as the source of truth, manage catalog objects, configure webhooks, and inspect mirrored subscriptions or payment history.Runtime checkout and Billing Portal redirects belong in application code through the TypeScript Payments SDK, not in the CLI.
All examples use npx @insforge/cli. Do not install the CLI globally.
npx @insforge/cli payments statusnpx @insforge/cli --json payments status
Use status first. It shows each environment’s key status, Stripe account identity, latest sync status, sync timestamp, and managed webhook configuration.If the CLI says Payments are not available on this backend, the project is running a backend version that does not expose the payments API. Upgrade the self-hosted backend or ask the project admin to enable payments.
npx @insforge/cli payments confignpx @insforge/cli payments config set test sk_test_xxxnpx @insforge/cli payments config set live sk_live_xxxnpx @insforge/cli payments config remove test
Use payments config set, not generic secrets commands. The payments config flow validates the key with Stripe, records the Stripe account identity, stores the secret in the InsForge secret store, best-effort configures webhooks, and runs sync when the connected Stripe account changes.When configuring interactively, omit the key and the CLI prompts for it:
npx @insforge/cli payments config set test
For non-interactive scripts, pass --json and provide the key argument:
npx @insforge/cli --json payments config set test sk_test_xxx
Sync pulls products, prices, and subscriptions from Stripe into InsForge. Unconfigured environments are skipped.Manual sync does not configure webhooks. Use payments webhooks configure <environment> for webhook setup.
Stripe is the source of truth. Sync overwrites local catalog drift with Stripe data.
Use catalog to inspect products and prices together. This is usually the fastest way for agents to discover usable Stripe price IDs before building checkout UI.
npx @insforge/cli payments prices list --environment testnpx @insforge/cli payments prices list --environment test --product prod_123npx @insforge/cli payments prices get price_123 --environment test
Create a one-time price. Amounts use the smallest currency unit, such as cents for USD:
Webhook setup creates or recreates the InsForge-managed Stripe webhook endpoint for an environment. Webhooks keep checkout sessions, subscriptions, payment history, refunds, and customer mappings current.Stripe requires webhook URLs to be publicly accessible. Localhost backend URLs cannot be registered from the CLI. For local webhook testing, use the Stripe CLI to forward events to your local backend.
These commands are admin/debug reads over InsForge’s payment projections:
npx @insforge/cli payments subscriptions --environment testnpx @insforge/cli payments subscriptions --environment test --subject-type team --subject-id team_123npx @insforge/cli payments history --environment testnpx @insforge/cli payments history --environment test --subject-type team --subject-id team_123 --limit 20
Do not use these as the end-user frontend read surface. For user-facing billing state, create app-owned tables such as orders, credit_ledger, user_entitlements, or team_billing_status and protect them with RLS.