Setup stripe

From Melvynx/benchmarks · View interactive version

Setup stripe is an AI agent skill from the GitHub repository Melvynx/benchmarks. Strict NowStack Stripe setup: collect Stripe API keys, store secrets in Convex env, collect billing plans and prices, create Stripe products/prices, update billing code, verify

How to use this skill

Skill file

Setup Stripe - Strict NowStack Billing Setup

<objective>

Configure Stripe billing for a NowStack app in one strict order: verify the local Convex setup, collect Stripe API keys, write secrets to Convex env, collect the desired plans and prices, update the billing code, create products and recurring prices directly in the user's Stripe account from convex/billing/plans.ts, then validate.

</objective>

<strict_order>

This workflow MUST follow this order exactly. Do not reorder, merge, or skip steps unless the user explicitly asks to stop or skip the current step.

  1. Preflight: verify Convex config, required files, Stripe SDK availability, and current billing plan shape.
  2. API keys: collect STRIPE_SECRET_KEY, set it in Convex env, then run the existing webhook helper to create/update the Convex Stripe webhook and set STRIPE_WEBHOOK_SECRET.
  3. Plans and prices: ask for the full plan matrix in one structured response.
  4. Code update: update convex/billing/plans.ts and UI-only plan features in src/lib/auth/stripe/auth-plans.ts.
  5. Stripe creation: create or reuse Stripe Products and recurring Prices in the user's Stripe account from convex/billing/plans.ts, then write the resulting Price IDs into Convex env.
  6. Finish: validate, update CHANGELOG.md, clean temporary files, and summarize.

</strict_order>

<interaction_rules>

</interaction_rules>

<hard_execution_contract>

The agent MUST treat this workflow as a gated state machine, not loose guidance.

Before every step, write a compact state summary:

STRIPE STATE: step={current_step}; waiting_for={none|api_keys|plan_matrix}; completed={comma-separated completed gates}

Rules:

</hard_execution_contract>

<checklist_protocol>

The agent MUST use a temporary root checklist file to force strict ordering.

Checklist file:

</checklist_protocol>

<stop_gates>

These are mandatory stop points:

| Stop Gate | Step | Stop Until |

| --- | --- | --- |

| API keys requested | 1 | User provides STRIPE_SECRET_KEY=... or says to stop |

| Plan matrix requested | 2 | User provides complete plan data or explicitly asks for defaults |

| Stripe creation confirmation when mode is live | 3 | User confirms creating live Stripe objects |

</stop_gates>

<gate_matrix>

| Step | Required Before Starting | Required Before Advancing |

| --- | --- | --- |

| 0 | Skill loaded | Convex checked, billing files read, Stripe SDK available |

| 1 | Step 0 complete | STRIPE_SECRET_KEY set in Convex env, Convex webhook endpoint registered or blocker documented |

| 2 | Step 1 complete | Complete plan matrix received and normalized |

| 3 | Step 2 complete | Billing code updated and TypeScript validation run |

| 4 | Step 3 complete | Stripe Products/Prices created or reused from convex/billing/plans.ts, price env vars set in Convex |

| 5 | Step 4 complete | Changelog updated, cleanup attempted, final summary complete |

</gate_matrix>

<state_variables>

Persist these values across steps:

| Variable | Description |

| --- | --- |

| {stripe_mode} | test or live, detected from STRIPE_SECRET_KEY prefix or argument |

| {stripe_secret_key_set} | Whether STRIPE_SECRET_KEY was set in Convex env |

| {webhook_configured} | Whether Stripe points at the Convex /stripe/webhook endpoint and Convex has the signing secret |

| {plan_matrix} | The user-provided normalized plan data applied to Convex billing code |

| {stripe_price_envs} | Mapping of env var names to Stripe Price IDs created or reused |

| {code_files_updated} | Billing files updated in Step 4 |

| {validation_notes} | Passed/skipped/failed verification commands |

</state_variables>

<entry_point>

Load steps/step-00-preflight.md.

</entry_point>

<step_files>

| Strict Step | File | Purpose |

| --- | --- | --- |

| 0 | steps/step-00-preflight.md | Verify setup and initialize workflow state |

| 1 | steps/step-01-collect-keys.md | Collect Stripe API keys and write secrets to Convex env |

| 2 | steps/step-02-collect-plans.md | Collect the plan and price matrix |

| 3 | steps/step-03-update-code.md | Update billing plan code and UI plan features |

| 4 | steps/step-04-create-stripe.md | Create/reuse Stripe products and prices from code, then set Convex env price IDs |

| 5 | steps/step-05-finalize.md | Validate, update changelog, clean up, summarize |

</step_files>

<bundled_resources>

| File | Purpose |

| --- | --- |

| templates/SETUP_STRIPE_CHECKLIST.md | Runtime checklist template copied to project root during Step 0 and removed at the end |

| scripts/create-stripe-plans.mjs | Idempotently creates/reuses Stripe products/prices from convex/billing/plans.ts and can write price IDs to Convex env |

</bundled_resources>

<stack_context>

This app stores billing behavior in convex/billing.ts and convex/billingNode.ts. The UI auth plans in src/lib/auth/stripe/auth-plans.ts provide visible plan copy and metadata.

Stripe is handled by Convex:

</stack_context>

<important_files>

Files this workflow may modify:

| File | Change |

| --- | --- |

| convex/billing.ts | Billing actions and subscription/credit orchestration |

| convex/billingNode.ts | Stripe SDK calls and webhook processing |

| src/lib/auth/stripe/auth-plans.ts | UI-only features/icons and limit display labels when limits change |

| CHANGELOG.md | Required changelog entry |

| SETUP_STRIPE_CHECKLIST.md | Temporary runtime checklist, removed at the end |

Files this workflow reads:

</important_files>

<success_metrics>

</success_metrics>

<failure_modes>

</failure_modes>

NEXT STEP

Load steps/step-00-preflight.md.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.