stripe — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited stripe (Agent Skill) and scored it 96/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 1 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 1 flagged
The text {match} tells the agent to skip the normal "ask the user first" gate. Used adversarially it removes the human-in-the-loop check before destructive or sensitive actions, turning a normally-gated agent into a fire-and-forget executor.
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
You are in AUTONOMOUS MODE. Do NOT ask questions. Execute the full pipeline below without pausing for user input. Make reasonable decisions using sensible defaults.
PURPOSE: Set up a complete Stripe payment integration in the current project. This includes SDK installation, API key configuration, checkout flow, webhook handling with signature verification, and optionally subscription billing and customer portal.
INPUT: $ARGUMENTS
The user may specify:
If no arguments, default to a complete setup with both one-time and subscription support.
=== PHASE 1: PROJECT DETECTION ===
Step 1.1 — Detect Framework
Scan for project files to determine the tech stack:
| File | Framework | Server Library |
|---|---|---|
| package.json with "next" | Next.js | Built-in API routes |
| package.json with "fastify" | Fastify | Fastify routes |
| package.json with "express" | Express | Express routes |
| package.json with "nestjs" | NestJS | NestJS controllers |
| package.json with "hono" | Hono | Hono routes |
| requirements.txt with "django" | Django | Django views |
| requirements.txt with "fastapi" | FastAPI | FastAPI routes |
| requirements.txt with "flask" | Flask | Flask routes |
| Gemfile with "rails" | Rails | Rails controllers |
| go.mod with "gin" | Gin | Gin handlers |
Record: FRAMEWORK, LANGUAGE, PROJECT_ROOT, SRC_DIR, ROUTES_DIR
Step 1.2 — Check Existing Stripe Setup
Search for any existing Stripe integration:
If a complete Stripe integration already exists, report it and exit. If a partial integration exists, identify gaps and fill them.
=== PHASE 2: SDK INSTALLATION ===
Step 2.1 — Install Server-Side SDK
Based on the detected language:
npm install stripe (or yarn/pnpm based on lockfile)pip install stripe (add to requirements.txt)gem 'stripe' to Gemfilego get github.com/stripe/stripe-go/v80composer require stripe/stripe-phpStep 2.2 — Install Client-Side SDK (if applicable)
If the project has a frontend:
npm install @stripe/stripe-js @stripe/react-stripe-jsflutter_stripe to pubspec.yamlStep 2.3 — Configure Environment Variables
Add to .env.example (create if it does not exist):
# Stripe
STRIPE_SECRET_KEY=sk_test_...
STRIPE_PUBLISHABLE_KEY=pk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...If .env exists, add the same keys with placeholder values. If the project uses a config validation system (e.g., Zod env schema), update it.
=== PHASE 3: STRIPE CLIENT MODULE ===
Step 3.1 — Create Stripe Client Singleton
Create a Stripe client module at the appropriate location based on the framework:
lib/stripe.ts or src/lib/stripe.tssrc/config/stripe.ts or src/lib/stripe.tsapp/services/stripe_client.py or config/stripe.pyconfig/initializers/stripe.rbThe client module MUST:
Step 3.2 — Create Stripe Service Layer
Create a service module that encapsulates all Stripe operations:
Location: src/services/stripe.service.ts (adjust path for framework)
The service MUST include these methods:
createCheckoutSession(params):
- Accepts: priceId, customerId (optional), successUrl, cancelUrl, mode (payment | subscription)
- Creates a Stripe Checkout Session
- Returns the session URL and ID
createPaymentIntent(params):
- Accepts: amount, currency, customerId (optional), metadata
- Creates a Payment Intent for custom payment flows
- Returns the client secret
createCustomer(params):
- Accepts: email, name, metadata
- Creates a Stripe Customer
- Returns the customer object
getCustomerPortalSession(params):
- Accepts: customerId, returnUrl
- Creates a Billing Portal Session
- Returns the portal URL
constructWebhookEvent(payload, signature):
- Accepts: raw request body, Stripe-Signature header value
- Verifies the webhook signature using STRIPE_WEBHOOK_SECRET
- Returns the verified event object
- Throws on invalid signatureEvery method MUST:
=== PHASE 4: CHECKOUT FLOW ===
Step 4.1 — Create Checkout Endpoint
Create an API endpoint for initiating checkout:
Route: POST /api/payments/checkout (or framework equivalent)
The endpoint MUST:
Step 4.2 — Create Payment Intent Endpoint (for custom UI)
Route: POST /api/payments/create-intent
The endpoint MUST:
Step 4.3 — Create Success/Cancel Handlers
If the project has a frontend:
=== PHASE 5: WEBHOOK HANDLER ===
Step 5.1 — Create Webhook Endpoint
Route: POST /api/webhooks/stripe
This is the MOST CRITICAL part of the integration. The webhook MUST:
Framework-specific raw body handling:
Step 5.2 — Handle Core Webhook Events
Implement handlers for these events:
checkout.session.completed:
- Extract session data
- Link payment to user/order in your database
- Send confirmation email if email service exists
payment_intent.succeeded:
- Update payment status in database
- Fulfill the order
payment_intent.payment_failed:
- Update payment status
- Notify the user of failure
customer.subscription.created:
- Store subscription details in database
- Update user's plan/tier
customer.subscription.updated:
- Update stored subscription details
- Handle plan changes (upgrade/downgrade)
customer.subscription.deleted:
- Mark subscription as canceled in database
- Downgrade user's plan/tier
- Handle grace period if applicable
invoice.payment_succeeded:
- Record successful invoice payment
- Extend subscription access
invoice.payment_failed:
- Notify user of payment failure
- Begin dunning process (retry logic)Each handler should call a dedicated function — do NOT put business logic inline in the switch.
Step 5.3 — Webhook Idempotency
Every webhook handler MUST be idempotent:
=== PHASE 6: SUBSCRIPTION BILLING (if requested) ===
Skip this phase if the user only requested one-time payments.
Step 6.1 — Price Configuration
Create a prices/products configuration file:
// src/config/stripe-prices.ts
export const PRICES = {
FREE: { id: null, name: 'Free', features: [...] },
PRO: { id: 'price_xxx', name: 'Pro', features: [...] },
ENTERPRISE: { id: 'price_xxx', name: 'Enterprise', features: [...] },
} as const;Step 6.2 — Customer Portal Endpoint
Route: POST /api/payments/portal
The endpoint MUST:
Step 6.3 — Subscription Status Middleware
Create middleware or a helper function that:
=== PHASE 7: VERIFICATION ===
Step 7.1 — Static Verification
Run the project's type checker and linter:
tsc --noEmitmypy or pyright if configuredFix all errors introduced by the Stripe integration.
Step 7.2 — Integration Checklist
Verify and report:
=== OUTPUT ===
Print the following summary:
Framework: [detected framework] Payment types: [one-time | subscription | both]
| File | Purpose |
|---|---|
| [path] | [description] |
| Variable | Purpose | Where to get it |
|---|---|---|
| STRIPE_SECRET_KEY | Server-side API key | Stripe Dashboard > API Keys |
| STRIPE_PUBLISHABLE_KEY | Client-side API key | Stripe Dashboard > API Keys |
| STRIPE_WEBHOOK_SECRET | Webhook verification | Stripe Dashboard > Webhooks |
| Method | Path | Purpose |
|---|---|---|
| POST | /api/payments/checkout | Create checkout session |
| POST | /api/payments/create-intent | Create payment intent |
| POST | /api/payments/portal | Customer billing portal |
| POST | /api/webhooks/stripe | Stripe webhook handler |
[List of events with brief description]
sk_test_... and pk_test_... keys from Stripe Dashboardstripe listen --forward-to localhost:[PORT]/api/webhooks/stripe for local testingstripe trigger payment_intent.succeeded=== NEXT STEPS ===
After Stripe integration:
/auth-provider to add user authentication (needed to link payments to users)."/email to add transactional email for payment receipts and invoices."/analytics-tracking to track conversion funnels and payment events."/integrate audit to check overall integration health."=== DO NOT ===
and reference by ID, unless the user specifically requests programmatic product creation.
source of "signature verification failed" errors.
============================================================ SELF-HEALING VALIDATION (max 3 iterations) ============================================================
After completing the integration, validate:
IF STILL FAILING after 3 iterations:
============================================================ SELF-EVOLUTION TELEMETRY ============================================================
After producing output, record execution metadata for the /evolve pipeline.
Check if a project memory directory exists:
~/.claude/projects/skill-telemetry.md in that memory directoryEntry format:
### /stripe — {{YYYY-MM-DD}}
- Outcome: {{SUCCESS | PARTIAL | FAILED}}
- Self-healed: {{yes — what was healed | no}}
- Iterations used: {{N}} / {{N max}}
- Bottleneck: {{phase that struggled or "none"}}
- Suggestion: {{one-line improvement idea for /evolve, or "none"}}Only log if the memory directory exists. Skip silently if not found. Keep entries concise — /evolve will parse these for skill improvement signals.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.