Skills stripe-testing
install
source · Clone the upstream repo
git clone https://github.com/TerminalSkills/skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/TerminalSkills/skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/stripe-testing" ~/.claude/skills/terminalskills-skills-stripe-testing && rm -rf "$T"
manifest:
skills/stripe-testing/SKILL.mdsafety · automated scan (low risk)
This is a pattern-based risk scan, not a security review. Our crawler flagged:
- references API keys
Always read a skill's source content before installing. Patterns alone don't mean the skill is malicious — but they warrant attention.
source content
Stripe Testing
Overview
This skill helps you test and debug Stripe payment integrations end-to-end. It covers webhook verification, payment flow simulation using Stripe CLI and test mode, charge failure diagnosis, and subscription lifecycle validation.
Instructions
Setting Up the Test Environment
- Verify Stripe CLI is installed:
stripe --version - Check for a test API key in environment variables (
starting withSTRIPE_SECRET_KEY
)sk_test_ - If no key is found, instruct the user to set one from the Stripe Dashboard → Developers → API keys
- Run
to forward webhooks locallystripe listen --forward-to localhost:<port>/webhooks/stripe
Debugging Failed Charges
- Ask for the payment intent ID or charge ID (starts with
orpi_
)ch_ - Retrieve details:
stripe payment_intents retrieve <id> --api-key $STRIPE_SECRET_KEY - Check the
field for the decline reasonlast_payment_error - Common decline codes and fixes:
→ Use test cardcard_declined
to reproduce4000000000000002
→ Test withinsufficient_funds4000000000009995
→ Test withexpired_card4000000000000069
→ Test withincorrect_cvc4000000000000127
- Check the Events tab:
stripe events list --limit 5 --api-key $STRIPE_SECRET_KEY
Testing Webhook Handlers
- List registered webhook endpoints:
stripe webhook_endpoints list --api-key $STRIPE_SECRET_KEY - Trigger a specific event:
(e.g.,stripe trigger <event_type>
)stripe trigger payment_intent.succeeded - Verify the local server received and processed the event correctly
- Check webhook signature verification in the handler code — look for
stripe.webhooks.constructEvent() - Common webhook events to test:
checkout.session.completedinvoice.payment_succeededinvoice.payment_failedcustomer.subscription.updatedcustomer.subscription.deleted
Validating Subscription Lifecycle
- Create a test customer:
stripe customers create --name "Test User" --email test@example.com --api-key $STRIPE_SECRET_KEY - Create a subscription with a test clock for time simulation:
stripe test_clocks create --frozen-time $(date +%s) --api-key $STRIPE_SECRET_KEY - Advance the test clock to simulate billing cycles:
stripe test_clocks advance <clock_id> --frozen-time <future_timestamp> --api-key $STRIPE_SECRET_KEY - Verify subscription status transitions:
→trialing
→active
→past_duecanceled
Reading Server-Side Logs
- Search the application logs for Stripe-related entries (look for
,stripe
,webhook
)payment - Check for HTTP 4xx/5xx responses to Stripe webhook deliveries
- Verify idempotency — duplicate webhook deliveries should not create duplicate records
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 --api-key $STRIPE_SECRET_KEY
Agent output:
Payment Intent pi_3OxR2aKX8dVqS71m0abc1234: Status: requires_payment_method Last error: card_declined (generic_decline) Amount: $49.00 USD Customer: cus_PqR7xYz Analysis: 1. The card was declined with a generic decline — this means the issuing bank refused it 2. This is NOT a code issue — the customer's bank rejected the charge 3. Your error handling looks correct — the PI moved to requires_payment_method Recommendations: - Ensure your frontend shows a clear "card declined" message - Offer alternative payment methods (Apple Pay, Google Pay, bank transfer) - Check if you have retry logic for `invoice.payment_failed` webhooks
Example 2: Verify Webhook Handler Works
User prompt:
I just deployed a new webhook handler for subscription cancellations. Can you test it?
Agent actions:
stripe listen --forward-to localhost:3000/api/webhooks/stripe & stripe trigger customer.subscription.deleted
Agent output:
Webhook forwarding active on localhost:3000/api/webhooks/stripe Triggered: customer.subscription.deleted → Delivered to localhost:3000/api/webhooks/stripe [200 OK] in 145ms Verified: ✓ Webhook received and acknowledged with 200 ✓ Signature verification passed (using whsec_ signing secret) ✓ Event type correctly matched to handler Next steps: - Check your database: was the subscription marked as canceled? - Verify the customer received a cancellation email - Test edge case: trigger it twice to confirm idempotency
Guidelines
- Always use test mode keys (
) — never use live keys for testingsk_test_ - Use Stripe's built-in test card numbers rather than real card data
- Test clocks are essential for subscription testing — they let you fast-forward time
- Always verify webhook signature validation is implemented correctly
- Check for race conditions: webhooks can arrive before the redirect completes
- Monitor the Stripe Dashboard → Developers → Webhooks for delivery failures
- Use
flag explicitly rather than relying on environment to avoid mistakes--api-key