Stripe Production Engineering
БесплатноБез исполняемых скриптовНе проверенComplete methodology for building, scaling, and operating production Stripe payment systems. From first checkout to enterprise billing at scale.
от modbender★ 21 звезда на GitHubОб этом скилле
Stripe Production Engineering
Complete methodology for building, scaling, and operating production Stripe payment systems. From first checkout to enterprise billing at scale.
Quick Health Check
Run through these 8 signals. Score 1 point each. Below 5 = stop and fix.
- ✅ Webhook endpoint verified and idempotent
- ✅ All API calls use idempotency keys
- ✅ Customer portal enabled for self-service
- ✅ Stripe Tax or manual tax collection configured
- ✅ Failed payment retry logic with dunning emails
- ✅ PCI compliance questionnaire completed (SAQ-A minimum)
- ✅ Test mode → live mode checklist completed
- ✅ Monitoring/alerting on payment failures and webhook errors
Score: /8 — Below 5? Fix gaps before adding features.
Phase 1: Architecture Strategy
Integration Pattern Decision
| Pattern | Best For | Complexity | PCI Scope |
|---|---|---|---|
| Stripe Checkout (hosted) | MVPs, quick launch | Low | SAQ-A (minimal) |
| Payment Element (embedded) | Custom UX, brand control | Medium | SAQ-A |
| Card Element (legacy) | Existing integrations | Medium | SAQ-A-EP |
| Direct API | Platform/marketplace | High | SAQ-D (avoid) |
Decision rule: Start with Checkout. Move to Payment Element only when you have specific UX requirements that Checkout can't solve.
Billing Model Selection
| Model | Stripe Product | Use When |
|---|---|---|
| One-time | Payment Links / Checkout | Single purchases, lifetime deals |
| Recurring flat | Subscriptions | Fixed monthly/annual SaaS |
| Usage-based | Metered billing | API calls, compute, storage |
| Per-seat | Subscriptions + quantity | Team/user-based pricing |
| Tiered | Tiered pricing | Volume discounts |
| Hybrid | Subscription + usage records | Base fee + overage |
Project Structure
src/
payments/
stripe.config.ts # Stripe client initialization
webhooks.handler.ts # Webhook endpoint + event routing
checkout.service.ts # Checkout session creation
subscription.service.ts # Subscription lifecycle
customer.service.ts # Customer CRUD + portal
invoice.service.ts # Invoice customization
tax.service.ts # Tax calculation
types.ts # Shared types
middleware/
webhook-verify.ts # Signature verification middleware
7 Architecture Rules
- Never trust the client — verify payment status server-side via webhooks, never from redirect URLs
- Webhooks are the source of truth — your database updates from webhook events, not API call responses
- Idempotency everywhere — every mutating API call gets an idempotency key
- One Stripe customer per user — create customer at signup, store
stripe_customer_idin your DB - Metadata is your friend — attach
user_id,plan,sourceto every object for debugging - Test mode mirrors live — your test environment should use the exact same code paths
- Never store card numbers — use Stripe.js/Elements, never handle raw card data
Phase 2: Core Integration Patterns
Stripe Client Setup
// stripe.config.ts
import Stripe from 'stripe';
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, {
apiVersion: '2024-12-18.acacia', // Pin API version!
maxNetworkRetries: 2,
timeout: 10_000,
telemetry: false,
});
export { stripe };
Rules:
- Pin API version — never use rolling latest
- Set explicit timeout (10s default is fine)
- Disable telemetry in production if privacy-sensitive
- Use restricted keys with minimum required permissions
Customer Lifecycle
// customer.service.ts
async function getOrCreateCustomer(userId: string, email: string, name?: string) {
// Check DB first
const existing = await db.users.findOne({ id: userId });
if (existing?.stripeCustomerId) {
return existing.stripeCustomerId;
}
// Create in Stripe
const customer = await stripe.customers.create({
email,
name,
metadata: {
user_id: userId,
created_via: 'signup',
},
});
// Store mapping
await db.users.update({ id: userId }, { stripeCustomerId: customer.id });
return customer.id;
}
Customer rules:
- Create at signup, not at first purchase
- Always set metadata.user_id for reverse lookups
- Store stripe_customer_id in your users table
- Use customer email updates to sync — listen for
customer.updated
Checkout Session (Recommended Starting Point)
// checkout.service.ts
async function createCheckoutSession(params: {
customerId: string;
priceId: string;
mode: 'payment' | 'subscription';
successUrl: string;
cancelUrl: string;
metadata?: Record<string, string>;
}) {
const session = await stripe.checkout.sessions.create({
customer: params.customerId,
Установить Stripe Production Engineering в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл Stripe Production Engineering?
Complete methodology for building, scaling, and operating production Stripe payment systems. From first checkout to enterprise billing at scale.
Как установить скилл Stripe Production Engineering?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Stripe Production Engineering запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic