stripe-testing

用于测试和调试 Stripe 支付集成。适合验证 webhook 处理、模拟支付流程、调试失败扣款、验证订阅生命周期或排查 Stripe API 错误的场景。

仓库最近推送
GitHub Stars
219
Forks
38
Issues / PRs
7

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "stripe-testing":https://skillpi.com/zh/skills/deepskill-8033641abc1dcc0866edda6bbd8c78081a15b13be73a5db6257e21ca1cc85e53。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

用于测试和调试 Stripe 支付集成。适合验证 webhook 处理、模拟支付流程、调试失败扣款、验证订阅生命周期或排查 Stripe API 错误的场景。

0 下载

介绍来源: third_party · TerminalSkills · 1.0.0 参考来源

SkillPi 解读

实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: stripe-testing
description: >-
  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.
license: Apache-2.0
compatibility: "Requires Stripe CLI installed (brew install stripe/stripe-cli/stripe) and a Stripe test API key"
metadata:
  author: terminal-skills
  version: "1.0.0"
  category: development
  tags: ["stripe", "payments", "webhooks", "testing", "debugging"]

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

  1. Verify Stripe CLI is installed: stripe --version
  2. Check for a test API key in environment variables (STRIPE_SECRET_KEY starting with sk_test_)
  3. If no key is found, instruct the user to set one from the Stripe Dashboard → Developers → API keys
  4. Run stripe listen --forward-to localhost:<port>/webhooks/stripe to forward webhooks locally

Debugging Failed Charges

  1. Ask for the payment intent ID or charge ID (starts with pi_ or ch_)
  2. Retrieve details: stripe payment_intents retrieve <id> --api-key $STRIPE_SECRET_KEY
  3. Check the last_payment_error field for the decline reason
  4. Common decline codes and fixes:
    • card_declined → Use test card 4000000000000002 to reproduce
    • insufficient_funds → Test with 4000000000009995
    • expired_card → Test with 4000000000000069
    • incorrect_cvc → Test with 4000000000000127
  5. Check the Events tab: stripe events list --limit 5 --api-key $STRIPE_SECRET_KEY

Testing Webhook Handlers

  1. List registered webhook endpoints: stripe webhook_endpoints list --api-key $STRIPE_SECRET_KEY
  2. Trigger a specific event: stripe trigger <event_type> (e.g., stripe trigger payment_intent.succeeded)
  3. Verify the local server received and processed the event correctly
  4. Check webhook signature verification in the handler code — look for stripe.webhooks.constructEvent()
  5. Common webhook events to test:
    • checkout.session.completed
    • invoice.payment_succeeded
    • invoice.payment_failed
    • customer.subscription.updated
    • customer.subscription.deleted

Validating Subscription Lifecycle

  1. Create a test customer: stripe customers create --name "Test User" --email test@example.com --api-key $STRIPE_SECRET_KEY
  2. Create a subscription with a test clock for time simulation:
    stripe test_clocks create --frozen-time $(date +%s) --api-key $STRIPE_SECRET_KEY
  3. Advance the test clock to simulate billing cycles:
    stripe test_clocks advance <clock_id> --frozen-time <future_timestamp> --api-key $STRIPE_SECRET_KEY
  4. Verify subscription status transitions: trialing → active → past_due → canceled

Reading Server-Side Logs

  1. Search the application logs for Stripe-related entries (look for stripe, webhook, payment)
  2. Check for HTTP 4xx/5xx responses to Stripe webhook deliveries
  3. 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 (sk_test_) — never use live keys for testing
  • 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 --api-key flag explicitly rather than relying on environment to avoid mistakes

当前收录版本

1.0.0

核对来源版本 ↗

安全与评测信息

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值92/100

亮点

  • 针对 Stripe 支付集成的测试和调试,解决开发者高频刚需场景
  • 提供 webhook 验证、支付流程模拟、失败诊断等完整闭环能力
  • 覆盖订阅生命周期验证、测试时钟等高级功能
触发精准95/100

亮点

  • 触发词覆盖完整且边界清晰:stripe、支付测试、webhook 调试等
  • 不易与其他技能混淆,触发精准度高
结构规范93/100

待提升项

  • 缺少 When to Use 显式章节 原报告严重程度:轻微

    文档结构完整但缺少显式的 When to Use 章节

    改进建议:建议添加 When to Use 章节以进一步提升文档规范性

亮点

  • Phase/步骤清晰:环境设置、失败调试、webhook 测试、订阅验证等
  • 包含端到端示例,frontmatter 完整,单文件未超限
执行可靠91/100

亮点

  • 工具来源明确(Stripe CLI),参数正确
  • 覆盖主要异常场景,不可逆操作有确认机制
  • 提供完整的错误处理建议和最佳实践
证据可验 (前四项均值)93/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

  • 安装或获取外部依赖

    使用官方来源并锁定版本,在隔离环境检查安装脚本。当前文档检查不覆盖后续下载的代码。

    主文档提及 · 第 10 行
  • 账号、密钥或授权

    使用专用、最小权限账号,不把密钥粘贴到公开内容或命令日志;核对接收数据的服务与租户。

    主文档提及 · 第 10, 29, 36, 43, 47 行

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。