# 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. ## Install Copy the content below into your project: ## Quick Use 1. Get sk_test_... key from dashboard.stripe.com/test/apikeys 2. Use 4242 4242 4242 4242 for success, 4000 0000 0000 0002 for generic decline 3. Pair with `stripe listen` for webhook testing --- ## Intro Stripe test cards are special card numbers that work only in test mode (sk_test_... keys). Each number triggers a deterministic outcome — success, decline, 3D Secure challenge, insufficient funds, dispute, or chargeback — without moving real money. AI agents that handle payments need this reference to write integration tests, simulate failure modes, and seed demo accounts. Best for: agent QA, payment flow demos, integration test fixtures. Works with: any Stripe-connected agent (Stripe Agent Toolkit, custom tool calls). Setup time: zero — copy and paste. --- ### Success cards | Number | Brand | Use case | |---|---|---| | 4242 4242 4242 4242 | Visa | Default success | | 5555 5555 5555 4444 | Mastercard | Mastercard success | | 3782 822463 10005 | Amex | Amex success (15-digit) | | 6011 1111 1111 1117 | Discover | Discover success | | 4000 0566 5566 5556 | Visa (debit) | Debit success | CVC: any 3 digits (4 for Amex). Expiry: any future date. Postal: any. ### Decline cards (test failure flows) | Number | Decline reason | |---|---| | 4000 0000 0000 0002 | `card_declined` (generic) | | 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` | | 4000 0000 0000 0119 | `processing_error` | ### 3D Secure / SCA | Number | Behavior | |---|---| | 4000 0027 6000 3184 | Always requires authentication | | 4000 0025 0000 3155 | Authentication required if PaymentIntent SCA detected | | 4000 0082 6000 3178 | Authentication, then declines | ### Disputes / chargebacks | Number | Triggers | |---|---| | 4000 0000 0000 0259 | Successful payment, then disputed (`fraudulent`) | | 4000 0000 0000 1976 | Disputed (`product_not_received`) | | 4000 0000 0000 5423 | Disputed (`unrecognized`) | ### Programmatic seeding ```python import stripe stripe.api_key = "sk_test_..." # Seed 5 successful customers each with a default decline-on-charge card 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: Will these cards work in live mode?** A: No — they only work with sk_test_... keys. In live mode they decline as invalid card numbers. This is by design so test fixtures can never accidentally charge real customers. **Q: How do I test webhook delivery for declines?** A: Charge a decline card with a real PaymentIntent flow and Stripe will fire a `payment_intent.payment_failed` webhook. Use the Stripe CLI (`stripe listen --forward-to localhost:4242/webhook`) to receive events locally. **Q: Are these the same as the Connect test cards?** A: Mostly yes for the card itself, but Connect platform tests have additional test bank accounts and external accounts. See stripe.com/docs/connect/testing for the platform-specific test resources. --- ## Source & Thanks > Compiled from [Stripe Docs](https://docs.stripe.com/testing). Reference open and unrestricted. > > [stripe/stripe-docs](https://docs.stripe.com/testing) — official source --- ## 快速使用 1. 在 dashboard.stripe.com/test/apikeys 拿 sk_test_... key 2. 4242 4242 4242 4242 测成功,4000 0000 0000 0002 测通用拒付 3. 配 `stripe listen` 测 webhook --- ## 简介 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`)| ### 程序化灌种子 ```python 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](https://docs.stripe.com/testing). Reference open and unrestricted. > > [stripe/stripe-docs](https://docs.stripe.com/testing) — official source --- Source: https://tokrepo.com/en/workflows/stripe-test-cards-card-number-reference-for-ai-agents Author: Stripe