Testing

Before taking your integration live, use the following information to test it thoroughly. If you need help after reading this, check out our answers to common questions or chat live with other developers in #stripe on freenode.

When using Stripe.js, you should ensure that:

  • The card number, expiration, CVC and amount are set correctly in createToken
  • In the response handler for createToken, card errors are handled and displayed properly
  • Only a valid token is passed to your server as part of payment form submission
  • Sensitive card details (number, expiration and CVC) are not included in form data submitted to your server

In your server-side code, you should ensure that:

  • All values submitted from the payment form are valid and expected
  • All requests are being made successfully. You may find it useful to view your account's events and logs as you test your integration.
  • All API errors are handled properly
  • Relevant webhooks are handled correctly

When you're ready to take your integration live, make sure that you replace your test publishable and secret API keys with live ones. Live payments cannot be processed if your integration is still using your test API keys. You can find your API key information in your account settings.

Test card numbers

Genuine card information cannot be used in test mode. Instead, use any of the following test cards to create a successful payment:

Number Brand
4242424242424242 Visa
4012888888881881 Visa
4000056655665556 Visa (debit)
5555555555554444 Mastercard
5200828282828210 Mastercard (debit)
5105105105105100 Mastercard (prepaid)
378282246310005 American Express
371449635398431 American Express
6011111111111117 Discover
6011000990139424 Discover
30569309025904 Diners Club
38520000023237 Diners Club
3530111333300000 JCB
3566002020360505 JCB

International test card numbers

You can use any of the following test cards to simulate a successful transaction for different issuing countries. For countries that have separate domestic and international pricing (e.g., Australia), the fee calculated for test card payments is at the international rate.

Number Country Brand
4000000760000002 Brazil (BR) Visa
4000001240000000 Canada (CA) Visa
4000004840000008 Mexico (MX)) Visa
Number Country Brand
4000000400000008 Austria (AT) Visa
4000000560000004 Belgium (BE)) Visa
4000002080000001 Denmark (DK) Visa
4000002460000001 Finland (FI) Visa
4000002500000003 France (FR) Visa
4000003720000005 Ireland (IE) Visa
4000003800000008 Italy (IT) Visa
4000004420000006 Luxembourg (LU) Visa
4000005280000002 Netherlands (NL) Visa
4000005780000007 Norway (NO) Visa
4000006200000007 Portugal (PT) Visa
4000006430000009 Russian Federation (RU) Visa
4000007240000007 Spain (ES) Visa
4000007520000008 Sweden (SE) Visa
4000007560000009 Switzerland (CH) Visa
4000008260000000 United Kingdom (GB) Visa
4000058260000005 United Kingdom (GB) Visa (debit)
Number Country Brand
4000000360000006 Australia (AU) Visa
4000001560000002 China (CN) Visa
4000003440000004 Hong Kong (HK) Visa
4000003920000003 Japan (JP) Visa
4000005540000008 New Zealand (NZ) Visa
4000007020000003 Singapore (SG) Visa

Testing for specific responses and errors

The following test cards can be used to create payments that produce specific responses—useful for testing different scenarios and error codes. Verification checks only run when the required information is provided (e.g., for cvc_check to fail, a CVC code must be provided).

Number Description
4000000000000077 Charge succeeds and funds will be added directly to your available balance (bypassing your pending balance).
4000000000000093 Charge succeeds and domestic pricing is used (other test cards use international pricing). This card is only significant in countries with split pricing.
4000000000000010 The address_line1_check and address_zip_check verifications fail. If your account is blocking payments that fail ZIP code validation, the charge is declined.
4000000000000028 Charge succeeds but the address_line1_check verification fails.
4000000000000036 The address_zip_check verification fails. If your account is blocking payments that fail ZIP code validation, the charge is declined.
4000000000000044 Charge succeeds but the address_zip_check and address_line1_check verifications are both unavailable.
4000000000000101 If a CVC number is provided, the cvc_check fails. If your account is blocking payments that fail CVC code validation, the charge is declined.
4000000000000341 Attaching this card to a Customer object succeeds, but attempts to charge the customer fail.
4000000000009235 Charge succeeds with a risk_level of elevated and placed into review.
4000000000000002 Charge is declined with a card_declined code.
4100000000000019 Charge is declined with a card_declined code and a fraudulent reason.
4000000000000127 Charge is declined with an incorrect_cvc code.
4000000000000069 Charge is declined with an expired_card code.
4000000000000119 Charge is declined with a processing_error code.
4242424242424241 Charge is declined with an incorrect_number code as the card number fails the Luhn check.

By default, passing address or CVC data with the card number causes the address and CVC checks to succeed. If this information isn't specified, the value of the checks is null. Any expiration date in the future is considered valid.

You can also provide invalid card details to test specific error codes resulting from incorrect information being provided. For example:

  • invalid_expiry_month: Use an invalid month (e.g. 13)
  • invalid_expiry_year: Use a year in the past (e.g. 1970)
  • invalid_cvc: Use a two digit number (e.g. 99)

Bitcoin

In test mode, you can use the following test emails (set on BitcoinReceiver objects) to test different edge cases. By default, a receiver is always paid 3 seconds after creation.

Email Description
{any_prefix}+fill_never@{any_domain} Bitcoin are never sent to the receiver address.
{any_prefix}+fill_now@{any_domain} The next time that the receiver is retrieved after creation, it has been filled by bitcoin.

Debugging JavaScript

There are many tools for tracking down problems in your client side code. We recommend reading about the Chrome Web Inspector. Should you need it, you can also load a debug version of Stripe.js from https://js.stripe.com/v2/stripe-debug.js.

Disputes

In test mode, you can use the test card below to simulate a disputed transaction:

Number Description
4000000000000259 With default account settings, charge succeeds, only to be disputed.

The following evidence, when submitted in the uncategorized_text, produces specific actions that are useful for testing the dispute flow:

Evidence Description
winning_evidence The dispute is closed and marked as won. Your account is credited the amount of the charge and related fees.
losing_evidence The dispute is closed and marked as lost. Your account is not be credited.

Managed Accounts

Use these test routing and account numbers, debit card numbers, and tax IDs to trigger certain events during your testing of Managed Accounts. The following bank account details can only be used when creating or updating Managed Accounts via the API in test mode.

Routing numbers

Number Type
110000 STRIPE TEST BANK AU routing number
11000-000 STRIPE TEST BANK CA routing number
108800 STRIPE TEST BANK GB sort code
1100000 STRIPE TEST BANK JP routing number
1100-000 STRIPE TEST BANK SG routing number
110-000 STRIPE TEST BANK HK routing number
110000000 STRIPE TEST BANK US routing number

Account numbers

Number Type
000123456789 Transfer succeeds.
000111111116 Transfer fails with a no_account code.
000111111113 Transfer fails with an account_closed code.
000222222227 Transfer fails with an insufficient_funds code.
000333333335 Transfer fails with a debit_not_authorized code.
000444444440 Transfer fails with an invalid_currency code.
Number Type
000123456 Transfer fails succeed.
111111116 Transfer fails with a no_account code.
111111113 Transfer fails with an account_closed code.
222222227 Transfer fails with an insufficient_funds code.
333333335 Transfer fails with a debit_not_authorized code.
444444440 Transfer fails with an invalid_currency code.
Number Type
00012345 Transfer succeeds.
11111116 Transfer fails with a no_account code.
11111113 Transfer fails with an account_closed code.
22222227 Transfer fails with an insufficient_funds code.
33333335 Transfer fails with a debit_not_authorized code.
44444440 Transfer fails with an invalid_currency code.
Number Type
00012345 Transfer succeeds.
11111116 Transfer fails with a no_account code.
11111113 Transfer fails with an account_closed code.
22222227 Transfer fails with an insufficient_funds code.
33333335 Transfer fails with a debit_not_authorized code.
44444440 Transfer fails with an invalid_currency code.

These test IBANs work for any EU country and any valid currency for that country. The IBANs specified here are German IBANs. However, you can simply replace DE with the country of your choosing. See here for country codes.

Number Type
DE89370400440532013000 Transfer succeeds.
DE62370400440532013001 Transfer fails with a no_account code.
DE89370400440532013002 Transfer fails with an account_closed code.
DE89370400440532013003 Transfer fails with an insufficient_funds code.
DE89370400440532013004 Transfer fails with a debit_not_authorized code.
DE89370400440532013005 Transfer fails with an invalid_currency code.
Number Type
000123456 Transfer succeeds.
111111116 Transfer fails with a no_account code.
111111113 Transfer fails with an account_closed code.
222222227 Transfer fails with an insufficient_funds code.
333333335 Transfer fails with a debit_not_authorized code.
444444440 Transfer fails with an invalid_currency code.
Number Type
000123-456 Transfer succeeds.
111111-116 Transfer fails with a no_account code.
111111-113 Transfer fails with an account_closed code.
222222-227 Transfer fails with an insufficient_funds code.
333333-335 Transfer fails with a debit_not_authorized code.
444444-440 Transfer fails with an invalid_currency code.
Number Type
000000001234567897 Transfer succeeds.
000000111111111117 Transfer fails with a no_account code.
000000111111111133 Transfer fails with an account_closed code.
000000222222222224 Transfer fails with an insufficient_funds code.
000000333333333331 Transfer fails with a debit_not_authorized code.
000000444444444448 Transfer fails with an invalid_currency code.

Debit card numbers

Use these test debit card numbers to test transfers to a debit card. These can only be used with test secret keys.

Number Type
5200828282828210 Mastercard debit. Transfer succeeds.
4000056655665556 Visa debit. Transfer succeeds.
4000056655665564 Visa debit. Transfer fails with a could_not_process code.

Tax IDs

Pass in any name and one of these tax IDs (valid as both SSN or EIN) for the desired verification behavior.

Number Type
000000000 Successful verification
000000001 Successful verification as a non-profit
111111111 Unsuccessful verification (identity mismatch)

Rate limits

It is extremely unlikely for users to experience any rate limits with normal usage of the API, even at high volume. The most common causes for a user to experience rate limits are bugs, bulk data fetches, or extreme load testing.

Should your requests begin to receive 429 HTTP errors, reduce the frequency of your requests. Each failed request is perfectly safe to retry as rate limiting takes place before any other action and prevents the request from being processed. When reducing your request frequency, we recommend an exponential backoff by first waiting one second before trying again. If your request continues to receive the same response, wait two seconds, then four seconds, etc.

Rate limits for both test and live modes are identical. Requests made in test mode are an accurate representation of what to expect when making live requests. If you are experiencing rate limits but are unable to determine why, please let us know.

Webhooks

You can send test webhooks to your integration's endpoint within your account's webhooks settings. The event data contained within one of these test webhooks is fabricated and not available in the APIā€“its purpose is only to test that your endpoint is working and configured correctly.

To fully test your integration, perform actions using the API in test mode that results in legitimate webhooks being sent. For instance, creating a charge triggers the charge.succeeded webhook that contains the charge data. The resulting event data can then be verified using the API.

If you don't have a server set up to receive webhooks but want to see example webhook requests, we suggest using a service like RequestBin to inspect the requests we send.