stripe-integration
Qué hace
Esta skill guía a tu agente para añadir pagos de Stripe a una app o a un sitio web. Cubre el pago, las suscripciones y los webhooks, con pasos para evitar pedidos perdidos y claves filtradas.
Cuándo usarla
- ✓Cuando quieres añadir un pago, una suscripción o facturación a tu sitio web o app.
- ✓Cuando necesitas configurar webhooks de Stripe para confirmar los pedidos de forma fiable.
- ✓Cuando quieres una segunda revisión del código de pagos existente, buscando errores o fallos de seguridad.
Link de la skill
https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/stripe-integration/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“Configura Stripe Checkout para mi tienda en línea y asegúrate de que los pagos se confirmen mediante webhook.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
El agente sigue la guía actual de Stripe, elige el método de pago adecuado para tu caso y aplica comprobaciones como la idempotencia y las claves de API restringidas.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de GitHub.
Stripe Integration
Guidance for building payment code that does not lose orders, double-charge or
leak keys. It follows Stripe's own recommendations as of October 2026. When a
detail matters (a parameter, an event name, an API version), check
docs.stripe.com or the Stripe MCP server's
search_stripe_documentation tool before relying on memory.
Versions
- Latest API version:
2026-09-30.endive. Pin it explicitly on the client so an account default change never alters response shapes under you. - Latest server SDKs: Node.js 23, Python 16, Ruby 20, PHP 22, Java 34, Go 87,
.NET 53. Create a client instance; the global key pattern
(
stripe.api_key = …,Stripe.setApiKey) is deprecated in every SDK. - To move an existing integration to a newer version, read Upgrading your API version first.
// lib/stripe.ts
import Stripe from 'stripe';
export const stripe = new Stripe(process.env.STRIPE_API_KEY!, {
apiVersion: '2026-09-30.endive',
});
Choose the API
| Building | Use |
|---|---|
| One-time payment, simple product | Payment Links (no code) or Checkout Sessions |
| One-time payment in your web app | Checkout Sessions (hosted or embedded) |
| Custom payment form | Checkout Sessions with ui_mode: 'custom' + Payment Element |
| Save a card for later | Setup Intents |
| Charge off-session (no customer present) | Payment Intents with a saved payment method |
| Subscriptions, seats, trials | Billing APIs + Checkout mode: 'subscription' + Customer Portal |
| New usage-based billing | Metronome (Stripe's usage platform), not raw Billing Meters |
| Marketplace or platform | Connect, Accounts v2 (/v2/core/accounts), Stripe-hosted onboarding |
Never use the Charges API, Sources API, Tokens API, Card Element or the
plan object. They are deprecated or legacy; use the rows above and Prices.
Rules
Fulfill from webhooks, never from the success page
A customer can pay and close the tab before the success page loads. Grant access, send email and write orders only in the webhook handler.
- Handle
checkout.session.completedandcheckout.session.async_payment_succeeded. Fulfill only whensession.payment_status !== 'unpaid'. Delayed methods (bank debits) sendcompletedwhile still unpaid. - Handle
checkout.session.async_payment_failedfor those failures. - Subscriptions need
customer.subscription.created|updated|deleted,invoice.paidandinvoice.payment_failed. Renewals, dunning and cancellations only reach you this way. - Webhooks are required before launch, not a follow-up.
Verify every webhook signature on the raw body
Signature verification needs the exact bytes Stripe sent. Body-parsing middleware breaks it.
// Next.js App Router: app/api/stripe/webhook/route.ts
import Stripe from 'stripe';
import { stripe } from '@/lib/stripe';
export async function POST(req: Request) {
const body = await req.text(); // raw body, do not use req.json()
const signature = req.headers.get('stripe-signature');
if (!signature) return new Response('missing signature', { status: 400 });
let event: Stripe.Event;
try {
event = stripe.webhooks.constructEvent(
body,
signature,
process.env.STRIPE_WEBHOOK_SECRET!,
);
} catch {
return new Response('invalid signature', { status: 400 });
}
switch (event.type) {
case 'checkout.session.completed':
case 'checkout.session.async_payment_succeeded': {
// Re-fetch instead of trusting the payload snapshot.
const session = await stripe.checkout.sessions.retrieve(event.data.object.id);
// fulfillOrder must be idempotent: the same event can arrive twice.
if (session.payment_status !== 'unpaid') await fulfillOrder(session.id);
break;
}
case 'checkout.session.async_payment_failed':
await markPaymentFailed(event.data.object.id);
break;
}
return new Response(null, { status: 200 });
}
- On Cloudflare Workers, Deno or Bun use
await stripe.webhooks.constructEventAsync(...). - In Express, mount
express.raw({ type: 'application/json' })on the webhook route only, before any globalexpress.json(). - In live mode Stripe retries for up to three days and can deliver an event more than once
or out of order. Make
fulfillOrderidempotent (store processed event or session IDs with a unique constraint) and decide by the object's current state, not by event order
Preguntas frecuentes
¿Cubre también los reembolsos?
Sí. La descripción incluye reembolsos, además del pago, las suscripciones, el portal del cliente y Stripe Tax.
¿Cómo maneja las claves secretas?
La skill advierte contra exponer las claves y recomienda usar claves de API restringidas.
¿Está la información actualizada?
La skill indica que sigue la guía de Stripe de octubre de 2026, y al agente se le pide revisar la documentación de Stripe cuando un detalle sea importante.
Detalles
Descripción original del autor
Build or review a Stripe integration with current Stripe guidance: Checkout Sessions, Payment Element, Setup Intents, subscriptions and the Customer Portal, webhook-driven fulfillment, idempotency, restricted API keys and Stripe Tax. Use when: stripe, payments, checkout, subscription, billing, webhook, refund, payment intent.
Popularidad
- Estrellas en GitHub
- 33 mil
- Posición en el ranking
- #8802
- Licencia
- MIT
- Actualizada
- 2/11/2026
Comentarios
- …
Más skills de este repositorio
owasp-security
33 milEnseña a tu agente la guía de seguridad OWASP para webs, APIs, móviles, contenedores y agentes de IA, para detectar debilidades comunes y sugerir correcciones.
agent-management
33 milPermite que tu agente cree, liste, hiberne, despierte, renombre y elimine agentes de IA con la CLI de AI Maestro, gestionando su ciclo de vida.
agent-messaging
33 milPermite que tu agente envíe, reciba y responda mensajes firmados entre agentes de IA con el Protocolo de Mensajería de Agentes, sobre todo en tu equipo.
docs-search
33 milBusca en la documentación generada del código las firmas de funciones, clases y comentarios, para revisar la API real antes de cambiar nada.
Skills parecidas
api-connector-builder
280 milHace que tu agente cree nuevas conexiones de API siguiendo el patrón existente. Úsalo para añadir una integración más sin inventar otra forma de hacer las cosas.
api-design
280 milAyuda a tu agente a diseñar APIs REST según las buenas prácticas. Es útil para definir cómo se comunican las APIs, cómo se muestran los errores y cómo organizar los datos.
backend-patterns
280 milAyuda a tu agente con patrones de arquitectura del lado del servidor y optimización de bases de datos. Es útil para crear o revisar código que se ejecuta en el servidor.