What should I test as I integrate Stripe?

When using Stripe.js, you should ensure the following:

  • 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 server-side code, you can test the following:

  • All values submitted from the payment form are valid and expected.
  • All API errors are handled properly.
  • Relevant Stripe webhooks are handled correctly (more on how to test webhooks below).

Before you go live, verify your publishable and secret keys. You can see all your keys on your account page.

Account Settings

You can configure your decline settings in https://manage.stripe.com/account.

These allow you to decide whether a failing cvc_check or failing address_zip_check should cause the charge to be rejected. Perhaps surprisingly, even if these details are wrong, the charge can succeed; it's up to you decide what to do in that case.

Note that we don't have a setting for address_line1_check failures to cause a decline, as the data for this particular check tends to be pretty noisy.

We recommend leaving these settings at their defaults unless you have special requirements.


As you integrate and test Stripe, you may find it useful to view logs of your requests.

Which card numbers should I use for testing?

In test mode, you can use these test cards to simulate a successful transaction:

Number Card type
378282246310005American Express
371449635398431American Express
30569309025904Diners Club
38520000023237Diners Club

In addition, these cards will produce specific responses that are useful for testing different scenarios:

Number Description
4000000000000010With default account settings, charge will succeed but address_line1_check and address_zip_check will both fail.
4000000000000028With default account settings, charge will succeed but address_line1_check will fail.
4000000000000036With default account settings, charge will succeed but address_zip_check will fail.
4000000000000044With default account settings, charge will succeed but address_zip_check and address_line1_check will both be unchecked.
4000000000000101With default account settings, charge will succeed but cvc_check will fail if a CVC is entered.
4000000000000341Attaching this card to a Customer object will succeed, but attempts to charge the customer will fail.
4000000000000002Charges with this card will always be declined with a card_declined code.
4000000000000127Charge will be declined with an incorrect_cvc code.
4000000000000069Charge will be declined with an expired_card code.
4000000000000119Charge will be declined with a processing_error code.

Additional test mode validation: By default, passing address or CVC data with the card number will cause the address and CVC checks to succeed. If not specified, the value of the checks will be null. Any expiration date in the future will be considered valid.

How do I test specific error codes?

Some suggestions:

  • card_declined: Use this special card number - 4000000000000002.
  • incorrect_number: Use a number that fails the Luhn check, e.g. 4242424242424241.
  • 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.

The full list of API error codes is available here.

How do I debug 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 at https://js.stripe.com/v2/stripe-debug.js.

How do I test Stripe webhooks?

The Stripe dashboard has a test feature built in. Navigate to your webhook settings and click Test Webhooks. You can select a type of webhook, and one of your test webhook URLs. If you don't have any test webhook URLs defined, you'll have to define one first.

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.

If you'd like to test subscription webhooks with live data, a useful trick is setting the subscription's trial_end attribute to a short time in the future. This ensures you don't have to wait a month to receive an invoice webhook.

How do I test sending transfers?

If you're using Stripe to send third-party transfers, you can use our test bank account numbers and test tax IDs to test sending transfers.