stripe-integration
하는 일
이 스킬은 에이전트가 앱이나 웹사이트에 Stripe 결제를 추가하도록 안내합니다. 체크아웃, 구독, 웹훅을 다루며, 주문 누락과 키 유출을 피하는 단계를 포함합니다.
사용하는 경우
- ✓웹사이트나 앱에 체크아웃, 구독 또는 청구를 추가하고 싶을 때.
- ✓주문이 안정적으로 확인되도록 Stripe 웹훅을 설정해야 할 때.
- ✓기존 결제 코드에 실수나 보안 문제가 없는지 두 번째로 검토받고 싶은 경우.
스킬 링크
https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/stripe-integration/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“제 온라인 상점에 Stripe Checkout을 설정하고 웹훅으로 결제가 확인되도록 해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 Stripe의 최신 지침을 따르고, 사용자의 경우에 맞는 결제 방식을 고르며, 멱등성과 제한된 API 키 같은 점검을 적용합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 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
자주 묻는 질문
환불도 다루나요?
네. 설명에는 체크아웃, 구독, 고객 포털, Stripe Tax와 함께 환불이 포함되어 있습니다.
비밀 키는 어떻게 다루나요?
스킬은 키 노출을 경고하고 제한된 API 키를 권장합니다.
지침이 최신인가요?
스킬은 2026년 10월 기준 Stripe 지침을 따른다고 밝히며, 세부 사항이 중요할 때는 에이전트가 Stripe 문서를 확인하도록 합니다.
상세 정보
작성자의 원본 설명
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.
인기도
- GitHub 스타
- 33k
- 순위
- #8802
- 라이선스
- MIT
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
owasp-security
33k웹 앱, API, 모바일, 컨테이너, AI 에이전트를 위한 OWASP 보안 지침을 따르도록 해서, 흔한 약점을 찾고 수정안을 제안하게 합니다.
agent-management
33k에이전트가 AI Maestro 명령줄을 사용해 AI 에이전트를 만들고, 나열하고, 일시 정지하고, 깨우고, 이름을 바꾸고, 삭제하도록 돕습니다.
agent-messaging
33k에이전트가 Agent Messaging Protocol로 AI 에이전트 사이에 서명된 메시지를 보내고, 받고, 답하도록 돕습니다. 대부분 내 컴퓨터에서 작동합니다.
docs-search
33k에이전트가 자동 생성된 코드 문서에서 함수 시그니처, 클래스 정의, 주석을 검색하도록 해서, 코드를 바꾸기 전에 실제 API를 확인하게 합니다.
비슷한 스킬
api-connector-builder
280k에이전트가 기존 패턴을 따라 새로운 API 연결을 만들도록 합니다. 새로운 방식을 도입하지 않고 연동을 하나 더 추가할 때 씁니다.
api-design
280k에이전트가 모범 사례에 따라 REST API를 설계하도록 돕습니다. API가 통신하는 방식, 오류를 보여 주는 방식, 데이터를 정리하는 방식을 정하는 데 유용합니다.
backend-patterns
280k에이전트가 서버 쪽 아키텍처 패턴과 데이터베이스 최적화를 다루도록 돕습니다. 서버에서 실행되는 코드를 만들거나 검토할 때 유용합니다.