Stripe test cards are used for testing Stripe integration. The objective is attained by using test card numbers and other information to ensure planned integration.
What is a Stripe test card?
A Stripe test card is used to simulate a successful payment in different geographies. Stripe test card is also used to test Stripe integration. Stripe test cards use predetermined card numbers to validate that the business system works for payment validity, global payments, regulatory card payments, and providing invalid payment information. These cards work in an environment that has Stripe set to test mode.
Every business needs to protect itself from fraudulent activities and misuse of cards. If the test mode is on in a production environment, Stripe test cards could be misused at the time of Stripe testing integration. Therefore, Stripe platform users need to confirm that the production environment is not enabled for Stripe test mode.
What types of test cards does Stripe provide for testing?
Stripe provides a variety of cards for testing, which more or less covers the entire gamut of card testing. Most Stripe cards verify the card numbers only; zip codes and CVC aren't verified. Let us look at the different types of Stripe test cards:
- Commonly used test cards – Under this category, 14 options are available for different card brands. Stripe test card list comprises American Express (two variants), Diners Club (16 digits), Diners Club (14 digits), Discover (two variants), JCB, Mastercard, Mastercard (two series), Master (debit card), Mastercard (prepaid), UnionPay, Visa, and Visa (debit card).
- Global test cards – These cards can be used in Africa, America, the Asia-Pacific region, Europe, and the Middle East.
- Regulatory or 3D secure cards – The card issuer provides two-factor authentication to customers while making payments.
- Cards to test for specific responses – These types of cards are used when declining transactions for reasons such as insufficient funds, incorrect PIN, incorrect billing address, invalid expiry month or year, etc.
- Cartes Bancaires test cards – This method is used for French card payment co-branded with Mastercard or Visa.
- Disputes – In case of disputes, the card issuer records a formal dispute, and the payment is provisionally reversed. However, the card issuer's decision is final and binding on the customer.
- Direct debits – Stripe generates direct debit mandates for businesses to present to customers, enabling direct debits after customer acceptance.
How to use Stripe test cards
It’s essential to use given or regulatory test card numbers to ensure test integration works as planned. The information could be used to trigger different flows during the integration process and dealt with accordingly. If services of a developer are not engaged, then hire a Stripe-certified expert or use a ready-made solution created by one of Stripe-verified partners without writing a code for the purpose.
Payment Intents API: This flow is used along with Stripe’s client libraries and Software Development Kit (SDK) to ensure that:
- Authentication flows get triggered when needed using regulatory test card numbers and payment methods.
- No authentication is required for the default US card 4242 4242 4242 4242.
- Authentication needed when using card no 4000 0027 6000 3184.
- To avoid creation of inadvertent duplicate payment intents for the same purchase, create a payment intent, using idempotency key.
- Ensure that errors are picked up and displayed appropriately in the User Interface.
Charges API: The second flow is using the Charges API with Stripe’s client libraries and Software Development Kits (SDKs) to ensure that:
- To create token in the submit handler, the card element is passed on correctly.
- Create a token response handler that handles and displays card errors appropriately.
- Only valid token goes through the server as part of the payment form submission.
Server-side code: This method is the third flow to ensure that:
- All requests go through successfully. While testing integration, it would prove useful to see accounts' events and logs.
- All API errors are handled appropriately.
- Webhooks concerned are handled properly.
While making integration live, test if publishable and secret API keys are to be substituted with live ones. Post integration, test keys can’t be used for processing live payments.
Commonly used Stripe test cards
Real card information can't be used in the test mode. One can use any of the following Stripe test card numbers, any random CVC number, and a valid future expiry date to create a successful payment. The billing country for any of the 14 basic numbers in the Stripe test card list stated below is set as the USA by default.
International Stripe test cards
In addition to the US, Asia-Pacific and Australian regions, there are 31 more countries in Africa, Europe and the Middle East where different international Stripe test card numbers are used to simulate successful card payments.
3D Secure test card numbers
Regional regulations such as Strong Customer Authentication (SCA) affect card data test payments. Setup Intents API can be used to test saved cards.
Authentication is required for one-time and other on-session payments. For previously set up cards, off-session payments will succeed.
All cards don't support 3D Secure; such customers are redirected to the authentication page of the card issuer. The Stripe test card information to be used for testing 3D Secure payments, which are created directly in the Stripe Dashboard, won't be redirected to 3D Secure.
All Visa and Master Stripe test cards, other than those stated under column 3D Secure usage, don't require authentication from the customer's card issuer. Please refer to the Stripe test cards link to access card information under the sub-heading, 'Testing For Specific Responses And Errors', 'Cartes Bancaires Test Card Numbers', and 'Disputes' test cards to simulate the respective transactions.
Why should you test with multiple cards?
Since customers could use basic cards, international cards, 3D Secure cards, and Cartes Bancaires cards issued by different brands under the Stripe card testing list stated in Table I to III, it's essential to carry out testing with multiple cards to ensure that genuine transactions go through a seamless payment process. If multiple cards are not tested, chances of payment failures or card declines increase, thus inconveniencing customers.
What is the testing mode in Stripe?
In test mode, one can issue cards and simulate purchases using one's Stripe integration. This means testing integration before going live without making actual purchases.
How can you enable test mode in Stripe?
After accessing Stripe, open the main menu using the icon at the top of the home screen. Then tap Settings to locate the Test Mode option and tap the toggle key to enable it.
Can you use Stripe test cards in production?
No, if the test mode is active in a production environment, Stripe test cards may be misused for fraudulent purchases. If it has to be tested in production, then the company's own live payment mode can be used.
Can you use a Stripe card in live mode?
No, Stripe test card numbers don't function in live mode. If a fraudster knows about Stripe test card usage in the live mode, it's possible to steal information from the company or users.