Test and debug Stripe payment integrations. Use when someone needs to verify webhook handling, simulate payment flows, debug failed charges, validate subscription lifecycle, or troubleshoot Stripe API errors. Trigger words: stripe, payment testing, webhook debugging, charge failed, subscription error, payment intent, checkout session.
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.
stripe --versionSTRIPE_SECRET_KEY starting with sk_test_)stripe listen --forward-to localhost:<port>/webhooks/stripe to forward webhooks locallypi_ or ch_)stripe payment_intents retrieve <id> --api-key $STRIPE_SECRET_KEYlast_payment_error field for the decline reasoncard_declined → Use test card 4000000000000002 to reproduceinsufficient_funds → Test with 4000000000009995expired_card → Test with 4000000000000069incorrect_cvc → Test with 4000000000000127stripe events list --limit 5 --api-key $STRIPE_SECRET_KEYstripe webhook_endpoints list --api-key $STRIPE_SECRET_KEYstripe trigger <event_type> (e.g., stripe trigger payment_intent.succeeded)stripe.webhooks.constructEvent()checkout.session.completedinvoice.payment_succeededinvoice.payment_failedcustomer.subscription.updatedcustomer.subscription.deletedstripe customers create --name "Test User" --email test@example.com --api-key $STRIPE_SECRET_KEYstripe test_clocks create --frozen-time $(date +%s) --api-key $STRIPE_SECRET_KEY
stripe test_clocks advance <clock_id> --frozen-time <future_timestamp> --api-key $STRIPE_SECRET_KEY
trialing → active → past_due → canceledstripe, webhook, payment)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
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
sk_test_) — never use live keys for testing--api-key flag explicitly rather than relying on environment to avoid mistakesnpx skills add TerminalSkills/stripe-testing下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer