# 测试 模拟付款,测试您的集成。 通过使用测试值模拟交易,在 *沙盒* (A sandbox is an isolated test environment that allows you to test Stripe functionality in your account without affecting your live integration. Use sandboxes to safely experiment with new features and changes) 中测试您的集成——这些交易不会转移资金。 您可以使用[管理平台](https://dashboard.stripe.com/sandboxes)中的账户选择器访问您的沙盒。 测试卡充当“虚拟”信用卡,可以模拟以下情境: - 按[银行卡品牌](https://docs.stripe.com/testing.md#cards)或[国家](https://docs.stripe.com/testing.md#international-cards)排序的成功支付 - 由于[拒付](https://docs.stripe.com/testing.md#declined-payments)、[欺诈](https://docs.stripe.com/testing.md#fraud-prevention)或[无效数据](https://docs.stripe.com/testing.md#invalid-data)而导致银行卡出错 - [争议](https://docs.stripe.com/testing.md#disputes)和[退款](https://docs.stripe.com/testing.md#refunds) - 使用[3DS 验证](https://docs.stripe.com/testing.md#regulatory-cards)和[PIN 码](https://docs.stripe.com/testing.md#terminal)进行验证 您还可以在沙盒中测试非银行卡支付。非银行卡支付是指除信用卡或借记卡之外的其他支付方式。Stripe 支持各种非银行卡支付方式,如数字钱包和银行转账。[每种支付方式](https://docs.stripe.com/testing.md#non-card-payments)都有其特殊值。 不要使用测试环境对集成进行负载测试,因为可能遇到[速率限制](https://docs.stripe.com/testing.md#rate-limits)。要对集成应用进行负载测试,请参阅[负载测试](https://docs.stripe.com/rate-limits.md#load-testing)。 ## 如何使用测试卡 在使用测试银行卡时,请在所有 API 调用中使用[测试 API 密钥](https://docs.stripe.com/keys.md#obtain-api-keys)。无论您是提供支付表单进行交互式测试,还是编写测试代码,都应如此。 > #### 不要使用真实的卡信息 > > 不要使用真实的银行卡信息。[Stripe 服务协议](https://stripe.com/legal/ssa#1-your-stripe-account)禁止在真实模式下使用真实的支付方式信息进行测试。请使用您的测试 API 密钥和以下卡号。 ### 交互测试 交互式测试时,请使用银行卡号,如[4242 4242 4242 4242](https://docs.stripe.com/testing.md?testing-method=card-numbers#visa)。在管理平台或任何支付表单中输入该卡号。 - 使用有效的未来日期,例如 **12/34**。 - 使用任意三位数 CVC(American Express 卡为四位)。 - 其他表单字段可以使用任意值。 ### 测试代码 编写测试代码时,请使用`PaymentMethod`,如[pm_card_visa](https://docs.stripe.com/testing.md?testing-method=payment-methods#visa),而不要使用银行卡号。我们不建议在 API 调用或服务器端代码中直接使用银行卡号,即使在测试环境中也是如此。如果使用了,上线时代码可能不符合 PCI 标准。默认情况下,`PaymentMethod`不会绑定到 *客户* (Customer objects represent customers of your business. They let you reuse payment methods and give you the ability to track multiple payments)。 ```php // Don't put any keys in code. See https://docs.stripe.com/keys-best-practices. // Find your keys at https://dashboard.stripe.com/apikeys. $stripe = new \Stripe\StripeClient('<>'); $paymentIntent = $stripe->paymentIntents->create([ 'amount' => 500, 'currency' => 'gbp', 'payment_method' => 'pm_card_visa', 'payment_method_types' => ['card'], ]); ``` 当您准备将集成上线时,请将您的测试可发布密钥和机密[ API 密钥](https://docs.stripe.com/keys.md)替换为真实模式密钥。如果您的集成仍在测试模式,将无法处理真实交易。请将真实模式机密密钥存储在机密保管库或环境变量中,切勿将密钥存放在源代码或已纳入版本控制的配置文件中。要了解如何安全使用真实模式密钥,请参阅[管理机密 API 密钥的最佳实践](https://docs.stripe.com/keys-best-practices.md)。 ## 按银行卡品牌模拟支付 要模拟特定银行卡品牌的成功付款,请使用以下列表中的测试卡。 跨境费用基于银行卡发卡行所在国家/地区进行评估。发卡行所在国不是美国的银行卡(如 JCB 和银联)可能需要支付跨境费用,即使在测试环境中也是如此。 #### 卡号 | 品牌 | 尾号 | CVC | 日期 | | ------------------- | ------------------- | ------- | ------- | | Visa | 4242424242424242 | 任意 3 位数 | 任意未来的日期 | | Visa(借记卡) | 4000056655665556 | 任意 3 位数 | 任意未来的日期 | | Mastercard | 5555555555554444 | 任意 3 位数 | 任意未来的日期 | | Mastercard(以 2 开头) | 2223003122003222 | 任意 3 位数 | 任意未来的日期 | | Mastercard(借记卡) | 5200828282828210 | 任意 3 位数 | 任意未来的日期 | | Mastercard(预付卡) | 5105105105105100 | 任意 3 位数 | 任意未来的日期 | | American Express | 378282246310005 | 任意 4 位数 | 任意未来的日期 | | American Express | 371449635398431 | 任意 4 位数 | 任意未来的日期 | | Discover | 6011111111111117 | 任意 3 位数 | 任意未来的日期 | | Discover | 6011000990139424 | 任意 3 位数 | 任意未来的日期 | | Discover(借记卡) | 6011981111111113 | 任意 3 位数 | 任意未来的日期 | | Diners Club | 3056930009020004 | 任意 3 位数 | 任意未来的日期 | | Diners Club(14 位卡号) | 36227206271667 | 任意 3 位数 | 任意未来的日期 | | BCcard 和 DinaCard | 6555900000604105 | 任意 3 位数 | 任意未来的日期 | | JCB | 3566002020360505 | 任意 3 位数 | 任意未来的日期 | | 银联 | 6200000000000005 | 任意 3 位数 | 任意未来的日期 | | 银联(借记卡) | 6200000000000047 | 任意 3 位数 | 任意未来的日期 | | 银联(19 位卡号) | 6205500000000000004 | 任意 3 位数 | 任意未来的日期 | #### PaymentMethods | 品牌 | PaymentMethod | | ---------------- | ---------------------------- | | Visa | `pm_card_visa` | | Visa(借记卡) | `pm_card_visa_debit` | | Mastercard | `pm_card_mastercard` | | Mastercard(借记卡) | `pm_card_mastercard_debit` | | Mastercard(预付卡) | `pm_card_mastercard_prepaid` | | American Express | `pm_card_amex` | | Discover | `pm_card_discover` | | Diners Club | `pm_card_diners` | | JCB | `pm_card_jcb` | | 银联 | `pm_card_unionpay` | #### 令牌 大多数集成已不再使用令牌,但如果您需要,我们仍提供测试令牌,如 [tok_visa](https://docs.stripe.com/testing.md?testing-method=tokens#visa)。 | 品牌 | 令牌 | | ---------------- | ------------------------ | | Visa | `tok_visa` | | Visa(借记卡) | `tok_visa_debit` | | Mastercard | `tok_mastercard` | | Mastercard(借记卡) | `tok_mastercard_debit` | | Mastercard(预付卡) | `tok_mastercard_prepaid` | | American Express | `tok_amex` | | Discover | `tok_discover` | | Diners Club | `tok_diners` | | JCB | `tok_jcb` | | 银联 | `tok_unionpay` | 多数 Cartes Bancaires 和销售点电子转账卡是与 Visa 或 Mastercard 联名的。下表中的测试卡模拟的是使用联名卡成功付款的情形。 #### 卡号 | 品牌/联名品牌 | 尾号 | CVC | 日期 | | --------------------------- | ---------------- | ------- | ------- | | Cartes Bancaires/Visa | 4000002500001001 | 任意 3 位数 | 任意未来的日期 | | Cartes Bancaires/Mastercard | 5555552500001001 | 任意 3 位数 | 任意未来的日期 | | 澳大利亚销售点电子转账 / Visa | 4000050360000001 | 任意 3 位数 | 任意未来的日期 | | 澳大利亚销售点电子转账 / Mastercard | 5555050360000080 | 任意 3 位数 | 任意未来的日期 | #### PaymentMethods | 品牌 | PaymentMethod | | --------------------------- | -------------------------------------------- | | Cartes Bancaires/Visa | `pm_card_visa_cartesBancaires` | | Cartes Bancaires/Mastercard | `pm_card_mastercard_cartesBancaires` | | 澳大利亚销售点电子转账 / Visa | `pm_card_visa_debit_eftposAuCoBranded` | | 澳大利亚销售点电子转账 / Mastercard | `pm_card_mastercard_debit_eftposAuCoBranded` | #### 令牌 大多数集成已不再使用令牌,但如果您需要,我们仍提供测试令牌,如 [tok_visa](https://docs.stripe.com/testing.md?testing-method=tokens#visa)。 | 品牌 | 令牌 | | --------------------------- | ---------------------------------------- | | Cartes Bancaires/Visa | `tok_visa_cartesBancaires` | | Cartes Bancaires/Mastercard | `tok_mastercard_cartesBancaires` | | 澳大利亚销售点电子转账 / Visa | `tok_visa_debit_eftposAuCoBranded` | | 澳大利亚销售点电子转账 / Mastercard | `tok_mastercard_debit_eftposAuCoBranded` | ## 按国家/地区模拟支付 要模拟特定国家的成功付款,使用以下部分的测试卡。 > *强客户认证* (Strong Customer Authentication (SCA) is a regulatory requirement in effect as of September 14, 2019, that impacts many European online payments. It requires customers to use two-factor authentication like 3D Secure to verify their purchase)规范要求在*欧洲经济区* (The European Economic Area is a regional single market with free movement of labor, goods, and capital. It encompasses the European Union member states and three additional states that are part of the European Free Trade Association)内进行线上付款时必须通过 *3DS 验证* (3D Secure (3DS) provides an additional layer of authentication for credit card transactions that protects businesses from liability for fraudulent card payments)。欧洲和中东部分的测试卡模拟了在未进行验证的情况下付款成功的情况。我们还建议使用 [3DS 验证测试卡](https://docs.stripe.com/testing.md#regulatory-cards)测试身份验证情境。 #### 卡号 | 国家/地区 | 尾号 | 品牌 | | ------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- | ---------- | | **美洲** | | 美国(US) | 4242424242424242 | Visa | | 阿根廷 (AR) | 4000000320000021 | Visa | | 巴西 (BR) | 4000000760000002 | Visa | | 加拿大 (CA) | 4000001240000000 | Visa | | 智利 (CL) | 4000001520000001 | Visa | | 哥伦比亚 (CO) | 4000001700000003 | Visa | | 哥斯达黎加 (CR) | 4000001880000005 | Visa | | 厄瓜多尔 (EC) | 4000002180000000 | Visa | | 墨西哥 (MX) | 4000004840008001 | Visa | | 墨西哥 (MX) | 5062210000000009 | Carnet | | 巴拿马 (PA) | 4000005910000000 | Visa | | 巴拉圭 (PY) | 4000006000000066 | Visa | | 秘鲁 (PE) | 4000006040000068 | Visa | | 乌拉圭 (UY) | 4000008580000003 | Visa | | **欧洲和中东** | | 阿联酋 (AE) | 4000007840000001 | Visa | | 阿联酋 (AE) | 5200007840000022 | Mastercard | | 奥地利(AT) | 4000000400000008 | Visa | | 比利时(BE) | 4000000560000004 | Visa | | 保加利亚 (BG) | 4000001000000000 | Visa | | 白俄罗斯 (BY) | 4000001120000005 | Visa | | 克罗地亚 (HR) | 4000001910000009 | Visa | | 塞浦路斯 (CY) | 4000001960000008 | Visa | | 捷克 (CZ) | 4000002030000002 | Visa | | 丹麦 (DK) | 4000002080000001 | Visa | | 爱沙尼亚 (EE) | 4000002330000009 | Visa | | 芬兰 (FI) | 4000002460000001 | Visa | | 法国 (FR) | 4000002500000003 | Visa | | 德国(DE) | 4000002760000016 | Visa | | 直布罗陀(GI) | 4000002920000005 | Visa | | 希腊 (GR) | 4000003000000030 | Visa | | 匈牙利 (HU) | 4000003480000005 | Visa | | 爱尔兰(IE) | 4000003720000005 | Visa | | 意大利 (IT) | 4000003800000008 | Visa | | 拉脱维亚 (LV) | 4000004280000005 | Visa | | 列支敦士登 (LI) | 4000004380000004 | Visa | | 立陶宛 (LT) | 4000004400000000 | Visa | | 卢森堡 (LU) | 4000004420000006 | Visa | | 马耳他 (MT) | 4000004700000007 | Visa | | 荷兰 (NL) | 4000005280000002 | Visa | | 挪威(NO) | 4000005780000007 | Visa | | 波兰 (PL) | 4000006160000005 | Visa | | 葡萄牙 (PT) | 4000006200000007 | Visa | | 罗马尼亚 (RO) | 4000006420000001 | Visa | | 沙特阿拉伯 (SA) | 4000006820000007 | Visa | | 斯洛文尼亚 (SI) | 4000007050000006 | Visa | | 斯洛伐克 (SK) | 4000007030000001 | Visa | | 西班牙 (ES) | 4000007240000007 | Visa | | 瑞典 (SE) | 4000007520000008 | Visa | | 瑞士 (CH) | 4000007560000009 | Visa | | 英国 (GB) | 4000008260000000 | Visa | | 英国 (GB) | 4000058260000005 | Visa(借记卡) | | 英国 (GB) | 5555558265554449 | Mastercard | | **亚太地区** > 要测试需要授权和预先支付通知的订阅,请参阅[印度经常性付款](https://docs.stripe.com/india-recurring-payments.md?integration=paymentIntents-setupIntents#testing)。 | | 澳大利亚(AU) | 4000000360000006 | Visa | | 中国内地 (CN) | 4000001560000002 | Visa | | 香港 (HK) | 4000003440000004 | Visa | | 印度 (IN) | 4000003560000008 | Visa | | 日本 (JP) | 4000003920000003 | Visa | | 日本 (JP) | 3530111333300000 | JCB | | 马来西亚 (MY) | 4000004580000002 | Visa | | 新西兰 (NZ) | 4000005540000008 | Visa | | 新加坡(SG) | 4000007020000003 | Visa | | 中国台湾 (TW) | 4000001580000008 | Visa | | 泰国 (TH) | 4000007640000003 | Visa(信用卡) | | 泰国 (TH) | 4000057640000008 | Visa(借记卡) | #### PaymentMethods | 国家/地区 | PaymentMethod | 品牌 | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | ---------- | | **美洲** | | 美国(US) | `pm_card_us` | Visa | | 阿根廷 (AR) | `pm_card_ar` | Visa | | 巴西 (BR) | `pm_card_br` | Visa | | 加拿大 (CA) | `pm_card_ca` | Visa | | 智利 (CL) | `pm_card_cl` | Visa | | 哥伦比亚 (CO) | `pm_card_co` | Visa | | 哥斯达黎加 (CR) | `pm_card_cr` | Visa | | 厄瓜多尔 (EC) | `pm_card_ec` | Visa | | 墨西哥 (MX) | `pm_card_mx` | Visa | | 巴拿马 (PA) | `pm_card_pa` | Visa | | 巴拉圭 (PY) | `pm_card_py` | Visa | | 秘鲁 (PE) | `pm_card_pe` | Visa | | 乌拉圭 (UY) | `pm_card_uy` | Visa | | **欧洲和中东** > *强客户认证* (Strong Customer Authentication (SCA) is a regulatory requirement in effect as of September 14, 2019, that impacts many European online payments. It requires customers to use two-factor authentication like 3D Secure to verify their purchase) 规范要求在*欧洲经济区* (The European Economic Area is a regional single market with free movement of labor, goods, and capital. It encompasses the European Union member states and three additional states that are part of the European Free Trade Association)内进行在线付款时必须通过*3DS 验证* (3D Secure (3DS) provides an additional layer of authentication for credit card transactions that protects businesses from liability for fraudulent card payments)验证。本节中的银行卡测试模拟了在未进行验证的情况下成功支付的情况。我们建议同时使用[3DS 验证测试银行卡](https://docs.stripe.com/testing.md#regulatory-cards)测试涉及身份验证的情境。 | | 阿联酋 (AE) | `pm_card_ae` | Visa | | 阿联酋 (AE) | `pm_card_ae_mastercard` | Mastercard | | 奥地利(AT) | `pm_card_at` | Visa | | 比利时(BE) | `pm_card_be` | Visa | | 保加利亚 (BG) | `pm_card_bg` | Visa | | 白俄罗斯 (BY) | `pm_card_by` | Visa | | 克罗地亚 (HR) | `pm_card_hr` | Visa | | 塞浦路斯 (CY) | `pm_card_cy` | Visa | | 捷克 (CZ) | `pm_card_cz` | Visa | | 丹麦 (DK) | `pm_card_dk` | Visa | | 爱沙尼亚 (EE) | `pm_card_ee` | Visa | | 芬兰 (FI) | `pm_card_fi` | Visa | | 法国 (FR) | `pm_card_fr` | Visa | | 德国(DE) | `pm_card_de` | Visa | | 直布罗陀(GI) | `pm_card_gi` | Visa | | 希腊 (GR) | `pm_card_gr` | Visa | | 匈牙利 (HU) | `pm_card_hu` | Visa | | 爱尔兰(IE) | `pm_card_ie` | Visa | | 意大利 (IT) | `pm_card_it` | Visa | | 拉脱维亚 (LV) | `pm_card_lv` | Visa | | 列支敦士登 (LI) | `pm_card_li` | Visa | | 立陶宛 (LT) | `pm_card_lt` | Visa | | 卢森堡 (LU) | `pm_card_lu` | Visa | | 马耳他 (MT) | `pm_card_mt` | Visa | | 荷兰 (NL) | `pm_card_nl` | Visa | | 挪威(NO) | `pm_card_no` | Visa | | 波兰 (PL) | `pm_card_pl` | Visa | | 葡萄牙 (PT) | `pm_card_pt` | Visa | | 罗马尼亚 (RO) | `pm_card_ro` | Visa | | 斯洛文尼亚 (SI) | `pm_card_si` | Visa | | 斯洛伐克 (SK) | `pm_card_sk` | Visa | | 西班牙 (ES) | `pm_card_es` | Visa | | 瑞典 (SE) | `pm_card_se` | Visa | | 瑞士 (CH) | `pm_card_ch` | Visa | | 英国 (GB) | `pm_card_gb` | Visa | | 英国 (GB) | `pm_card_gb_debit` | Visa(借记卡) | | 英国 (GB) | `pm_card_gb_mastercard` | Mastercard | | **亚太地区** 2 > 要测试需要授权和预先支付通知的订阅,请参阅[印度经常性付款](https://docs.stripe.com/india-recurring-payments.md?integration=paymentIntents-setupIntents#testing)。 | | 澳大利亚(AU) | `pm_card_au` | Visa | | 中国内地 (CN) | `pm_card_cn` | Visa | | 香港 (HK) | `pm_card_hk` | Visa | | 印度 (IN) | `pm_card_in` | Visa | | 日本 (JP) | `pm_card_jp` | Visa | | 日本 (JP) | `pm_card_jcb` | JCB | | 马来西亚 (my) | `pm_card_my` | Visa | | 新西兰 (NZ) | `pm_card_nz` | Visa | | 新加坡(SG) | `pm_card_sg` | Visa | | 中国台湾 (TW) | `pm_card_tw` | Visa | | 泰国 (TH) | `pm_card_th_credit` | Visa(信用卡) | | 泰国 (TH) | `pm_card_th_debit` | Visa(借记卡) | #### 令牌 大多数集成已不再使用令牌,但如果您需要,我们仍提供测试令牌,如 [tok_visa](https://docs.stripe.com/testing.md?testing-method=tokens#visa)。 | 国家/地区 | 令牌 | 品牌 | | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | ---------- | | **美洲** | | 美国(US) | `tok_us` | Visa | | 阿根廷 (AR) | `tok_ar` | Visa | | 巴西 (BR) | `tok_br` | Visa | | 加拿大 (CA) | `tok_ca` | Visa | | 智利 (CL) | `tok_cl` | Visa | | 哥伦比亚 (CO) | `tok_co` | Visa | | 哥斯达黎加 (CR) | `tok_cr` | Visa | | 厄瓜多尔 (EC) | `tok_ec` | Visa | | 墨西哥 (MX) | `tok_mx` | Visa | | 巴拿马 (PA) | `tok_pa` | Visa | | 巴拉圭 (PY) | `tok_py` | Visa | | 秘鲁 (PE) | `tok_pe` | Visa | | 乌拉圭 (UY) | `tok_uy` | Visa | | **欧洲和中东** | | 阿联酋 (AE) | `tok_ae` | Visa | | 阿联酋 (AE) | `tok_ae_mastercard` | Mastercard | | 奥地利(AT) | `tok_at` | Visa | | 比利时(BE) | `tok_be` | Visa | | 保加利亚 (BG) | `tok_bg` | Visa | | 白俄罗斯 (BY) | `tok_by` | Visa | | 克罗地亚 (HR) | `tok_hr` | Visa | | 塞浦路斯 (CY) | `tok_cy` | Visa | | 捷克 (CZ) | `tok_cz` | Visa | | 丹麦 (DK) | `tok_dk` | Visa | | 爱沙尼亚 (EE) | `tok_ee` | Visa | | 芬兰 (FI) | `tok_fi` | Visa | | 法国 (FR) | `tok_fr` | Visa | | 德国(DE) | `tok_de` | Visa | | 直布罗陀(GI) | `tok_gi` | Visa | | 希腊 (GR) | `tok_gr` | Visa | | 匈牙利 (HU) | `tok_hu` | Visa | | 爱尔兰(IE) | `tok_ie` | Visa | | 意大利 (IT) | `tok_it` | Visa | | 拉脱维亚 (LV) | `tok_lv` | Visa | | 列支敦士登 (LI) | `tok_li` | Visa | | 立陶宛 (LT) | `tok_lt` | Visa | | 卢森堡 (LU) | `tok_lu` | Visa | | 马耳他 (MT) | `tok_mt` | Visa | | 荷兰 (NL) | `tok_nl` | Visa | | 挪威(NO) | `tok_no` | Visa | | 波兰 (PL) | `tok_pl` | Visa | | 葡萄牙 (PT) | `tok_pt` | Visa | | 罗马尼亚 (RO) | `tok_ro` | Visa | | 斯洛文尼亚 (SI) | `tok_si` | Visa | | 斯洛伐克 (SK) | `tok_sk` | Visa | | 西班牙 (ES) | `tok_es` | Visa | | 瑞典 (SE) | `tok_se` | Visa | | 瑞士 (CH) | `tok_ch` | Visa | | 英国 (GB) | `tok_gb` | Visa | | 英国 (GB) | `tok_gb_debit` | Visa(借记卡) | | 英国 (GB) | `tok_gb_mastercard` | Mastercard | | **亚太地区** > 要测试需要授权和预先支付通知的订阅,请参阅[印度经常性付款](https://docs.stripe.com/india-recurring-payments.md?integration=paymentIntents-setupIntents#testing)。 | | 澳大利亚(AU) | `tok_au` | Visa | | 中国内地 (CN) | `tok_cn` | Visa | | 香港 (HK) | `tok_hk` | Visa | | 印度 (IN) | `tok_in` | Visa | | 日本 (JP) | `tok_jp` | Visa | | 日本 (JP) | `tok_jcb` | JCB | | 马来西亚 (my) | `tok_my` | Visa | | 新西兰 (NZ) | `tok_nz` | Visa | | 新加坡(SG) | `tok_sg` | Visa | | 中国台湾 (TW) | `tok_tw` | Visa | | 泰国 (TH) | `tok_th_credit` | Visa(信用卡) | | 泰国 (TH) | `tok_th_debit` | Visa(借记卡) | ## 模拟 HSA 或 FSA 银行卡支付 以下是模拟使用健康储蓄账户 (HSA) 和灵活消费账户 (FSA) 进行交易的测试银行卡号。这些账户通常用于支付医疗费用,用其进行测试可确保在您的应用程序中正确处理与医疗保健相关的交易。 #### 卡号 | 品牌/类型 | 尾号 | CVC | 日期 | | -------------- | ---------------- | ------- | ------- | | Visa FSA | 4000051230000072 | 任意 3 位数 | 任意未来的日期 | | Visa HSA | 4000051230000072 | 任意 3 位数 | 任意未来的日期 | | Mastercard FSA | 5200828282828897 | 任意 3 位数 | 任意未来的日期 | #### PaymentMethods | 品牌/类型 | PaymentMethod | | -------------- | --------------------------------------------------- | | Visa FSA | `pm_card_debit_visaFsaProductCode` | | Visa HSA | `pm_card_debit_visaHsaProductCode` | | Mastercard FSA | `pm_card_mastercard_debit_mastercardFsaProductCode` | ## 模拟被拒付的支付 要通过模拟发卡行因各种原因拒付的支付来测试集成的错误处理逻辑,请使用本节中的测试卡。这些卡会返回[银行卡错误](https://docs.stripe.com/error-handling.md#payment-errors),并给出所列的[错误代码](https://docs.stripe.com/error-codes.md)和[拒付代码](https://docs.stripe.com/declines/codes.md)。 测试 CVC 行为时需提供 CVC。如果您省略了 CVC,Stripe 会跳过它,因此该检查不会失败。要模拟 CVC 错误,请使用下表中列出的“错误 CVC 拒付”测试卡,并提供任意三位数的 CVC。 #### 卡号 | 描述 | 尾号 | 错误代码 | 拒付代码 | | ----------- | ---------------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | | 一般拒绝 | 4000000000000002 | [card_declined](https://docs.stripe.com/error-codes.md#card-declined) | [generic_decline](https://docs.stripe.com/declines/codes.md#generic_decline) | | 资金不足拒付 | 4000000000009995 | [card_declined](https://docs.stripe.com/error-codes.md#card-declined) | [insufficient_funds](https://docs.stripe.com/declines/codes.md#insufficient_funds) | | 卡丢失拒付 | 4000000000009987 | [card_declined](https://docs.stripe.com/error-codes.md#card-declined) | [lost_card](https://docs.stripe.com/declines/codes.md#lost_card) | | 被盗卡拒付 | 4000000000009979 | [card_declined](https://docs.stripe.com/error-codes.md#card-declined) | [stolen_card](https://docs.stripe.com/declines/codes.md#stolen_card) | | 过期卡拒付 | 4000000000000069 | [expired_card](https://docs.stripe.com/error-codes.md#expired-card) | 不适用 | | 错误 CVC 拒付 | 4000000000000127 | [incorrect_cvc](https://docs.stripe.com/declines/codes.md#incorrect_cvc) | 不适用 | | 处理错误拒付 | 4000000000000119 | [processing_error](https://docs.stripe.com/error-codes.md#processing-error) | 不适用 | | 错误卡号拒付 | 4242424242424241 | [incorrect_number](https://docs.stripe.com/declines/codes.md#incorrect_number) | 不适用 | | 因超过速率限制而被拒绝 | 4000000000006975 | [card_declined](https://docs.stripe.com/error-codes.md#card-declined) | [card_velocity_exceeded](https://docs.stripe.com/declines/codes.md#card_velocity_exceeded) | 您无法将模拟发卡行拒付的银行卡绑定到 `Customer` 对象。若要使用已绑定的银行卡模拟付款付被拒,请使用下表中列出的“绑定后拒付”测试卡。 | 描述 | 尾号 | 详情 | | ----- | ---------------- | ----------------------------------------------------------------------- | | 绑定后拒付 | 4000000000000341 | 将此银行卡绑定到[客户](https://docs.stripe.com/api/customers.md)对象成功,但向客户收款的尝试失败。 | #### PaymentMethods | 描述 | 尾号 | 错误代码 | 拒付代码 | | ----------- | -------------------------------------------------- | ------------------ | ------------------------ | | 一般拒绝 | `pm_card_visa_chargeDeclined` | `card_declined` | `generic_decline` | | 资金不足拒付 | `pm_card_visa_chargeDeclinedInsufficientFunds` | `card_declined` | `insufficient_funds` | | 卡丢失拒付 | `pm_card_visa_chargeDeclinedLostCard` | `card_declined` | `lost_card` | | 被盗卡拒付 | `pm_card_visa_chargeDeclinedStolenCard` | `card_declined` | `stolen_card` | | 过期卡拒付 | `pm_card_chargeDeclinedExpiredCard` | `expired_card` | 不适用 | | 错误 CVC 拒付 | `pm_card_chargeDeclinedIncorrectCvc` | `incorrect_cvc` | 不适用 | | 处理错误拒付 | `pm_card_chargeDeclinedProcessingError` | `processing_error` | 不适用 | | 因超过速率限制而被拒绝 | `pm_card_visa_chargeDeclinedVelocityLimitExceeded` | `card_declined` | `card_velocity_exceeded` | 您无法将模拟发卡行拒付的银行卡绑定到 `Customer` 对象。若要使用已绑定的银行卡模拟付款付被拒,请使用下表中列出的“绑定后拒付”测试卡。 | 描述 | PaymentMethod | 详情 | | ----- | ---------------------------- | ----------------------------------------------------------------------- | | 绑定后拒付 | `pm_card_chargeCustomerFail` | 将此银行卡绑定到[客户](https://docs.stripe.com/api/customers.md)对象成功,但向客户收款的尝试失败。 | #### 令牌 大多数集成已不再使用令牌,但如果您需要,我们仍提供测试令牌,如 [tok_visa](https://docs.stripe.com/testing.md?testing-method=tokens#visa)。 | 描述 | 尾号 | 错误代码 | 拒付代码 | | ----------- | ------------------------------------------------ | ------------------ | ------------------------ | | 一般拒绝 | `tok_visa_chargeDeclined` | `card_declined` | `generic_decline` | | 资金不足拒付 | `tok_visa_chargeDeclinedInsufficientFunds` | `card_declined` | `insufficient_funds` | | 借记资金不足拒付 | `tok_visa_debit_chargeDeclinedInsufficientFunds` | `card_declined` | `insufficient_funds` | | 卡丢失拒付 | `tok_visa_chargeDeclinedLostCard` | `card_declined` | `lost_card` | | 被盗卡拒付 | `tok_visa_chargeDeclinedStolenCard` | `card_declined` | `stolen_card` | | 过期卡拒付 | `tok_chargeDeclinedExpiredCard` | `expired_card` | 不适用 | | 过期卡拒付 | `tok_visa_chargeDeclinedExpiredCard` | `expired_card` | 不适用 | | 欺诈性银行卡拒付 | `tok_visa_chargeDeclinedFraudulent` | `expired_card` | 不适用 | | 错误 CVC 拒付 | `tok_chargeDeclinedIncorrectCvc` | `incorrect_cvc` | 不适用 | | 错误 CVC 拒付 | `tok_visa_chargeDeclinedIncorrectCvc` | `incorrect_cvc` | 不适用 | | 处理错误拒付 | `tok_chargeDeclinedProcessingError` | `processing_error` | 不适用 | | 处理错误拒付 | `tok_visa_chargeDeclinedProcessingError` | `processing_error` | 不适用 | | 因超过速率限制而被拒绝 | `tok_visa_chargeDeclinedVelocityLimitExceeded` | `card_declined` | `card_velocity_exceeded` | 您无法将模拟发卡行拒付的银行卡绑定到 `Customer` 对象。若要使用已绑定的银行卡模拟付款付被拒,请使用下表中列出的“绑定后拒付”测试卡。 | 描述 | 令牌 | 详情 | | -------- | --------------------------------------- | ------------------------------------------------------------------------------- | | 绑定后拒付 | `tok_chargeCustomerFail` | 将此银行卡绑定到[客户](https://docs.stripe.com/api/customers.md)对象成功,但向客户收款的尝试失败。 | | 绑定后拒付 | `tok_visa_chargeCustomerFail` | 将此银行卡绑定到[客户](https://docs.stripe.com/api/customers.md)对象成功,但向客户收款的尝试失败。 | | 卡绑定后丢失拒付 | `tok_visa_chargeCustomerFailLostCard` | 将此银行卡绑定到[客户](https://docs.stripe.com/api/customers.md)对象成功,但由于银行卡丢失,向客户收款的尝试失败。 | | 卡绑定后被盗拒付 | `tok_visa_chargeCustomerFailStolenCard` | 将此银行卡绑定到[客户](https://docs.stripe.com/api/customers.md)对象成功,但由于银行卡被盗,向客户收款的尝试失败。 | ## 欺诈预防 在付款具有高风险等级或未通过验证检查时,Stripe 的欺诈预防系统 Radar 可以阻止付款。您可以用此部分的卡测试您的 Radar 设置,还可以用这些卡来测试您的集成应用对被阻止付款的响应情况。 每张银行卡都模拟特定的风险因素。您的 Radar 设置决定了哪些风险因素会导致支付被阻止。被阻止的支付会导致[银行卡错误,错误代码为欺诈](https://docs.stripe.com/error-handling.md)。 要触发失败的 CVC 检查,请包含 CVC(任意三位数字)。要触发失败的邮政编码检查,请包含任意有效的邮政编码。如果您省略这些字段,Radar 会跳过相应检查,因此检查不会失败。 #### 卡号 | 描述 | 尾号 | 详情 | | ------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 始终阻止 | 4100000000000019 | 该收款的[风险等级为“最高”](https://docs.stripe.com/radar/risk-evaluation.md#high-risk) Radar 始终会阻止付款。 | | 最高风险 | 4000000000004954 | 该收款的[风险等级为“最高”](https://docs.stripe.com/radar/risk-evaluation.md#high-risk) Radar 可能[根据您的设置](https://docs.stripe.com/radar/risk-settings.md)阻止付款。 | | 风险升高 | 4000000000009235 | 该收款的[风险等级为“升高”](https://docs.stripe.com/radar/risk-evaluation.md#elevated-risk) 如果您使用的是Radar 风控团队版,Radar可能会将其列入[审查队列](https://docs.stripe.com/radar/reviews.md)。 | | 高欺诈争议评分 | 4000008400000407 | 该收款的欺诈争议评分很高。 Radar 可能[根据您的设置](https://docs.stripe.com/radar/risk-settings.md)阻止付款。 | | 高早期欺诈预警评分 | 4000008400000159 | 该收款的早期欺诈预警评分很高。 Radar 可能[根据您的设置](https://docs.stripe.com/radar/risk-settings.md)阻止付款。 | | 动态风险阈值 | 4000008400001017 | 当启用时,这笔收款会触发 Radar 动态风险阈值控制。 如果您启用了[动态风险阈值](https://docs.stripe.com/radar/risk-settings.md#dynamic-risk-threshold),Radar 将会阻止该交易。 | | 自适应 3DS 验证 | 4000008405600003 | 启用后,此笔支付将触发 Radar Adaptive 3DS 风控机制。 若启用 Adaptive 3DS,在使用此测试卡时 Radar 将要求进行 3DS 验证。 | | CVC 检查失败 | 4000000000000101 | 如果您提供 CVC 号码,则 CVC 检查失败。 Radar 可能[根据您的设置](https://docs.stripe.com/radar/rules.md#traditional-bank-checks)阻止付款。 | | 邮编检查失败 | 4000000000000036 | 如果您提供邮编,则邮编检查失败。 Radar 可能[根据您的设置](https://docs.stripe.com/radar/rules.md#traditional-bank-checks)阻止付款。 | | CVC 检查失败,风险升高 | 4000058400307872 | 如果您提供 CVC 号码,则 CVC 检查失败,且[风险等级为“升高”](https://docs.stripe.com/radar/risk-evaluation.md#elevated-risk) Radar 可能[根据您的设置](https://docs.stripe.com/radar/rules.md#traditional-bank-checks)阻止付款。 | | 邮编检查失败,风险升高 | 4000058400306072 | 如果您提供了邮政编码,邮政编码检查失败,且[风险等级为“升高”](https://docs.stripe.com/radar/risk-evaluation.md#elevated-risk) Radar 可能[根据您的设置](https://docs.stripe.com/radar/rules.md#traditional-bank-checks)阻止付款。 | | 第 1 行检查失败 | 4000000000000028 | 地址第 1 行检查失败。 除非[使用自定义 Radar 规则](https://docs.stripe.com/radar/rules/reference.md#post-authorization-attributes)阻止,否则支付会成功。 | | 地址检查失败 | 4000000000000010 | 地址的邮编检查和地址第 1 行检查均失败。 Radar 可能[根据您的设置](https://docs.stripe.com/radar/rules.md#traditional-bank-checks)阻止付款。 | | 地址不可用 | 4000000000000044 | 地址的邮编检查和地址第 1 行检查均不可用。 除非[使用自定义 Radar 规则](https://docs.stripe.com/radar/rules/reference.md#post-authorization-attributes)阻止,否则支付会成功。 | #### PaymentMethods | 描述 | PaymentMethod | 详情 | | ------------- | ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 始终阻止 | `pm_card_radarBlock` | 该收款的[风险等级为“最高”](https://docs.stripe.com/radar/risk-evaluation.md#high-risk) Radar 始终会阻止付款。 | | 最高风险 | `pm_card_riskLevelHighest` | 该收款的[风险等级为“最高”](https://docs.stripe.com/radar/risk-evaluation.md#high-risk) Radar 可能根据您的设置阻止付款。 | | 风险升高 | `pm_card_riskLevelElevated` | 该收款的[风险等级为“升高”](https://docs.stripe.com/radar/risk-evaluation.md#elevated-risk) 如果您使用的是Radar 风控团队版,Radar可能会将其列入[审查队列](https://docs.stripe.com/radar/reviews.md)。 | | 高欺诈争议评分 | `pm_card_highFraudDisputeScore` | 该收款的欺诈争议评分很高。 Radar 可能[根据您的设置](https://docs.stripe.com/radar/risk-settings.md)阻止付款。 | | 高早期欺诈预警评分 | `pm_card_highEfwScore` | 该收款的早期欺诈预警评分很高。 Radar 可能[根据您的设置](https://docs.stripe.com/radar/risk-settings.md)阻止付款。 | | 动态风险阈值 | `pm_card_radarDynamicRiskThreshold` | 当启用时,这笔收款会触发 Radar 动态风险阈值控制。 如果您启用了[动态风险阈值](https://docs.stripe.com/radar/risk-settings.md#dynamic-risk-threshold),Radar 将会阻止该交易。 | | 自适应 3DS 验证 | `pm_card_adaptive3dsChallenge` | 启用后,此笔支付将触发 Radar Adaptive 3DS 风控机制。 若启用 Adaptive 3DS,在使用此测试卡时 Radar 将要求进行 3DS 验证。 | | CVC 检查失败 | `pm_card_cvcCheckFail` | 如果您提供 CVC 号码,则 CVC 检查失败。 Radar 可能[根据您的设置](https://docs.stripe.com/radar/rules.md#traditional-bank-checks)阻止付款。 | | 邮编检查失败 | `pm_card_avsZipFail` | 如果您提供邮编,则邮编检查失败。 Radar 可能[根据您的设置](https://docs.stripe.com/radar/rules.md#traditional-bank-checks)阻止付款。 | | CVC 检查失败,风险升高 | `pm_card_cvcCheckFailElevatedRisk` | 如果您提供 CVC 号码,则 CVC 检查失败,且[风险等级为“升高”](https://docs.stripe.com/radar/risk-evaluation.md#elevated-risk) Radar 可能[根据您的设置](https://docs.stripe.com/radar/rules.md#traditional-bank-checks)阻止付款。 | | 邮编检查失败,风险升高 | `pm_card_avsZipFailElevatedRisk` | 如果您提供了邮政编码,邮政编码检查失败,且[风险等级为“升高”](https://docs.stripe.com/radar/risk-evaluation.md#elevated-risk) Radar 可能[根据您的设置](https://docs.stripe.com/radar/rules.md#traditional-bank-checks)阻止付款。 | | 第 1 行检查失败 | `pm_card_avsLine1Fail` | 地址第 1 行检查失败。 除非[使用自定义 Radar 规则](https://docs.stripe.com/radar/rules/reference.md#post-authorization-attributes)阻止,否则支付会成功。 | | 地址检查失败 | `pm_card_avsFail` | 地址的邮编检查和地址第 1 行检查均失败。 Radar 可能[根据您的设置](https://docs.stripe.com/radar/rules.md#traditional-bank-checks)阻止付款。 | | 地址不可用 | `pm_card_avsUnchecked` | 地址的邮编检查和地址第 1 行检查均不可用。 除非[使用自定义 Radar 规则](https://docs.stripe.com/radar/rules/reference.md#post-authorization-attributes)阻止,否则支付会成功。 | #### 令牌 大多数集成已不再使用令牌,但如果您需要,我们仍提供测试令牌,如 [tok_visa](https://docs.stripe.com/testing.md?testing-method=tokens#visa)。 | 描述 | 令牌 | 详情 | | ------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 始终阻止 | `tok_radarBlock` | 该收款的[风险等级为“最高”](https://docs.stripe.com/radar/risk-evaluation.md#high-risk) Radar 始终会阻止付款。 | | 最高风险 | `tok_riskLevelHighest` | 该收款的[风险等级为“最高”](https://docs.stripe.com/radar/risk-evaluation.md#high-risk) Radar 可能根据您的设置阻止付款。 | | 风险升高 | `tok_riskLevelElevated` | 该收款的[风险等级为“升高”](https://docs.stripe.com/radar/risk-evaluation.md#elevated-risk) 如果您使用的是Radar 风控团队版,Radar可能会将其列入[审查队列](https://docs.stripe.com/radar/reviews.md)。 | | 高欺诈争议评分 | `tok_highFraudDisputeScore` | 该收款的欺诈争议评分很高。 Radar 可能[根据您的设置](https://docs.stripe.com/radar/risk-settings.md)阻止付款。 | | 高早期欺诈预警评分 | `tok_highEfwScore` | 该收款的早期欺诈预警评分很高。 Radar 可能[根据您的设置](https://docs.stripe.com/radar/risk-settings.md)阻止付款。 | | 动态风险阈值 | `tok_radarDynamicRiskThreshold` | 当启用时,这笔收款会触发 Radar 动态风险阈值控制。 如果您启用了[动态风险阈值](https://docs.stripe.com/radar/risk-settings.md#dynamic-risk-threshold),Radar 将会阻止该交易。 | | 自适应 3DS 验证 | `tok_adaptive3dsChallenge` | 启用后,此笔支付将触发 Radar Adaptive 3DS 风控机制。 若启用 Adaptive 3DS,在使用此测试卡时 Radar 将要求进行 3DS 验证。 | | CVC 检查失败 | `tok_cvcCheckFail` | 如果您提供 CVC 号码,则 CVC 检查失败。 Radar 可能[根据您的设置](https://docs.stripe.com/radar/rules.md#traditional-bank-checks)阻止付款。 | | 邮编检查失败 | `tok_avsZipFail` | 如果您提供邮编,则邮编检查失败。 Radar 可能[根据您的设置](https://docs.stripe.com/radar/rules.md#traditional-bank-checks)阻止付款。 | | CVC 检查失败,风险升高 | `tok_cvcCheckFailElevatedRisk` | 如果您提供 CVC 号码,则 CVC 检查失败,且[风险等级为“升高”](https://docs.stripe.com/radar/risk-evaluation.md#elevated-risk) Radar 可能[根据您的设置](https://docs.stripe.com/radar/rules.md#traditional-bank-checks)阻止付款。 | | 邮编检查失败,风险升高 | `tok_avsZipFailElevatedRisk` | 如果您提供了邮政编码,邮政编码检查失败,且[风险等级为“升高”](https://docs.stripe.com/radar/risk-evaluation.md#elevated-risk) Radar 可能[根据您的设置](https://docs.stripe.com/radar/rules.md#traditional-bank-checks)阻止付款。 | | 第 1 行检查失败 | `tok_avsLine1Fail` | 地址第 1 行检查失败。 除非[使用自定义 Radar 规则](https://docs.stripe.com/radar/rules/reference.md#post-authorization-attributes)阻止,否则支付会成功。 | | 地址检查失败 | `tok_avsFail` | 地址的邮编检查和地址第 1 行检查均失败。 Radar 可能[根据您的设置](https://docs.stripe.com/radar/rules.md#traditional-bank-checks)阻止付款。 | | 地址不可用 | `tok_avsUnchecked` | 地址的邮编检查和地址第 1 行检查均不可用。 除非[使用自定义 Radar 规则](https://docs.stripe.com/radar/rules/reference.md#post-authorization-attributes)阻止,否则支付会成功。 | ## 使用无效数据触发错误 要测试无效数据造成的错误,请提供无效信息。不需要为此使用专门的测试卡。任何无效值均可。例如: - [invalid_expiry_month](https://docs.stripe.com/declines/codes.md#invalid_expiry_month):使用无效月份,如**13**。 - [invalid_expiry_year](https://docs.stripe.com/declines/codes.md#invalid_expiry_year):使用过去 50 年以内的年份,如**95**。 - [invalid_cvc](https://docs.stripe.com/declines/codes.md#invalid_cvc):使用两位数,如**99**。 - [incorrect_number](https://docs.stripe.com/declines/codes.md#incorrect_number):使用未通过 [Luhn 检查](https://en.wikipedia.org/wiki/Luhn_algorithm)的卡号,例如 `4242424242424241`。 ## 模拟争议 要模拟[有争议的交易](https://docs.stripe.com/disputes.md),请使用本节中的测试银行卡。然后,为了模拟争议的胜诉或败诉,请提供[胜诉或败诉的证据](https://docs.stripe.com/testing.md#evidence)。 #### 卡号 | 描述 | 尾号 | 详情 | | ---------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 欺诈 | 4000000000000259 | 在默认账户设置下,收款成功,但会作为[欺诈](https://docs.stripe.com/disputes/categories.md)被提出争议。经过 3DS 验证后,这类争议会[受到保护](https://docs.stripe.com/payments/3d-secure/authentication-flow.md#disputed-payments)。 | | 未收到 | 4000000000002685 | 在默认账户设置下,收款成功,但会以[未收到产品](https://docs.stripe.com/disputes/categories.md)为由被提出争议。经过 3DS 验证后,这类争议[不受保护](https://docs.stripe.com/payments/3d-secure/authentication-flow.md#disputed-payments)。 | | 查询 | 4000000000001976 | 在默认账户设置下,收款成功,但会因[查询](https://docs.stripe.com/disputes/how-disputes-work.md#inquiries)被提出争议。 | | 警告 | 4000000000005423 | 在默认账户设置下,收款成功后,只会收到[早期欺诈预警](https://docs.stripe.com/disputes/how-disputes-work.md#early-fraud-warnings)。 | | 多项争议 | 4000000404000079 | 在默认账户设置下,收款成功,但会因[多次](https://docs.stripe.com/disputes/how-disputes-work.md#multiple-disputes)被提出争议。 | | Visa 有说服力的证据 3.0 | 4000000404000038 | 在默认账户设置下,收款成功,但会作为[符合 Visa 有说服力的证据 3.0 的争议](https://docs.stripe.com/disputes/api/visa-ce3.md#testing)被提出争议。 | | Visa 合规 | 4000008400000779 | 在默认账户设置下,收款成功,但会作为[Visa 合规争议](https://docs.stripe.com/disputes/api/visa-compliance.md#testing)被提出争议。 | #### PaymentMethods | 描述 | PaymentMethod | 详情 | | ---------------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 欺诈 | `pm_card_createDispute` | 在默认账户设置下,收款成功,但会作为[欺诈](https://docs.stripe.com/disputes/categories.md)被提出争议。经过 3DS 验证后,这类争议会[受到保护](https://docs.stripe.com/payments/3d-secure/authentication-flow.md#disputed-payments)。 | | 未收到 | `pm_card_createDisputeProductNotReceived` | 在默认账户设置下,收款成功,但会以[未收到产品](https://docs.stripe.com/disputes/categories.md)为由被提出争议。经过 3DS 验证后,这类争议[不受保护](https://docs.stripe.com/payments/3d-secure/authentication-flow.md#disputed-payments)。 | | 查询 | `pm_card_createDisputeInquiry` | 在默认账户设置下,收款成功,但会因[查询](https://docs.stripe.com/disputes/how-disputes-work.md#inquiries)被提出争议。 | | 警告 | `pm_card_createIssuerFraudRecord` | 在默认账户设置下,收款成功后,只会收到[早期欺诈预警](https://docs.stripe.com/disputes/how-disputes-work.md#early-fraud-warnings)。 | | 多项争议 | `pm_card_createMultipleDisputes` | 在默认账户设置下,收款成功,但会因[多次](https://docs.stripe.com/disputes/how-disputes-work.md#multiple-disputes)被提出争议。 | | Visa 有说服力的证据 3.0 | `pm_card_createCe3EligibleDispute` | 在默认账户设置下,收款成功,但会作为[符合 Visa 有说服力的证据 3.0 的争议](https://docs.stripe.com/disputes/api/visa-ce3.md#testing)被提出争议。 | | Visa 合规 | `pm_card_createComplianceDispute` | 在默认账户设置下,收款成功,但会作为[Visa 合规争议](https://docs.stripe.com/disputes/api/visa-compliance.md#testing)被提出争议。 | #### 令牌 大多数集成已不再使用令牌,但如果您需要,我们仍提供测试令牌,如 [tok_visa](https://docs.stripe.com/testing.md?testing-method=tokens#visa)。 | 描述 | 令牌 | 详情 | | ---------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 欺诈 | `tok_createDispute` | 在默认账户设置下,收款成功,但会作为[欺诈](https://docs.stripe.com/disputes/categories.md)被提出争议。经过 3DS 验证后,这类争议会[受到保护](https://docs.stripe.com/payments/3d-secure/authentication-flow.md#disputed-payments)。 | | 未收到 | `tok_createDisputeProductNotReceived` | 在默认账户设置下,收款成功,但会以[未收到产品](https://docs.stripe.com/disputes/categories.md)为由被提出争议。经过 3DS 验证后,这类争议[不受保护](https://docs.stripe.com/payments/3d-secure/authentication-flow.md#disputed-payments)。 | | 查询 | `tok_createDisputeInquiry` | 在默认账户设置下,收款成功,但会因[查询](https://docs.stripe.com/disputes/how-disputes-work.md#inquiries)被提出争议。 | | 警告 | `tok_createIssuerFraudRecord` | 在默认账户设置下,收款成功后,只会收到[早期欺诈预警](https://docs.stripe.com/disputes/how-disputes-work.md#early-fraud-warnings)。 | | 多项争议 | `tok_createMultipleDisputes` | 在默认账户设置下,收款成功,但会因[多次](https://docs.stripe.com/disputes/how-disputes-work.md#multiple-disputes)被提出争议。 | | Visa 有说服力的证据 3.0 | `tok_createCe3EligibleDispute` | 在默认账户设置下,收款成功,但会作为[符合 Visa 有说服力的证据 3.0 的争议](https://docs.stripe.com/disputes/api/visa-ce3.md#testing)被提出争议。 | | Visa 合规 | `tok_createComplianceDispute` | 在默认账户设置下,收款成功,但会作为[Visa 合规争议](https://docs.stripe.com/disputes/api/visa-compliance.md#testing)被提出争议。 | ### 证据 要模拟争议胜诉或败诉的情形,请用下表中的某个证据值来响应。 - 如果[使用 API 进行响应](https://docs.stripe.com/disputes/api.md),请将表中的值作为[uncategorized_text](https://docs.stripe.com/api/disputes/update.md#update_dispute-evidence-uncategorized_text)传入。 - 如果您在[管理平台](https://docs.stripe.com/disputes/responding.md)或 [Connect 嵌入式组件](https://docs.stripe.com/connect/supported-embedded-components/disputes-list.md) 中作出回应,请在**其他信息**字段中输入表中的值。随后,点击**提交证据**。 | 证据 | 描述 | | --------------------------- | --------------------------------------- | | `winning_evidence` | 以胜诉为由关闭争议,并将收款金额和相关费用记入您的账户。 | | `losing_evidence` | 以丢失为由将争议关闭,款项不记入您的账户。对于查询,则关闭查询而不升级。 | | `escalate_inquiry_evidence` | 将查询升级为撤单。这将查询升级为全面争议,并从您的账户扣除争议金额和相关费用。 | ## 模拟异步退款 真实模式下的退款是异步的:退款可能看上去是成功的,然后会失败;也可能先是 `pending`,然后成功。要模拟包含这些行为的退款,请使用本节的测试卡。对于其他所有测试卡,退款会立即成功,且之后状态不会改变。 #### 卡号 | 描述 | 尾号 | 详情 | | ---- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | 异步成功 | 4000000000007726 | 收款成功。如果启动退款,其状态开始为`pending`。一段时间后,其状态转变为`succeeded`,并发送`refund.updated`[事件](https://docs.stripe.com/api/events/types.md#event_types-refund.updated)。 | | 异步失败 | 4000000000005126 | 收款成功。如果启动退款,其状态开始为`succeeded`。一段时间后,其状态转变为`failed`,并发送`refund.failed`[事件](https://docs.stripe.com/api/events/types.md#event_types-refund.failed)。 | #### PaymentMethods | 描述 | PaymentMethod | 详情 | | ---- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | 异步成功 | `pm_card_pendingRefund` | 收款成功。如果启动退款,其状态开始为`pending`。一段时间后,其状态转变为`succeeded`,并发送`refund.updated`[事件](https://docs.stripe.com/api/events/types.md#event_types-refund.updated)。 | | 异步失败 | `pm_card_refundFail` | 收款成功。如果启动退款,其状态开始为`succeeded`。一段时间后,其状态转变为`failed`,并发送`refund.failed`[事件](https://docs.stripe.com/api/events/types.md#event_types-refund.failed)。 | #### 令牌 大多数集成已不再使用令牌,但如果您需要,我们仍提供测试令牌,如 [tok_visa](https://docs.stripe.com/testing.md?testing-method=tokens#visa)。 | 描述 | 令牌 | 详情 | | ---- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | 异步成功 | `tok_pendingRefund` | 收款成功。如果启动退款,其状态开始为`pending`。一段时间后,其状态转变为`succeeded`,并发送`refund.updated`[事件](https://docs.stripe.com/api/events/types.md#event_types-refund.updated)。 | | 异步失败 | `tok_refundFail` | 收款成功。如果启动退款,其状态开始为`succeeded`。一段时间后,其状态转变为`failed`,并发送`refund.failed`[事件](https://docs.stripe.com/api/events/types.md#event_types-refund.failed)。 | 只能通过管理平台取消银行卡退款。在真实模式下,您可以在很短但非特定的时间内取消银行卡退款。测试环境会模拟这段时间,允许您在 30 分钟内取消银行卡退款。 ## 将资金发送至您的可用余额 要将测试交易中的资金直接发送到您的可用余额,请使用此部分的测试卡。其他测试卡会将从成功付款得到的资金发送到您的待收余额。 #### 卡号 | 描述 | 尾号 | 详情 | | ------ | ---------------- | ----------------------------- | | 绕过待收余额 | 4000000000000077 | 美国扣款成功。资金直接进入您的可用余额,绕过您的待收余额。 | | 绕过待收余额 | 4000003720000278 | 国际扣款成功。资金直接进入您的可用余额,绕过您的待收余额。 | #### PaymentMethods | 描述 | PaymentMethod | 详情 | | ------ | ------------------------------------ | ----------------------------- | | 绕过待收余额 | `pm_card_bypassPending` | 美国扣款成功。资金直接进入您的可用余额,绕过您的待收余额。 | | 绕过待收余额 | `pm_card_bypassPendingInternational` | 国际扣款成功。资金直接进入您的可用余额,绕过您的待收余额。 | #### 令牌 大多数集成已不再使用令牌,但如果您需要,我们仍提供测试令牌,如 [tok_visa](https://docs.stripe.com/testing.md?testing-method=tokens#visa)。 | 描述 | 令牌 | 详情 | | ------ | -------------------------------- | ----------------------------- | | 绕过待收余额 | `tok_bypassPending` | 美国扣款成功。资金直接进入您的可用余额,绕过您的待收余额。 | | 绕过待收余额 | `tok_bypassPendingInternational` | 国际扣款成功。资金直接进入您的可用余额,绕过您的待收余额。 | ## 测试 3DS 验证 3DS 验证要求对信用卡交易进行额外一层验证。本节中的测试卡可供您在不同的支付流程中模拟如何触发身份验证。 只有本节中的卡可以通过模拟定义的 3DS 验证行为(如验证流程或不支持的卡)来有效测试您的 3DS 验证集成应用。其他 Stripe 测试卡可能仍会触发 3DS 验证,但我们会返回`attempt_acknowledged`以绕过额外的步骤,因为 3DS 验证测试不是这些卡的目标。 > #### 不支持管理平台 > > 对于直接在 Stripe 管理平台中创建的付款,不会发生 3DS 验证重定向,而是会使用您的集成应用自身的前端或调用 API。 ### 验证和设置 要模拟包含身份验证的支付流程,请使用本节中的测试银行卡。其中一些银行卡还可以[设置](https://docs.stripe.com/payments/save-and-reuse.md)用于未来的支付,或者已设置完成。 #### 卡号 | 描述 | 尾号 | 详情 | | ------ | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 不设置即验证 | 4000002500003155 | 该卡要求会话外支付验证,除非您[设置](https://docs.stripe.com/payments/save-and-reuse.md)用它进行未来的付款。设置后,将不再要求对会话外支付进行验证。但是,使用该卡进行的会话内支付始终要求验证。 | | 始终验证 | 4000002760003184 | 无论是如何设置的,该卡仍要求验证所有交易。 | | 已设置 | 4000003800000446 | 该银行卡已设置为会话外使用。[一次性](https://docs.stripe.com/payments/accept-a-payment.md?platform=web)支付和其他[会话内](https://docs.stripe.com/payments/existing-customers.md?platform=web&ui=elements)支付都需要验证。但是,所有*会话外支付* (A payment is described as off-session if it occurs without the direct involvement of the customer, using previously-collected payment information)都会成功,就像该银行卡之前已[设置](https://docs.stripe.com/payments/save-and-reuse.md)好一样。 | | 资金不足 | 4000008260003178 | 此银行卡在[一次性支付时](https://docs.stripe.com/payments/accept-a-payment.md?platform=web)需要验证。所有支付都会被`insufficient_funds`失败代码拒付,即使已成功身份验证或之前已[设置](https://docs.stripe.com/payments/save-and-reuse.md)。 | #### PaymentMethods | 描述 | PaymentMethod | 详情 | | ------ | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 不设置即验证 | `pm_card_authenticationRequiredOnSetup` | 该卡要求对每笔付款进行验证,除非您将其[设置](https://docs.stripe.com/payments/save-and-reuse.md)用它进行未来的付款。完成设置后,它将不再要求验证。 | | 始终验证 | `pm_card_authenticationRequired` | 无论是如何设置的,该卡仍要求验证所有交易。 | | 已设置 | `pm_card_authenticationRequiredSetupForOffSession` | 该银行卡已设置为会话外使用。[一次性](https://docs.stripe.com/payments/accept-a-payment.md?platform=web)和其他[会话内](https://docs.stripe.com/payments/existing-customers.md?platform=web&ui=elements)支付都需要验证。但是,所有会话外支付都会成功,就像该银行卡之前已[设置](https://docs.stripe.com/payments/save-and-reuse.md)好一样。 | | 资金不足 | `pm_card_authenticationRequiredChargeDeclinedInsufficientFunds` | 此银行卡在[一次性支付时](https://docs.stripe.com/payments/accept-a-payment.md?platform=web)需要验证。所有支付都会被`insufficient_funds`失败代码拒付,即使已成功身份验证或之前已[设置](https://docs.stripe.com/payments/save-and-reuse.md)。 | ### 支持及可用性 有法规要求,或者您的 Radar 规则或自定义代码触发时,Stripe 会要求验证。即使是请求了验证,也并非总是执行——例如,客户的卡可能未注册,或可能发生错误。用此部分的测试卡模拟这些因素的各种组合。 所有 3DS 参考信息均指代[3DS 2.0 验证](https://stripe.com/guides/3d-secure-2)。 #### 卡号 | 3DS 验证的使用情况 | 结果 | 尾号 | 详情 | | ----------- | --------------- | ------------------------------------------------------------ | -------------------------------------------------------------------------------------------- | | 要求 3DS 验证 | 确定 | 4000000000003220 | 必须完成 3DS 验证,付款才能成功。默认情况下,Radar 规则会为该卡请求 3DS 验证。 | | 要求 3DS 验证 | 被拒绝 | 4000008400001629 | 要求 3DS 验证,但验证后付款会被拒绝,显示`card_declined`失败代码。默认情况下,Radar 规则会为该卡请求 3DS 验证。 | | 要求 3DS 验证 | 错误 | 4000008400001280 | 要求 3DS 验证,但 3DS 验证查找请求会失败,显示处理错误。付款被拒绝,显示`card_declined`失败代码。默认情况下,Radar 规则会为该卡请求 3DS 验证。 | | 支持 3DS 验证 | 确定 | 4000000000003055 | 可能仍可执行 3DS 验证,但不是必须的。默认情况下,Radar 规则不会为该卡请求 3DS 验证。 | | 支持 3DS 验证 | 错误 | 4000000000003097 | 可能仍可执行 3DS 验证,但不是必须的。但是,尝试执行 3DS 验证会导致处理错误。默认情况下,Radar 规则不会为该卡请求 3DS 验证。 | | 支持 3DS 验证 | 未注册 | 4242424242424242 | 该卡支持 3DS 验证,但未在 3DS 验证中注册。即使您的 Radar 规则要求 3DS 验证,也不会提示客户进行身份验证。默认情况下,Radar 规则不会为该卡请求 3DS 验证。 | | 不支持 3DS 验证 | 378282246310005 | 该卡不支持 3DS 验证,无法调用。PaymentIntent 或 SetupIntent 会在不执行验证的情况下处理。 | | 3DS 无摩擦流程 | 确定 | 4000000032200000 | 无论银行卡如何设置,所有交易均需进行 3DS 验证。验证将通过无摩擦流程进行,并成功完成。 | #### PaymentMethods | 3DS 验证的使用情况 | 结果 | PaymentMethod | 详情 | | ----------- | --- | --------------------------------------------- | -------------------------------------------------------------------------------------------- | | 必填 | 确定 | `pm_card_threeDSecure2Required` | 必须完成 3DS 验证,付款才能成功。默认情况下,Radar 规则会为该卡请求 3DS 验证。 | | 必填 | 被拒绝 | `pm_card_threeDSecureRequiredChargeDeclined` | 要求 3DS 验证,但验证后付款会被拒绝,显示`card_declined`失败代码。默认情况下,Radar 规则会为该卡请求 3DS 验证。 | | 必填 | 错误 | `pm_card_threeDSecureRequiredProcessingError` | 要求 3DS 验证,但 3DS 验证查找请求会失败,显示处理错误。付款被拒绝,显示`card_declined`失败代码。默认情况下,Radar 规则会为该卡请求 3DS 验证。 | | 支持 | 确定 | `pm_card_threeDSecureOptional` | 可能仍可执行 3DS 验证,但不是必须的。默认情况下,Radar 规则不会为该卡请求 3DS 验证。 | | 支持 | 错误 | `pm_card_threeDSecureOptionalProcessingError` | 可能仍可执行 3DS 验证,但不是必须的。但是,尝试执行 3DS 验证会导致处理错误。默认情况下,Radar 规则不会为该卡请求 3DS 验证。 | | 支持 | 未注册 | `pm_card_visa` | 该卡支持 3DS 验证,但未在 3DS 验证中注册。即使您的 Radar 规则要求 3DS 验证,也不会提示客户进行身份验证。默认情况下,Radar 规则不会为该卡请求 3DS 验证。 | | 不支持 | | `pm_card_amex_threeDSecureNotSupported` | 该卡不支持 3DS 验证,无法调用。PaymentIntent 或 SetupIntent 会在不执行验证的情况下处理。 | #### 令牌 大多数集成已不再使用令牌,但如果您需要,我们仍提供测试令牌,如 [tok_visa](https://docs.stripe.com/testing.md?testing-method=tokens#visa)。 | 3DS 验证的使用情况 | 结果 | 令牌 | 详情 | | ----------- | --- | ----------------------------------------- | -------------------------------------------------------------------------------------------- | | 必填 | 确定 | `tok_threeDSecure2Required` | 必须完成 3DS 验证,付款才能成功。默认情况下,Radar 规则会为该卡请求 3DS 验证。 | | 必填 | 被拒绝 | `tok_threeDSecureRequiredChargeDeclined` | 要求 3DS 验证,但验证后付款会被拒绝,显示`card_declined`失败代码。默认情况下,Radar 规则会为该卡请求 3DS 验证。 | | 必填 | 错误 | `tok_threeDSecureRequiredProcessingError` | 要求 3DS 验证,但 3DS 验证查找请求会失败,显示处理错误。付款被拒绝,显示`card_declined`失败代码。默认情况下,Radar 规则会为该卡请求 3DS 验证。 | | 支持 | 确定 | `tok_threeDSecureOptional` | 可能仍可执行 3DS 验证,但不是必须的。默认情况下,Radar 规则不会为该卡请求 3DS 验证。 | | 支持 | 错误 | `tok_threeDSecureOptionalProcessingError` | 可能仍可执行 3DS 验证,但不是必须的。但是,尝试执行 3DS 验证会导致处理错误。默认情况下,Radar 规则不会为该卡请求 3DS 验证。 | | 支持 | 未注册 | `tok_visa` | 该卡支持 3DS 验证,但未在 3DS 验证中注册。即使您的 Radar 规则要求 3DS 验证,也不会提示客户进行身份验证。默认情况下,Radar 规则不会为该卡请求 3DS 验证。 | | 不支持 | | `tok_amex_threeDSecureNotSupported` | 该卡不支持 3DS 验证,无法调用。PaymentIntent 会在不执行验证的情况下处理。 | ### 3DS 验证移动端验证流程 在移动端付款时,可以使用多个验证流程——客户必须与 UI 中的提示信息交互。用此部分的测试卡,为测试而触发特定的验证流程。这些卡不能在基于网页的支付表单或 API 调用中使用。在上述环境中,这些卡能用,但不会触发任何特殊行为。因为这些卡在 API 调用中无法使用,我们不提供测试用的任何`PaymentMethod`或`Token`值。 | 验证流程 | 尾号 | 详情 | | ----- | ---------------- | ---------------------------------------------------------- | | 带外数据 | 4000582600000094 | 必须对所有交易进行 3DS 2.0 验证。用带外数据 (Out of Band) UI 触发验证流程。 | | 一次性密码 | 4000582600000045 | 必须对所有交易进行 3DS 2.0 验证。用一次性密码 (One Time Passcode) UI 触发验证流程。 | | 单选 | 4000582600000102 | 必须对所有交易进行 3DS 2.0 验证。用单选 (single-select) UI 触发验证流程。 | | 多选 | 4000582600000110 | 必须对所有交易进行 3DS 2.0 验证。用多选 (multi-select) UI 触发验证流程。 | ## 模拟验证码挑战 为防止欺诈,Stripe 可能会在支付页面上向用户显示验证码验证。用下方的测试卡模拟该流程。 | 描述 | 尾号 | 详情 | | ----- | ---------------- | ------------------------ | | 验证码验证 | 4000000000001208 | 如果用户正确回答了验证码挑战的问题,则收款成功。 | | 验证码验证 | 4000000000003725 | 如果用户正确回答了验证码挑战的问题,则收款成功。 | ## 模拟带 PIN 的线下付款 使用本节中的测试银行卡来模拟涉及 PIN 码且成功进行的当面支付。测试线下付款还有很多其他选择,包括模拟读卡器和实体测试银行卡。更多信息,请参阅[测试 Stripe Terminal](https://docs.stripe.com/terminal/references/testing.md)。 #### 卡号 | 描述 | 尾号 | 详情 | | ---------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 离线 PIN 码 | 4001007020000002 | 该银行卡模拟的付款情形,会提示持卡人输入*离线 PIN 码* (Offline PIN is a card verification method for EMV chip cards. These cards store the PIN securely on the chip itself, so PIN verification can occur without a network connection)。由此产生的收款会将[cardholder_verification_method](https://docs.stripe.com/api/charges/object.md#charge_object-payment_method_details-card_present-receipt-cardholder_verification_method)设置为`offline_pin`。 | | 离线 PIN 码重试 | 4000008260000075 | 模拟强客户认证 (SCA) 触发的重试流程,持卡人的首次非接触式扣款失败后,读卡器会提示用户插入银行卡并输入*离线 PIN 码* (Offline PIN is a card verification method for EMV chip cards. These cards store the PIN securely on the chip itself, so PIN verification can occur without a network connection)。由此产生的收款会将[cardholder_verification_method](https://docs.stripe.com/api/charges/object.md#charge_object-payment_method_details-card_present-receipt-cardholder_verification_method)设置为`offline_pin`。 | | 在线 PIN 码 | 4001000360000005 | 该银行卡模拟的付款情形,会提示持卡人输入 *在线 PIN 码* (Online PIN is a card verification method for EMV chip cards. These cards require the terminal to contact the issuer over a network connection to verify the PIN)。由此产生的收款会将[cardholder_verification_method](https://docs.stripe.com/api/charges/object.md#charge_object-payment_method_details-card_present-receipt-cardholder_verification_method)设置为`online_pin` 。 | | 在线 PIN 码重试 | 4000002760000008 | 模拟强客户认证 (SCA) 触发的重试流程,在此流程中,持卡人最初非接触式扣款失败后,读卡器会提示用户插入银行卡并输入*在线 PIN 码* (Online PIN is a card verification method for EMV chip cards. These cards require the terminal to contact the issuer over a network connection to verify the PIN)。由此产生的收款会将[cardholder_verification_method](https://docs.stripe.com/api/charges/object.md#charge_object-payment_method_details-card_present-receipt-cardholder_verification_method)设置为`online_pin`。 | #### PaymentMethods | 描述 | 尾号 | 详情 | | ---------- | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 离线 PIN 码 | `offline_pin_cvm` | 该银行卡模拟的付款情形,会提示持卡人输入*离线 PIN 码* (Offline PIN is a card verification method for EMV chip cards. These cards store the PIN securely on the chip itself, so PIN verification can occur without a network connection)。由此产生的收款会将[cardholder_verification_method](https://docs.stripe.com/api/charges/object.md#charge_object-payment_method_details-card_present-receipt-cardholder_verification_method)设置为`offline_pin`。 | | 离线 PIN 码重试 | `offline_pin_sca_retry` | 模拟强客户认证 (SCA) 触发的重试流程,持卡人的首次非接触式扣款失败后,读卡器会提示用户插入银行卡并输入*离线 PIN 码* (Offline PIN is a card verification method for EMV chip cards. These cards store the PIN securely on the chip itself, so PIN verification can occur without a network connection)。由此产生的收款会将[cardholder_verification_method](https://docs.stripe.com/api/charges/object.md#charge_object-payment_method_details-card_present-receipt-cardholder_verification_method)设置为`offline_pin`。 | | 在线 PIN 码 | `online_pin_cvm` | 该银行卡模拟的付款情形,会提示持卡人输入 *在线 PIN 码* (Online PIN is a card verification method for EMV chip cards. These cards require the terminal to contact the issuer over a network connection to verify the PIN)。由此产生的收款会将[cardholder_verification_method](https://docs.stripe.com/api/charges/object.md#charge_object-payment_method_details-card_present-receipt-cardholder_verification_method)设置为`online_pin` 。 | | 在线 PIN 码重试 | `online_pin_sca_retry` | 模拟强客户认证 (SCA) 触发的重试流程,在此流程中,持卡人最初非接触式扣款失败后,读卡器会提示用户插入银行卡并输入*在线 PIN 码* (Online PIN is a card verification method for EMV chip cards. These cards require the terminal to contact the issuer over a network connection to verify the PIN)。由此产生的收款会将[cardholder_verification_method](https://docs.stripe.com/api/charges/object.md#charge_object-payment_method_details-card_present-receipt-cardholder_verification_method)设置为`online_pin`。 | ## 测试 Webhook 或事件接收端 要测试您的 Webhook 端点或[事件接收端](https://docs.stripe.com/event-destinations.md),请选择以下两种选项之一: 1. 在沙盒中执行操作,将合法事件发送到您的事件接收端。例如,要触发 [charge.succeeded](https://docs.stripe.com/api.md#event_types-charge.succeeded) 事件,您可以使用一个[产生成功收款的测试卡](https://docs.stripe.com/testing.md#cards)。 1. [用 Stripe CLI 触发事件](https://docs.stripe.com/webhooks.md#test-webhook)或[使用 Stripe 的 Visual Studio Code](https://docs.stripe.com/stripe-vscode.md#webhooks)。 ## 速率限制 如果您在测试环境中的请求开始收到`429` HTTP 错误,请降低请求的频率。这些错误来自我们的[速率限制器](https://docs.stripe.com/rate-limits.md),在测试环境中比在真实模式中更为严格。 我们不建议在测试环境中使用 Stripe API 对集成应用进行负载测试。因为测试环境中的负载限制器更为严格,可能看到在生产环境中不会出现的错误。请参阅[负载测试](https://docs.stripe.com/rate-limits.md#load-testing)了解替代方法。 ## 测试非银行卡支付方式 当您使用测试非卡支付方式时,请在所有 API 调用中使用[测试 API 密钥](https://docs.stripe.com/keys.md#obtain-api-keys)。无论您是提供支付表单进行交互式测试,还是编写测试代码,都应如此。 测试程序因支付方式而异: #### ACH 直接借记 了解如何使用 [Financial Connections](https://docs.stripe.com/financial-connections/testing.md#web-how-to-use-test-accounts) 进行即时验证来测试各种场景。 ### 在沙盒中发送交易电子邮件 在您收集了银行账户详情并接受授权后,在*沙盒* (A sandbox is an isolated test environment that allows you to test Stripe functionality in your account without affecting your live integration. Use sandboxes to safely experiment with new features and changes)中发送授权确认和微存款验证电子邮件。 如果您的域名是 **{domain}**,并且您的用户名是 **{username}**,请使用以下邮件格式发送测试交易邮件: **{username}+test\_email@{domain}**。 例如,如果您的域名是 **example.com**,用户名是 **info**,则使用格式 **info+test\_email@example.com** 来测试 ACH 直接借记支付。这种格式确保电子邮件路由正确。如果您不包含 **+test\_email** 后缀,我们将不发送电子邮件。 > 您需要[激活您的 Stripe 账户](https://docs.stripe.com/get-started/account/activate.md)后才能在测试时触发这些邮件。 ### 测试账号 Stripe 提供了几个测试账号和相应的令牌,您可以用它们来确保您的手动输入银行账户的集成已经可以投入生产。 | 账号 | 令牌 | 路径号码 | 行为 | | -------------- | -------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------- | | `000123456789` | `pm_usBankAccount_success` | `110000000` | 付款成功。 | | `000111111113` | `pm_usBankAccount_accountClosed` | `110000000` | 付款因账户已关闭失败。 | | `000000004954` | `pm_usBankAccount_riskLevelHighest` | `110000000` | 由于[高欺诈风险](https://docs.stripe.com/radar/risk-evaluation.md#high-risk),该支付被 Radar 阻止了。 | | `000111111116` | `pm_usBankAccount_noAccount` | `110000000` | 付款因查无账户失败。 | | `000222222227` | `pm_usBankAccount_insufficientFunds` | `110000000` | 付款因资金不足失败。 | | `000333333335` | `pm_usBankAccount_debitNotAuthorized` | `110000000` | 付款因扣款未获授权失败。 | | `000444444440` | `pm_usBankAccount_invalidCurrency` | `110000000` | 付款因货币无效失败。 | | `000666666661` | `pm_usBankAccount_failMicrodeposits` | `110000000` | 付款时未能发送微额存款。 | | `000555555559` | `pm_usBankAccount_dispute` | `110000000` | 这笔付款触发了争议。 | | `000000000009` | `pm_usBankAccount_processing` | `110000000` | 支付会无限期地保持处理中。这对于测试 [PaymentIntent 取消](https://docs.stripe.com/api/payment_intents/cancel.md) 很有用。 | | `000777777771` | `pm_usBankAccount_weeklyLimitExceeded` | `110000000` | 付款因支付金额导致账户超过每周支付限额失败了。 | | `000888888885` | | `110000000` | 付款失败是因为[令牌化账户号](https://docs.stripe.com/financial-connections/tokenized-account-numbers.md)已停用。 | 在测试交易完成之前,您需要验证所有付款能够自动成功或失败的测试账户。为此,请使用下面测试用的微存款金额或描述符代码。 ### 测试微存款金额和描述符代码 要模拟不同的场景,请使用这些微存款金额_或_ 0.01 此描述符代码值。 | 微存款金额 | 0.01 描述代码的值 | 场景 | | ----------- | ----------- | ---------------- | | `32` 和 `45` | SM11AA | 模拟验证账户。 | | `10` 和 `11` | SM33CC | 模拟次数超过允许的验证尝试次数。 | | `40` 和 `41` | SM44DD | 模拟微存款超时。 | ### 测试结算行为 测试交易会即时结算并添加到您的可用测试余额中。该行为与真实模式不同,真实模式的交易可能需要[数天](https://docs.stripe.com/testing.md#timing)才能结算到您的可用余额中。 #### SEPA 直接借记 通过下列操作,创建成功或失败的测试`PaymentIntent`: 1. 用测试账号创建测试*PaymentMethod* (PaymentMethods represent your customer's payment instruments, used with the Payment Intents or Setup Intents APIs)。 1. 用`confirmSepaDebitPayment`请求中产生的`PaymentMethod`创建测试收款。 ### AT | Account Number | Token | Description | | -------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | AT611904300234573201 | pm_success_at | The PaymentIntent status transitions from `processing` to `succeeded`. | | AT321904300235473204 | pm_successDelayed_at | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | AT861904300235473202 | pm_failed_at | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | AT051904300235473205 | pm_failedDelayed_at | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | AT591904300235473203 | pm_disputed_at | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | AT981904300000343434 | pm_exceedsWeeklyVolumeLimit_at | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | AT601904300000121212 | pm_exceedsWeeklyTransactionLimit_at | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | AT981904300002222227 | pm_insufficientFunds_at | The payment fails with an `insufficient_funds` failure code. | ### BE | Account Number | Token | Description | | ---------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | BE62510007547061 | pm_success_be | The PaymentIntent status transitions from `processing` to `succeeded`. | | BE78510007547064 | pm_successDelayed_be | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | BE68539007547034 | pm_failed_be | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | BE51510007547065 | pm_failedDelayed_be | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | BE08510007547063 | pm_disputed_be | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | BE90510000343434 | pm_exceedsWeeklyVolumeLimit_be | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | BE52510000121212 | pm_exceedsWeeklyTransactionLimit_be | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | BE90510002222227 | pm_insufficientFunds_be | The payment fails with an `insufficient_funds` failure code. | ### HR | Account Number | Token | Description | | --------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | HR7624020064583467589 | pm_success_hr | The PaymentIntent status transitions from `processing` to `succeeded`. | | HR6323600002337876649 | pm_successDelayed_hr | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | HR2725000096983499248 | pm_failed_hr | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | HR6723600004878117427 | pm_failedDelayed_hr | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | HR8724840081455523553 | pm_disputed_hr | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | HR7424020060000343434 | pm_exceedsWeeklyVolumeLimit_hr | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | HR3624020060000121212 | pm_exceedsWeeklyTransactionLimit_hr | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | HR7424020060002222227 | pm_insufficientFunds_hr | The payment fails with an `insufficient_funds` failure code. | ### EE | Account Number | Token | Description | | -------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | EE382200221020145685 | pm_success_ee | The PaymentIntent status transitions from `processing` to `succeeded`. | | EE222200221020145682 | pm_successDelayed_ee | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | EE762200221020145680 | pm_failed_ee | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | EE922200221020145683 | pm_failedDelayed_ee | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | EE492200221020145681 | pm_disputed_ee | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | EE672200000000343434 | pm_exceedsWeeklyVolumeLimit_ee | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | EE292200000000121212 | pm_exceedsWeeklyTransactionLimit_ee | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | EE672200000002222227 | pm_insufficientFunds_ee | The payment fails with an `insufficient_funds` failure code. | ### FI | Account Number | Token | Description | | ------------------ | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | FI2112345600000785 | pm_success_fi | The PaymentIntent status transitions from `processing` to `succeeded`. | | FI3712345600000788 | pm_successDelayed_fi | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | FI9112345600000786 | pm_failed_fi | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | FI1012345600000789 | pm_failedDelayed_fi | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | FI6412345600000787 | pm_disputed_fi | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | FI6712345600343434 | pm_exceedsWeeklyVolumeLimit_fi | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | FI2912345600121212 | pm_exceedsWeeklyTransactionLimit_fi | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | FI6712345602222227 | pm_insufficientFunds_fi | The payment fails with an `insufficient_funds` failure code. | ### FR | Account Number | Token | Description | | --------------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | FR1420041010050500013M02606 | pm_success_fr | The PaymentIntent status transitions from `processing` to `succeeded`. | | FR3020041010050500013M02609 | pm_successDelayed_fr | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | FR8420041010050500013M02607 | pm_failed_fr | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | FR7920041010050500013M02600 | pm_failedDelayed_fr | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | FR5720041010050500013M02608 | pm_disputed_fr | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | FR9720041010050000000343434 | pm_exceedsWeeklyVolumeLimit_fr | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | FR5920041010050000000121212 | pm_exceedsWeeklyTransactionLimit_fr | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | FR9720041010050000002222227 | pm_insufficientFunds_fr | The payment fails with an `insufficient_funds` failure code. | ### DE | Account Number | Token | Description | | ---------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | DE89370400440532013000 | pm_success_de | The PaymentIntent status transitions from `processing` to `succeeded`. | | DE08370400440532013003 | pm_successDelayed_de | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | DE62370400440532013001 | pm_failed_de | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | DE78370400440532013004 | pm_failedDelayed_de | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | DE35370400440532013002 | pm_disputed_de | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | DE65370400440000343434 | pm_exceedsWeeklyVolumeLimit_de | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | DE27370400440000121212 | pm_exceedsWeeklyTransactionLimit_de | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | DE65370400440002222227 | pm_insufficientFunds_de | The payment fails with an `insufficient_funds` failure code. | ### GI | Account Number | Token | Description | | ----------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | GI60MPFS599327643783385 | pm_success_gi | The PaymentIntent status transitions from `processing` to `succeeded`. | | GI08RRNW626436291644533 | pm_successDelayed_gi | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | GI41SAFA461293238477751 | pm_failed_gi | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | GI50LROG772261344693297 | pm_failedDelayed_gi | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | GI26KJBC361883934534696 | pm_disputed_gi | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | GI14NWBK000000000343434 | pm_exceedsWeeklyVolumeLimit_gi | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | GI73NWBK000000000121212 | pm_exceedsWeeklyTransactionLimit_gi | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | GI14NWBK000000002222227 | pm_insufficientFunds_gi | The payment fails with an `insufficient_funds` failure code. | ### IE | Account Number | Token | Description | | ---------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | IE29AIBK93115212345678 | pm_success_ie | The PaymentIntent status transitions from `processing` to `succeeded`. | | IE24AIBK93115212345671 | pm_successDelayed_ie | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | IE02AIBK93115212345679 | pm_failed_ie | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | IE94AIBK93115212345672 | pm_failedDelayed_ie | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | IE51AIBK93115212345670 | pm_disputed_ie | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | IE10AIBK93115200343434 | pm_exceedsWeeklyVolumeLimit_ie | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | IE69AIBK93115200121212 | pm_exceedsWeeklyTransactionLimit_ie | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | IE10AIBK93115202222227 | pm_insufficientFunds_ie | The payment fails with an `insufficient_funds` failure code. | ### LI | Account Number | Token | Description | | --------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | LI0508800636123378777 | pm_success_li | The PaymentIntent status transitions from `processing` to `succeeded`. | | LI4408800387787111369 | pm_successDelayed_li | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | LI1208800143823175626 | pm_failed_li | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | LI4908800356441975566 | pm_failedDelayed_li | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | LI7708800125525347723 | pm_disputed_li | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | LI2408800000000343434 | pm_exceedsWeeklyVolumeLimit_li | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | LI8308800000000121212 | pm_exceedsWeeklyTransactionLimit_li | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | LI2408800000002222227 | pm_insufficientFunds_li | The payment fails with an `insufficient_funds` failure code. | ### LT | Account Number | Token | Description | | -------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | LT121000011101001000 | pm_success_lt | The PaymentIntent status transitions from `processing` to `succeeded`. | | LT281000011101001003 | pm_successDelayed_lt | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | LT821000011101001001 | pm_failed_lt | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | LT981000011101001004 | pm_failedDelayed_lt | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | LT551000011101001002 | pm_disputed_lt | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | LT591000000000343434 | pm_exceedsWeeklyVolumeLimit_lt | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | LT211000000000121212 | pm_exceedsWeeklyTransactionLimit_lt | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | LT591000000002222227 | pm_insufficientFunds_lt | The payment fails with an `insufficient_funds` failure code. | ### LU | Account Number | Token | Description | | -------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | LU280019400644750000 | pm_success_lu | The PaymentIntent status transitions from `processing` to `succeeded`. | | LU440019400644750003 | pm_successDelayed_lu | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | LU980019400644750001 | pm_failed_lu | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | LU170019400644750004 | pm_failedDelayed_lu | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | LU710019400644750002 | pm_disputed_lu | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | LU900010000000343434 | pm_exceedsWeeklyVolumeLimit_lu | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | LU520010000000121212 | pm_exceedsWeeklyTransactionLimit_lu | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | LU900010000002222227 | pm_insufficientFunds_lu | The payment fails with an `insufficient_funds` failure code. | ### NL | Account Number | Token | Description | | ------------------ | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | NL39RABO0300065264 | pm_success_nl | The PaymentIntent status transitions from `processing` to `succeeded`. | | NL55RABO0300065267 | pm_successDelayed_nl | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | NL91ABNA0417164300 | pm_failed_nl | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | NL28RABO0300065268 | pm_failedDelayed_nl | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | NL82RABO0300065266 | pm_disputed_nl | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | NL27RABO0000343434 | pm_exceedsWeeklyVolumeLimit_nl | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | NL86RABO0000121212 | pm_exceedsWeeklyTransactionLimit_nl | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | NL55RABO0300065267 | pm_insufficientFunds_nl | The payment fails with an `insufficient_funds` failure code. | ### NO | Account Number | Token | Description | | --------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | NO9386011117947 | pm_success_no | The PaymentIntent status transitions from `processing` to `succeeded`. | | NO8886011117940 | pm_successDelayed_no | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | NO6686011117948 | pm_failed_no | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | NO6186011117941 | pm_failedDelayed_no | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | NO3986011117949 | pm_disputed_no | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | NO0586010343434 | pm_exceedsWeeklyVolumeLimit_no | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | NO0586010343434 | pm_exceedsWeeklyTransactionLimit_no | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | NO0586012222227 | pm_insufficientFunds_no | The payment fails with an `insufficient_funds` failure code. | ### PT | Account Number | Token | Description | | ------------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | PT50000201231234567890154 | pm_success_pt | The PaymentIntent status transitions from `processing` to `succeeded`. | | PT66000201231234567890157 | pm_successDelayed_pt | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | PT23000201231234567890155 | pm_failed_pt | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | PT39000201231234567890158 | pm_failedDelayed_pt | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | PT93000201231234567890156 | pm_disputed_pt | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | PT05000201230000000343434 | pm_exceedsWeeklyVolumeLimit_pt | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | PT64000201230000000121212 | pm_exceedsWeeklyTransactionLimit_pt | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | PT05000201230000002222227 | pm_insufficientFunds_pt | The payment fails with an `insufficient_funds` failure code. | ### ES | Account Number | Token | Description | | ------------------------ | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | ES0700120345030000067890 | pm_success_es | The PaymentIntent status transitions from `processing` to `succeeded`. | | ES2300120345030000067893 | pm_successDelayed_es | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | ES9121000418450200051332 | pm_failed_es | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | ES9300120345030000067894 | pm_failedDelayed_es | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | ES5000120345030000067892 | pm_disputed_es | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | ES1700120345000000343434 | pm_exceedsWeeklyVolumeLimit_es | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | ES7600120345000000121212 | pm_exceedsWeeklyTransactionLimit_es | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | ES1700120345000002222227 | pm_insufficientFunds_es | The payment fails with an `insufficient_funds` failure code. | ### SE | Account Number | Token | Description | | ------------------------ | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | SE3550000000054910000003 | pm_success_se | The PaymentIntent status transitions from `processing` to `succeeded`. | | SE5150000000054910000006 | pm_successDelayed_se | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | SE0850000000054910000004 | pm_failed_se | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | SE2450000000054910000007 | pm_failedDelayed_se | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | SE7850000000054910000005 | pm_disputed_se | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | SE2850000000000000343434 | pm_exceedsWeeklyVolumeLimit_se | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | SE8750000000000000121212 | pm_exceedsWeeklyTransactionLimit_se | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | SE2850000000000002222227 | pm_insufficientFunds_se | The payment fails with an `insufficient_funds` failure code. | ### CH | Account Number | Token | Description | | --------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | CH9300762011623852957 | pm_success_ch | The PaymentIntent status transitions from `processing` to `succeeded`. | | CH8656663438253651553 | pm_successDelayed_ch | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | CH5362200119938136497 | pm_failed_ch | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | CH1843597160341964438 | pm_failedDelayed_ch | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | CH1260378413965193069 | pm_disputed_ch | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | CH1800762000000343434 | pm_exceedsWeeklyVolumeLimit_ch | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | CH7700762000000121212 | pm_exceedsWeeklyTransactionLimit_ch | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | CH1800762000002222227 | pm_insufficientFunds_ch | The payment fails with an `insufficient_funds` failure code. | ### GB | Account Number | Token | Description | | ---------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | GB82WEST12345698765432 | pm_success_gb | The PaymentIntent status transitions from `processing` to `succeeded`. | | GB98WEST12345698765435 | pm_successDelayed_gb | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | GB55WEST12345698765433 | pm_failed_gb | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | GB71WEST12345698765436 | pm_failedDelayed_gb | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | GB28WEST12345698765434 | pm_disputed_gb | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | GB70WEST12345600343434 | pm_exceedsWeeklyVolumeLimit_gb | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | GB32WEST12345600121212 | pm_exceedsWeeklyTransactionLimit_gb | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | GB70WEST12345602222227 | pm_insufficientFunds_gb | The payment fails with an `insufficient_funds` failure code. | #### BACS 直接借记 您可以在*沙盒* (A sandbox is an isolated test environment that allows you to test Stripe functionality in your account without affecting your live integration. Use sandboxes to safely experiment with new features and changes)中使用几个[测试银行账号](https://docs.stripe.com/keys.md#test-live-modes),以确保集成准备就绪。 | 分类代码 | 账号 | 描述 | | ------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | | 108800 | 00012345 | 付款成功,PaymentIntent 从 `processing` 变为 `succeeded`。 | | 108800 | 90012345 | 三分钟后付款成功,PaymentIntent 从 `processing` 变为 `succeeded`。 | | 108800 | 33333335 | 付款被接受,但随后立即因失败代码 `debit_not_authorized` 而失败,且 PaymentIntent 状态从 `processing` 转变为 `requires_payment_method`。授权委托变为 `inactive`,且该 PaymentMethod 无法再次使用。 | | 108800 | 93333335 | 付款在三分钟后因失败代码 `debit_not_authorized` 而失败,且 PaymentIntent 状态从 `processing` 转变为 `requires_payment_method`。授权委托变为 `inactive`,且该 PaymentMethod 无法再次使用。 | | 108800 | 22222227 | 付款失败,并显示失败代码 `insufficient_funds`,PaymentIntent 从 `processing` 变为 `requires_payment_method`。Mandate 仍为 `active`,PaymentMethod 可再次使用。 | | 108800 | 92222227 | 三分钟后付款失败,并显示失败代码 `insufficient_funds`,PaymentIntent 从 `processing` 变为 `requires_payment_method`。Mandate 仍为 `active`,PaymentMethod 可再次使用。 | | 108800 | 55555559 | 三分钟后付款成功,PaymentIntent 从 `processing` 变为 `succeeded`,但会立即创建争议。 | | 108800 | 00033333 | Payment Method 创建成功,但 Mandate 被客户的银行拒绝,并立即变为无效。 | | 108800 | 00044444 | 由于账号无效,Bacs 直接借记设置请求立即失败,并提示客户在提交前更新信息。未收集支付详情。 | | 108800 | 34343434 | 由于支付金额导致账户超过每周支付限额,支付失败了,显示 `charge_exceeds_source_limit` 失败代码。 | | 108800 | 12121212 | 由于支付金额超过账户的交易限额,支付失败了,显示 `charge_exceeds_weekly_limit` 失败代码。 | 测试时,可使用上面提供的任意账号。但是,由于 Bacs 直接借记付款需要几天的处理时间,因此使用延迟三分钟的测试账号可以更好地模拟实时付款的行为。 > 默认情况下,Stripe 会在首次收集付款详情以及每次对其账户扣款时,自动向客户发送[电子邮件](https://docs.stripe.com/payments/payment-methods/bacs-debit.md#debit-notifications)。沙盒中不会发送这些通知。 #### AU BECS 直接借记 通过下列操作,可创建成功或失败的测试`PaymentIntent`: 用下表中的测试`BSB 000000`和测试账号创建测试 *PaymentMethod* (PaymentMethods represent your customer's payment instruments, used with the Payment Intents or Setup Intents APIs)。用`confirmAuBecsDebitPayment`请求中产生的`PaymentMethod`创建测试收款。 ### 测试账号 | BSB 号码 | 账号 | 描述 | | -------- | ----------- | ---------------------------------------------------------------------------------------------------------------- | | `000000` | `000123456` | PaymentIntent 状态从 `processing` 变为 `succeeded`。授权状态仍为 `active`。 | | `000000` | `900123456` | PaymentIntent 状态从 `processing` 变为 `succeeded`(延迟三分钟)。授权状态仍为 `active`。 | | `000000` | `111111113` | PaymentIntent 状态从 `processing` 变为 `requires_payment_method`,并显示 `account_closed` 失败代码。授权状态变为 `inactive`。 | | `000000` | `111111116` | PaymentIntent 状态从 `processing` 变为 `requires_payment_method`,并显示 `no_account` 失败代码。授权状态变为 `inactive`。 | | `000000` | `222222227` | PaymentIntent 的状态从 `processing` 变为 `requires_payment_method`,并显示 `refer_to_customer` 失败代码。授权状态仍为 `active`。 | | `000000` | `922222227` | PaymentIntent 状态从 `processing` 变为 `requires_payment_method`,并显示 `refer_to_customer` 失败代码(延迟三分钟)。授权状态仍为 `active`。 | | `000000` | `333333335` | PaymentIntent 状态从 `processing` 变为 `requires_payment_method`,并显示 `debit_not_authorized` 失败代码。授权状态变为 `inactive`。 | | `000000` | `666666660` | PaymentIntent 状态从 `processing` 变为 `succeeded`,但会立即创建争议。 | | `000000` | `343434343` | 由于支付金额导致账户超过每周支付限额,PaymentIntent 失败,显示 `charge_exceeds_source_limit` 错误。 | | `000000` | `121212121` | 由于支付金额超过账户的交易限额,PaymentIntent 失败了,显示 `charge_exceeds_transaction_limit` 错误。 | #### 其他 对于其他支付方式,测试信息包含在文档中。[查找您的支付方式](https://docs.stripe.com/payments/payment-methods/overview.md)并阅读相关指南,以接受付款并进行测试。 ## 测试 Link > 不要在*沙盒* (A sandbox is an isolated test environment that allows you to test Stripe functionality in your account without affecting your live integration. Use sandboxes to safely experiment with new features and changes) Link 账户中存储真实用户数据。应将这些测试账户视为公开可用,因为它们与您的可发布密钥相关联。 目前,Link 仅支持信用卡、借记卡以及符合条件的美国银行账户购买。Link 需要进行[域名注册](https://docs.stripe.com/payments/payment-methods/pmd-registration.md)。 您可以使用任意有效的电子邮件地址为 Link 创建沙盒账户。下表展示了 Stripe 接受用于沙盒账户身份验证的固定一次性验证码值: | 值 | 结果 | | ------------- | ------------ | | 非下方所列的任意 6 位数 | 成功 | | 000001 | 错误,验证码无效 | | 000002 | 错误,验证码已过期 | | 000003 | 错误,超过了最大尝试次数 | ### 多个资金来源 由于 Stripe 增加了额外的资金来源支持,因此您不需要更新您的集成。Stripe 会自动为它们提供与卡和银行账户支付相同的交易结算时间和担保。 ## 测试基于重定向的流程 要通过模拟使用重定向流程的支付(例如 iDEAL)来测试集成的重定向处理逻辑,请使用[需要重定向](https://docs.stripe.com/payments/payment-methods/payment-method-support.md#additional-api-supportability)的支持性支付方式。 要创建成功或失败的测试`PaymentIntent`: 1. 前往[管理平台中的支付方式设置](https://dashboard.stripe.com/settings/payment_methods),并在您的测试环境中点击**开启**以启用支持的支付方式。 1. 收集付款详情。 1. 向 Stripe 提交付款。 1. 授权测试付款或让其失败。 确保您网站上的页面(对应于`return_url`)提供付款的状态。 ## See also - [测试 Connect 集成应用](https://docs.stripe.com/connect/testing.md) - [测试 Billing 集成应用](https://docs.stripe.com/billing/testing.md) - [测试 Terminal 集成应用](https://docs.stripe.com/terminal/references/testing.md) - [负载测试](https://docs.stripe.com/rate-limits.md#load-testing)