stripe-testing
БесплатноБез исполняемых скриптовНе проверенTest and debug Stripe payment integrations from the terminal with the Stripe CLI. Use when someone needs to verify webhook handling, simulate payment flows…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Stripe Testing
Overview
This skill helps you test and debug Stripe payment integrations end-to-end. It covers webhook forwarding and verification with stripe listen, event simulation with stripe trigger, charge failure diagnosis with test cards, and subscription lifecycle validation with test clocks.
The Stripe CLI sends requests to the sandbox by default. Only a command with --live touches live data, so test work never needs a live key.
Instructions
Setting Up the Test Environment
- Verify the CLI is installed:
stripe version - Authenticate once with
stripe login(opens a browser pairing flow), or export a test key for the session:export STRIPE_API_KEY=sk_test_....STRIPE_API_KEYoverrides the stored login. The--api-keyflag also works for a single command, but it leaves the key in shell history, so prefer the variable. - If no key is available, tell the user to create a restricted or secret test key in the Dashboard under Developers → API keys. Never ask for a live key.
- In a separate terminal, forward webhooks to the app:
stripe listen --forward-to http://localhost:3000/api/webhooks/stripe. The command prints awhsec_...signing secret. Put that value in the app's webhook secret environment variable (for exampleSTRIPE_WEBHOOK_SECRET). The secret stays the same across restarts ofstripe listen.
Debugging Failed Charges
- Ask for the payment intent ID or charge ID (starts with
pi_orch_). - Retrieve the object:
stripe payment_intents retrieve pi_.... Readlast_payment_error, which holdscode,decline_codeandmessage. - Reproduce the decline with a test card. The
decline_codevalues below are the ones Stripe's testing page lists:generic_decline(errorcard_declined) →4000000000000002insufficient_funds(errorcard_declined) →4000000000009995expired_card→4000000000000069incorrect_cvc→4000000000000127(any three-digit CVC)
- List recent events to see what Stripe sent:
stripe events list --limit=5.
Testing Webhook Handlers
- List registered endpoints:
stripe webhook_endpoints list. - Trigger a sample event while
stripe listenruns:stripe trigger payment_intent.succeeded. Each trigger creates real sandbox objects, and it can cause other events too (apayment_intent.succeededalso firespayment_intent.created).stripe trigger --helplists every supported event. - Confirm the local server returned 200 and changed the right records.
- Check that the handler verifies the signature with the Stripe SDK, for example
stripe.webhooks.constructEvent(rawBody, signature, endpointSecret)in Node. It must use the raw request body, not parsed JSON. - Resend a stored event to test idempotency with
stripe events resend(runstripe help events resendfor its flags). Run it twice and check that no duplicate rows appear. - Common events to test:
checkout.session.completedinvoice.payment_succeededinvoice.payment_failedcustomer.subscription.updatedcustomer.subscription.deleted
Validating Subscription Lifecycle with Test Clocks
Test clocks let you move a customer's billing time forward. The CLI has no dedicated test_clocks subcommand, so call the test-helper endpoints through stripe post, which takes the API path and -d form fields:
- Create a clock frozen at the current time:
stripe post /v1/test_helpers/test_clocks -d frozen_time=$(date +%s) - Create the customer on that clock, then subscribe the customer with a test payment method. The customer must be created with the clock ID set at creation time, so create the customer after the clock.
- Advance the clock to the next billing point:
Advancing returns immediately with statusstripe post /v1/test_helpers/test_clocks/clock_1Ab2Cd3EfGh4 -d frozen_time=1767225600advancing. Pollstripe get /v1/test_helpers/test_clocks/clock_1Ab2Cd3EfGh4until the status isready. Stripe rejects a target more than two billing intervals past the shortest subscription, and a clock that failed to advance stays ininternal_failure. - Check the subscription status after each step:
trialing→active→past_due→canceled, and confirm the matching webhooks arrived.
Reading Server-Side Logs
- Search the application logs for Stripe-related entries (
stripe,webhook,payment). - Check for HTTP 4xx/5xx responses to webhook deliveries. The Dashboard → Developers → Webhooks page shows delivery attempts and failures.
- Verify idempotency: a redelivered event must not create a second record.
Examples
Example 1: Debug a Failed Checkout
User prompt:
Our checkout is failing for some customers. The last failed payment intent is pi_3OxR2aKX8dVqS71m0abc1234. Can you figure out what's going wrong?
Agent actions:
stripe payment_intents retrieve pi_3OxR2aKX8dVqS71m0abc1234
Agent output:
Payment Inten
Установить stripe-testing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл stripe-testing?
Test and debug Stripe payment integrations from the terminal with the Stripe CLI. Use when someone needs to verify webhook handling, simulate payment flows, debug failed charges, validate subscription lifecycle with test clocks, or troubleshoot Stripe API errors. Trigger words: stripe, payment testing, webhook debugging, stripe listen, stripe trigger, charge failed, subscription error, payment intent, checkout session, test clock.
Как установить скилл stripe-testing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл stripe-testing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic