Integration
Test Mode

Test Mode

Flex’s test mode allows you to test your integration without making real charges or payments. This testing environment simulates the creation of real products without risking actual transactions or moving real money.

Test Mode and Use Cases

In test mode, you can process test credit card transactions, create test products and prices, and generate test payment links. You can also use test mode to simulate transactions, ensuring that your integration functions correctly. This feature helps identify any bugs or errors in your Flex implementation before you go live with actual payments.

In the Flex dashboard, you can create test API keys by navigating to the Developers tab, toggling on test mode in the upper right corner, and then creating an API key. These API keys allow you to create and retrieve simulated data by making requests to the Flex API. To start accepting real payments, you need to switch off test mode and use the live API keys in your integration.

Test Mode vs. Production Mode

All Flex API requests occur in either test mode or production mode. API objects in one mode aren’t accessible from the other. For example, a product created in test mode can’t be used in a production transaction.

Test Cards

Flex provides a set of test card numbers you can use to simulate various payment scenarios. These test card numbers allow you to create simulated payments in test mode without processing actual payments or charges.

When using test card numbers, you can enter any expiration date in the future and any three-digit CVC code to simulate a successful payment. To simulate a failed payment, specific test card numbers provided by Flex can be used.

Test card numbers are only valid in test mode. Do not use them for real payments.

Test Cards by Brand


DescriptionNumberCVCExpiration
Visa4242 4242 4242 4242Any 3 digitsAny future date
Visa (debit)4000 0566 5566 5556Any 3 digitsAny future date
Mastercard5555 5555 5555 4444Any 3 digitsAny future date
Mastercard (debit)5200 8282 8282 8210Any 3 digitsAny future date
American Express3782 822463 10005Any 4 digitsAny future date
Discover6011 1111 1111 1117Any 3 digitsAny future date
Discover (debit)6011 9811 1111 1113Any 3 digitsAny future date
JCB3566 0020 2036 0505Any 3 digitsAny future date

Decline Payments


DescriptionNumberError Message
Generic decline4000 0000 0000 0002Your HSA/FSA card was declined.
Insufficient funds decline4000 0000 0000 9995Your card has insufficient funds.
Incorrect CVC decline4000 0000 0000 0127Your HSA/FSA card was declined due to an incorrect CVC.
Incorrect number decline4242 4242 4242 4241Your card number is invalid.
Exceeding velocity limit decline4000 0000 0000 6975Your card was declined for making repeated attempts too frequently.

Invalid data

To simulate errors caused by invalid data, simply enter incorrect details. You don’t need a specific test card for this; any incorrect information will trigger an error. For example:

Invalid expiration month: Enter a non-existent month, such as 13.
Invalid expiration year: Use a year that is more than 50 years in the past, such as 99.
Invalid CVC: Enter a two-digit code, like 88.
Invalid ZIP: Enter a four-digit zip code, like 1234