Knowledge2026年5月8日·1 分钟阅读

Stripe Test Cards — Card Number Reference for AI Agents

Stripe test card numbers covering success, decline, 3DS challenge, insufficient funds, expired, and disputed flows. Required for AI agent QA.

Agent 就绪

这个资产可以被 Agent 直接读取和安装

TokRepo 同时提供通用 CLI 命令、安装契约、metadata JSON、按适配器生成的安装计划和原始内容链接,方便 Agent 判断适配度、风险和下一步动作。

Native · 96/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Knowledge
安装
Single
信任
信任等级:New
入口
Asset
通用 CLI 安装命令
npx tokrepo install 4605bf87-8fee-4583-a28f-e00d98237ecc

简介

Stripe 测试卡是只在测试模式(sk_test_... key)有效的特殊卡号。每个卡号触发确定性结果 —— 成功、拒付、3D Secure 挑战、余额不足、争议、拒付 —— 都不动真钱。处理支付的 AI agent 需要这份参考来写集成测试、模拟失败模式、给 demo 账号灌种子数据。适合 agent QA、支付流程 demo、集成测试 fixture。兼容任何接 Stripe 的 agent(Stripe Agent Toolkit / 自定义 tool call)。装机时间 0 —— 复制粘贴即可。


成功卡

卡号 品牌 用途
4242 4242 4242 4242 Visa 默认成功
5555 5555 5555 4444 Mastercard 万事达成功
3782 822463 10005 Amex 美运通成功(15 位)
6011 1111 1111 1117 Discover Discover 成功
4000 0566 5566 5556 Visa 借记卡 借记成功

CVC:任意 3 位(Amex 4 位)。有效期:任意未来日期。邮编:任意。

拒付卡(测失败流程)

卡号 拒付原因
4000 0000 0000 0002 card_declined(通用)
4000 0000 0000 9995 insufficient_funds(余额不足)
4000 0000 0000 9987 lost_card(卡丢)
4000 0000 0000 9979 stolen_card(卡被盗)
4000 0000 0000 0069 expired_card(卡过期)
4000 0000 0000 0127 incorrect_cvc(CVC 错)
4000 0000 0000 0119 processing_error(处理错)

3D Secure / SCA

卡号 行为
4000 0027 6000 3184 始终需要认证
4000 0025 0000 3155 PaymentIntent 触发 SCA 时要认证
4000 0082 6000 3178 先认证再拒付

争议 / 拒付(chargeback)

卡号 触发
4000 0000 0000 0259 支付成功,随后被争议(fraudulent
4000 0000 0000 1976 被争议(product_not_received
4000 0000 0000 5423 被争议(unrecognized

程序化灌种子

import stripe
stripe.api_key = "sk_test_..."

# 灌 5 个成功客户,每个挂一张默认 charge 即拒付的卡
for i in range(5):
    cust = stripe.Customer.create(email=f"qa+decline-{i}@example.com")
    stripe.PaymentMethod.attach(
        stripe.PaymentMethod.create(
            type="card",
            card={"number": "4000000000000002", "exp_month": 12, "exp_year": 2030, "cvc": "123"},
        ).id,
        customer=cust.id,
    )

FAQ

Q: 这些卡在 live 模式能用吗? A: 不能 —— 只对 sk_test_... key 有效。Live 模式下会按无效卡号拒付。这是设计如此 —— 测试 fixture 永远不会误扣真实客户的钱。

Q: 怎么测拒付的 webhook 投递? A: 用真实 PaymentIntent 流程刷一笔拒付卡,Stripe 会触发 payment_intent.payment_failed webhook。用 Stripe CLI(stripe listen --forward-to localhost:4242/webhook)在本地收事件。

Q: 这些跟 Connect 测试卡一样吗? A: 卡本身大体一样,但 Connect 平台测试有额外的测试银行账户和外部账户。看 stripe.com/docs/connect/testing 拿平台专属测试资源。


🙏

来源与感谢

Compiled from Stripe Docs. Reference open and unrestricted.

stripe/stripe-docs — official source

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产