agents-inc/skills/src/skills/api-commerce-stripe/SKILL.md
api-commerce-stripe
Stripe payment processing — Checkout Sessions, Payment Intents, subscriptions, webhooks, Connect, customer management, error handling
- Source repository stars
- 23
- Declared platforms
- 0
- Static risk flags
- 0
- Last source update
- 2026-08-09
- Source checked
- 2026-08-28
Decision brief
What it does: where it fits
Quick Guide: Use the stripe npm package for all server-side Stripe operations. Always verify webhook signatures with constructEvent() using the raw request body, never the parsed body. Use idempotency keys on all mutating requests. Keep the secret key server-side only. Handle er…
Not for
- Tasks that require unconfirmed production actions or broad system permissions.
- Environments where the pinned source and install steps cannot be inspected.
Compatibility matrix
Platform support, with evidence labels
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
Inspect first. Install second.
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/agents-inc/skills --skill "src/skills/api-commerce-stripe"Inspect the Agent Skill "api-commerce-stripe" from https://github.com/agents-inc/skills/blob/81d43a51211aca12c85dcc16085fa99014ec548e/src/skills/api-commerce-stripe/SKILL.md at commit 81d43a51211aca12c85dcc16085fa99014ec548e. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
What the source asks the agent to do
- 01
CRITICAL: Before Using This Skill
All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering, import type, named constants)
Creating Checkout Sessions for one-time or subscription paymentsBuilding custom payment flows with Payment IntentsHandling webhook events for asynchronous payment lifecycle - 02
Philosophy
Stripe is a payment infrastructure platform. The stripe npm package is the server-side SDK for interacting with the Stripe API. All payment processing happens server-side for security.
Server-side only — The secret key and all payment-creating operations must never run in the browser. Client-side uses Stripe.js (a separate concern) only for collecting payment details.Amounts in smallest unit — All monetary values are integers in the smallest currency unit (cents for USD, pence for GBP). 1000 means $10.00, not $1000.Idempotency for safety — Every mutating request should include an idempotency key to prevent duplicate charges on network retries. Stripe's SDK auto-generates keys for retries, but you should provide explicit keys for a… - 03
Core Patterns
Create a singleton Stripe client. Secret key from env, API version pinned. See examples/core.md for full setup.
Create a singleton Stripe client. Secret key from env, API version pinned. See examples/core.md for full setup.Never hardcode the secret key or omit apiVersion (behavior changes silently on Stripe API upgrades).Use mode: "payment" for one-time, mode: "subscription" for recurring. Stripe hosts the payment page. Always include {CHECKOUTSESSIONID} in the success URL (Stripe replaces this template automatically). See examples/core… - 04
Pattern 1: Stripe Client Initialization
Create a singleton Stripe client. Secret key from env, API version pinned. See examples/core.md for full setup.
Create a singleton Stripe client. Secret key from env, API version pinned. See examples/core.md for full setup.Never hardcode the secret key or omit apiVersion (behavior changes silently on Stripe API upgrades). - 05
Pattern 2: Checkout Sessions
Use mode: "payment" for one-time, mode: "subscription" for recurring. Stripe hosts the payment page. Always include {CHECKOUTSESSIONID} in the success URL (Stripe replaces this template automatically). See examples/core.md for full examples.
Use mode: "payment" for one-time, mode: "subscription" for recurring. Stripe hosts the payment page. Always include {CHECKOUTSESSIONID} in the success URL (Stripe replaces this template automatically). See examples/core…
Permission review
Static risk signals and limitations
No configured static risk pattern was detected
This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.
Evidence record
Why each signal appears
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 92/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 23 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Provenance and original SKILL.md
- Repository
- agents-inc/skills
- Skill path
- src/skills/api-commerce-stripe/SKILL.md
- Commit
- 81d43a51211aca12c85dcc16085fa99014ec548e
- License
- MIT
- Collected
- 2026-08-28
- Default branch
- main
View the original SKILL.md
Stripe Patterns
Quick Guide: Use the
stripenpm package for all server-side Stripe operations. Always verify webhook signatures withconstructEvent()using the raw request body, never the parsed body. Use idempotency keys on all mutating requests. Keep the secret key server-side only. Handle errors withinstanceof Stripe.errors.StripeError. Amounts are always in the smallest currency unit (e.g., cents for USD).
<critical_requirements>
CRITICAL: Before Using This Skill
All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering,
import type, named constants)
(You MUST NEVER expose STRIPE_SECRET_KEY in client-side code — it stays on the server only)
(You MUST verify webhook signatures with stripe.webhooks.constructEvent() using the RAW request body — never parsed JSON)
(You MUST use idempotency keys on all mutating (POST) requests to prevent duplicate charges)
(You MUST handle all Stripe errors with instanceof Stripe.errors.StripeError — never swallow payment errors)
(You MUST express monetary amounts in the smallest currency unit — cents for USD, not dollars)
</critical_requirements>
Auto-detection: Stripe, stripe, stripe.checkout.sessions, stripe.paymentIntents, stripe.customers, stripe.subscriptions, stripe.webhooks, constructEvent, PaymentIntent, CheckoutSession, STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET, stripe.prices, stripe.products, stripe.refunds, stripe.transfers, stripe.accounts, Stripe.errors, idempotencyKey, payment_intent.succeeded, checkout.session.completed
When to use:
- Creating Checkout Sessions for one-time or subscription payments
- Building custom payment flows with Payment Intents
- Handling webhook events for asynchronous payment lifecycle
- Managing customers, payment methods, and subscriptions
- Building marketplace platforms with Stripe Connect
- Processing refunds and handling disputes
- Setting up products and prices for a catalog
Key patterns covered:
- Stripe client initialization with TypeScript types
- Checkout Sessions (one-time payments, subscriptions, setup mode)
- Payment Intents (custom flows, confirmation, capture)
- Webhook signature verification and event handling
- Customer creation, update, and payment method attachment
- Subscription lifecycle (create, update, cancel, trials, proration)
- Products and Prices (catalog management)
- Stripe Connect (account creation, transfers, destination charges)
- Error handling with typed Stripe errors
- Idempotency keys for safe retries
When NOT to use:
- Client-side Stripe.js or Stripe Elements (use your frontend framework skill)
- Stripe CLI commands or dashboard configuration
- Non-Stripe payment processors (use their dedicated skill)
Detailed Resources:
- For decision frameworks and anti-patterns, see reference.md
Core Setup & Payments:
- examples/core.md — Client setup, Checkout Sessions, Payment Intents, error handling
Webhooks & Events:
- examples/webhooks.md — Signature verification, event handling, idempotent processing
Subscriptions & Billing:
- examples/subscriptions.md — Subscription lifecycle, trials, proration, metered billing
Connect & Platforms:
- examples/connect.md — Connected accounts, transfers, destination charges, platform fees
Philosophy
Stripe is a payment infrastructure platform. The stripe npm package is the server-side SDK for interacting with the Stripe API. All payment processing happens server-side for security.
Core principles:
- Server-side only — The secret key and all payment-creating operations must never run in the browser. Client-side uses Stripe.js (a separate concern) only for collecting payment details.
- Amounts in smallest unit — All monetary values are integers in the smallest currency unit (cents for USD, pence for GBP).
1000means $10.00, not $1000. - Idempotency for safety — Every mutating request should include an idempotency key to prevent duplicate charges on network retries. Stripe's SDK auto-generates keys for retries, but you should provide explicit keys for application-level retries.
- Webhooks are the source of truth — Payment status should be confirmed via webhooks, not by polling. Webhook events are the only reliable indicator that a payment succeeded, failed, or requires action.
- Error as typed exceptions — Stripe errors are thrown (not returned as values). Catch with
instanceof Stripe.errors.StripeErrorand handle by type for appropriate user responses. - API versioning matters — Pin your API version. Types reflect the latest API version. Use
apiVersionin the constructor to lock behavior.
When to use Stripe:
- Accepting payments (one-time, recurring, marketplace splits)
- Building subscription billing systems
- Platform/marketplace payment splitting with Connect
- Saving payment methods for future charges
When NOT to use:
- Client-side payment form rendering (Stripe.js / Elements is a separate domain)
- Payment processing without a server (Stripe requires server-side secret key)
- Simple donation buttons (Stripe Payment Links may suffice without code)
Core Patterns
Pattern 1: Stripe Client Initialization
Create a singleton Stripe client. Secret key from env, API version pinned. See examples/core.md for full setup.
export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, {
apiVersion: "2026-02-25.clover",
});
Never hardcode the secret key or omit apiVersion (behavior changes silently on Stripe API upgrades).
Pattern 2: Checkout Sessions
Use mode: "payment" for one-time, mode: "subscription" for recurring. Stripe hosts the payment page. Always include {CHECKOUT_SESSION_ID} in the success URL (Stripe replaces this template automatically). See examples/core.md for full examples.
const session = await stripe.checkout.sessions.create({
mode: "payment", // or "subscription" or "setup"
line_items: [{ price: priceId, quantity }],
success_url: `${process.env.APP_URL}/success?session_id={CHECKOUT_SESSION_ID}`,
cancel_url: `${process.env.APP_URL}/cancel`,
});
Pattern 3: Payment Intents (Custom Flows)
Use Payment Intents when you need full control over the payment UI (e.g., Stripe Elements). Always use automatic_payment_methods (not the legacy payment_method_types array) and include an idempotency key. See examples/core.md for full examples.
const paymentIntent = await stripe.paymentIntents.create(
{
amount: amountInCents,
currency,
automatic_payment_methods: { enabled: true },
},
{ idempotencyKey: `pi_${orderId}` },
);
return { clientSecret: paymentIntent.client_secret };
Name parameters amountInCents to avoid dollar/cent confusion. Return client_secret to the frontend.
Pattern 4: Customer Management
Create customers with idempotency keys (based on email to prevent duplicates). Attach payment methods in two steps: attach, then set as default via invoice_settings.default_payment_method. See examples/core.md for full examples.
Pattern 5: Products and Prices
Products and prices are separate resources in Stripe's data model. Add recurring: { interval } only for subscription prices. Name the amount parameter amountInCents. See examples/core.md for full examples.
Pattern 6: Refunds
Omit amount for a full refund. Use payment_intent (preferred over charge). Always include an idempotency key unique to the refund amount. See examples/core.md for full examples.
Pattern 7: Error Handling
Catch errors with instanceof Stripe.errors.StripeCardError (and other error subclasses). StripeCardError returns user-safe messages with decline_code. StripeInvalidRequestError is a developer bug. StripeConnectionError and StripeRateLimitError are retry-able. See examples/core.md for the complete error handling pattern.
if (error instanceof Stripe.errors.StripeCardError) {
return { success: false, message: error.message, code: error.code };
}
<red_flags>
RED FLAGS
High Priority Issues:
- Secret key in client-side code —
STRIPE_SECRET_KEYmust never appear in browser bundles. UseSTRIPE_PUBLISHABLE_KEY(starts withpk_) for client-side Stripe.js only. - Webhook signature not verified — Without
constructEvent()verification, attackers can send fake events to fulfill orders, grant access, or modify records. - Raw body not used for webhooks — Using
req.body(parsed JSON) instead of the raw body string/buffer causes signature verification to fail silently. With Express, useexpress.raw({ type: "application/json" })on the webhook route. - Missing idempotency keys — Without idempotency keys, network retries can create duplicate charges. Always pass
{ idempotencyKey }on create/update operations. - Dollar amounts instead of cents —
amount: 10creates a $0.10 charge, not $10.00. Always multiply by 100 or name variablesamountInCents.
Medium Priority Issues:
- Not pinning API version — Without
apiVersionin the constructor, Stripe uses your account's default version. API changes can silently break your integration. - Using
payment_method_typesinstead ofautomatic_payment_methods— The legacy array approach requires manual updates as new payment methods become available.automatic_payment_methods: { enabled: true }is the modern approach. - Swallowing Stripe errors — Empty
catchblocks hide payment failures. Always log the error'srequestIdfor debugging with Stripe support. - Not handling
requires_actionstatus — Payment Intents may require 3D Secure authentication. CheckpaymentIntent.statusafter confirmation. - Polling instead of webhooks — Checking payment status in a loop is unreliable and wastes API calls. Use webhooks for all asynchronous payment events.
Common Mistakes:
- Processing webhooks synchronously — Long-running operations in the webhook handler cause timeouts. Return
200immediately, then process asynchronously. - Not handling duplicate webhook events — Stripe may deliver the same event multiple times. Track processed event IDs to ensure idempotent handling.
- Using test keys in production — Keys starting with
sk_test_andpk_test_only work with test data. Verify your environment configuration. - Forgetting
expandfor nested objects — Stripe returns IDs by default for related objects. Useexpand: ["latest_invoice.payment_intent"]to get full objects.
Gotchas & Edge Cases:
- Stripe events are not ordered —
invoice.paidmay arrive beforeinvoice.created. Design handlers to be order-independent. - Checkout Session
{CHECKOUT_SESSION_ID}is a literal template — Stripe replaces this placeholder in thesuccess_url. Do not URL-encode it. - Subscription proration is on by default — Upgrading a plan mid-cycle prorates automatically. Pass
proration_behavior: "none"to disable. - Idempotency keys expire after 24 hours — After expiry, the same key creates a new request. For long-lived retries, generate a new key.
- Zero-decimal currencies — JPY, KRW, and others have no decimal subunit.
amount: 500in JPY means 500 yen, not 5 yen. CheckStripe.ZERO_DECIMAL_CURRENCIES. - Connect transfers require
transferscapability — Connected accounts must havecard_paymentsandtransferscapabilities enabled before receiving transfers. - Webhook secrets differ per endpoint — Each webhook endpoint has its own signing secret. Using the wrong secret causes all signature verifications to fail.
</red_flags>
<critical_reminders>
CRITICAL REMINDERS
All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering,
import type, named constants)
(You MUST NEVER expose STRIPE_SECRET_KEY in client-side code — it stays on the server only)
(You MUST verify webhook signatures with stripe.webhooks.constructEvent() using the RAW request body — never parsed JSON)
(You MUST use idempotency keys on all mutating (POST) requests to prevent duplicate charges)
(You MUST handle all Stripe errors with instanceof Stripe.errors.StripeError — never swallow payment errors)
(You MUST express monetary amounts in the smallest currency unit — cents for USD, not dollars)
Failure to follow these rules will create security vulnerabilities, duplicate charges, and silent payment failures.
</critical_reminders>
Frequently asked questions
What to verify before installation and use
What does the api-commerce-stripe source document cover?
Quick Guide: Use the stripe npm package for all server-side Stripe operations. Always verify webhook signatures with constructEvent() using the raw request body, never the parsed body. Use idempotency keys on all mutating requests. Keep the secret key server-side only. Handle er…
How do I install api-commerce-stripe?
The source record exposes this install command: npx skills add https://github.com/agents-inc/skills --skill "src/skills/api-commerce-stripe". Inspect the command and pinned source before running it.
Alternatives
Compare before choosing
coreyhaines31/marketingskills
ab-testing
When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "should I test this," "which version is better," "test two versions," "statistical significance," "how long should I run this test," "growth experiments," "experiment velocity," "experiment backlog," "ICE score," "experimentation program
garrytan/gbrain
bulk-ingestion
End-to-end discipline for turning any large data source (audio libraries, email takeouts, document corpora, chat exports, API dumps) into brain pages at scale. The lifecycle spine: SCHEMA → ACCESS → TRIAL → EVALUATE → IMPROVE → CODIFY → TEST → SKILLIFY → BULK → MONITOR. State is tracked in a durable JSON manifest (see MANIFEST-PATTERN.md) so any crash, session boundary, or subagent fan-out resumes from ground truth instead of memory.
alirezarezvani/claude-skills
app-store-optimization
App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklist
dotnet/skills
migrate-vstest-to-mtp
Migrates .NET test projects from VSTest to Microsoft.Testing.Platform (MTP). Use when user asks to "migrate to MTP", "switch from VSTest", "enable Microsoft.Testing.Platform", "use MTP runner", set OutputType=Exe only for test projects in Directory.Build.props, or mentions EnableMSTestRunner, EnableNUnitRunner, or UseMicrosoftTestingPlatformRunner. USE FOR: MTP behavioral differences vs VSTest (exit code 8, zero tests discovered, --ignore-exit-code, TESTINGPLATFORM_EXITCODE_IGNORE); centralizing