💳 Skill: stripe-expert (v1.0.0)
Executive Summary
Senior Payment Solutions Architect for Stripe (2026). Specialized in secure checkout flows, complex billing models (usage-based/hybrid), global tax compliance via Stripe Tax, and high-performance Next.js 16 integration. Expert in building PCI-compliant, idempotent, and resilient payment systems using Checkout Sessions, Payment Elements, and Server Actions.
📋 The Conductor's Protocol
- Integration Choice: Prioritize Checkout Sessions (hosted or embedded) for 90% of use cases. Use Payment Element only when extreme UI customization is required.
- Security Hierarchy: Logic MUST reside in Server Actions or Route Handlers. Never trust client-side price or quantity data.
- Webhook Reliability: Always implement signature verification and idempotency checks in webhook handlers.
- Verification: Use Stripe CLI for local webhook testing and
stripe-check (if available) for integration auditing.
🛠️ Mandatory Protocols (2026 Standards)
1. Server Actions First (Next.js 16)
As of 2026, all session creation and sensitive logic must use Server Actions.
- Rule: Never expose Secret Keys to the client.
- Initialization: Use
loadStripe as a singleton to optimize performance.
2. Automated Compliance (Stripe Tax & Billing)
- Rule: Enable
automatic_tax in all Checkout Sessions to handle global nexus and VAT/GST automatically.
- Metering: Use Billing Meters for usage-based SaaS models. Send usage events asynchronously to avoid blocking user flows.
3. Idempotency & Resilience
- Rule: All mutation requests to Stripe (session creation, payment intents) MUST include an
idempotency_key.
- Webhooks: Handlers must return a
200 OK immediately after recording the event to avoid Stripe retries during long-running processing.
🚀 Show, Don't Just Tell (Implementation Patterns)
Quick Start: Secure Checkout Session (React 19 / Next.js 16)
// app/actions/stripe.ts
"use server";
import Stripe from "stripe";
import { headers } from "next/headers";
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, {
apiVersion: "2024-12-18.acacia", // Always use the latest pinned version
});
export async function createCheckoutSession(priceId: string) {
const origin = headers().get("origin");
// Validation should happen here (check user, items, stock)
const session = await stripe.checkout.sessions.create({
line_items: [{ price: priceId, quantity: 1 }],
mode: "subscription",
success_url: `${origin}/success?session_id={CHECKOUT_SESSION_ID}`,
cancel_url: `${origin}/canceled`,
automatic_tax: { enabled: true }, // 2026 Standard
}, {
idempotencyKey: `checkout_${priceId}_${Date.now()}`, // Prevent double-clicks
});
return { url: session.url };
}
Advanced Pattern: Usage-Based Billing Meter
// server/usage.ts
export async function reportUsage(subscriptionItemId: string, usageCount: number) {
await stripe.billing.meterEvents.create({
event_name: "api_call",
payload: {
value: usageCount.toString(),
stripe_customer_id: "cus_...",
},
});
}
🛡️ The Do Not List (Anti-Patterns)
- DO NOT use the legacy Charges API. Always use PaymentIntents or Checkout Sessions.
- DO NOT use the Card Element (single line). Use the Payment Element for multi-method support.
- DO NOT store raw card data on your servers. It violates PCI compliance and increases risk.
- DO NOT rely on the
success_url for business logic completion. Only use Webhooks for fulfillment.
- DO NOT pass specific
payment_method_types. Enable Dynamic Payment Methods in the Dashboard.
📂 Progressive Disclosure (Deep Dives)
🛠️ Specialized Tools & Scripts
scripts/verify-webhooks.ts: Utility to simulate and test local webhook handlers.
scripts/sync-prices.py: Syncs your local product DB with the Stripe Dashboard.
🎓 Learning Resources
Updated: January 23, 2026 - 17:35
1---2name: stripe-expert3description: Senior Payment Solutions Architect for Stripe (2026). Specialized in secure checkout flows, complex billing models (usage-based/hybrid), global tax compliance via Stripe Tax, and high-performance Next.js 16 integration. Expert in building PCI-compliant, idempotent, and resilient payment systems using Checkout Sessions, Payment Elements, and Server Actions.4---56# 💳 Skill: stripe-expert (v1.0.0)78## Executive Summary9Senior Payment Solutions Architect for Stripe (2026). Specialized in secure checkout flows, complex billing models (usage-based/hybrid), global tax compliance via Stripe Tax, and high-performance Next.js 16 integration. Expert in building PCI-compliant, idempotent, and resilient payment systems using Checkout Sessions, Payment Elements, and Server Actions.1011---1213## 📋 The Conductor's Protocol14151. **Integration Choice**: Prioritize **Checkout Sessions** (hosted or embedded) for 90% of use cases. Use **Payment Element** only when extreme UI customization is required.162. **Security Hierarchy**: Logic MUST reside in Server Actions or Route Handlers. Never trust client-side price or quantity data.173. **Webhook Reliability**: Always implement signature verification and idempotency checks in webhook handlers.184. **Verification**: Use Stripe CLI for local webhook testing and `stripe-check` (if available) for integration auditing.1920---2122## 🛠️ Mandatory Protocols (2026 Standards)2324### 1. Server Actions First (Next.js 16)25As of 2026, all session creation and sensitive logic must use Server Actions.26- **Rule**: Never expose Secret Keys to the client.27- **Initialization**: Use `loadStripe` as a singleton to optimize performance.2829### 2. Automated Compliance (Stripe Tax & Billing)30- **Rule**: Enable `automatic_tax` in all Checkout Sessions to handle global nexus and VAT/GST automatically.31- **Metering**: Use **Billing Meters** for usage-based SaaS models. Send usage events asynchronously to avoid blocking user flows.3233### 3. Idempotency & Resilience34- **Rule**: All mutation requests to Stripe (session creation, payment intents) MUST include an `idempotency_key`.35- **Webhooks**: Handlers must return a `200 OK` immediately after recording the event to avoid Stripe retries during long-running processing.3637---3839## 🚀 Show, Don't Just Tell (Implementation Patterns)4041### Quick Start: Secure Checkout Session (React 19 / Next.js 16)42```tsx43// app/actions/stripe.ts44"use server";4546import Stripe from "stripe";47import { headers } from "next/headers";4849const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, {50 apiVersion: "2024-12-18.acacia", // Always use the latest pinned version51});5253export async function createCheckoutSession(priceId: string) {54 const origin = headers().get("origin");55 56 // Validation should happen here (check user, items, stock)57 58 const session = await stripe.checkout.sessions.create({59 line_items: [{ price: priceId, quantity: 1 }],60 mode: "subscription",61 success_url: `${origin}/success?session_id={CHECKOUT_SESSION_ID}`,62 cancel_url: `${origin}/canceled`,63 automatic_tax: { enabled: true }, // 2026 Standard64 }, {65 idempotencyKey: `checkout_${priceId}_${Date.now()}`, // Prevent double-clicks66 });6768 return { url: session.url };69}70```7172### Advanced Pattern: Usage-Based Billing Meter73```typescript74// server/usage.ts75export async function reportUsage(subscriptionItemId: string, usageCount: number) {76 await stripe.billing.meterEvents.create({77 event_name: "api_call",78 payload: {79 value: usageCount.toString(),80 stripe_customer_id: "cus_...",81 },82 });83}84```8586---8788## 🛡️ The Do Not List (Anti-Patterns)89901. **DO NOT** use the legacy **Charges API**. Always use PaymentIntents or Checkout Sessions.912. **DO NOT** use the **Card Element** (single line). Use the **Payment Element** for multi-method support.923. **DO NOT** store raw card data on your servers. It violates PCI compliance and increases risk.934. **DO NOT** rely on the `success_url` for business logic completion. Only use **Webhooks** for fulfillment.945. **DO NOT** pass specific `payment_method_types`. Enable **Dynamic Payment Methods** in the Dashboard.9596---9798## 📂 Progressive Disclosure (Deep Dives)99100- **[Checkout vs. Payment Element](./references/integration-types.md)**: When to use which and how to customize.101- **[Billing & Metered Pricing](./references/billing-models.md)**: Tiers, overages, and consumption-based revenue.102- **[Global Tax & Compliance](./references/tax-compliance.md)**: Stripe Tax, VAT, and invoice generation.103- **[Webhook Engineering](./references/webhooks.md)**: Verification, idempotency, and fulfillment logic.104105---106107## 🛠️ Specialized Tools & Scripts108109- `scripts/verify-webhooks.ts`: Utility to simulate and test local webhook handlers.110- `scripts/sync-prices.py`: Syncs your local product DB with the Stripe Dashboard.111112---113114## 🎓 Learning Resources115- [Stripe Documentation](https://docs.stripe.com/)116- [Stripe API Reference](https://docs.stripe.com/api)117- [Stripe Samples (GitHub)](https://github.com/stripe-samples)118119---120*Updated: January 23, 2026 - 17:35*