No momento, esta página não está disponível em português
Developer-resource icon

Create test cards

Create custom card numbers to test your integration with Adyen.

Adyen provides generic test card numbers, but you can also generate your own. On the Adyen test platform, you can use the generated test payment cards to simulate real-life payment scenarios and to verify the correct integration of your systems. Transactions carried out with these test cards do not result in actual credits/debits to live accounts.

This functionality requires additional configuration on Adyen's end. To enable it, contact our Support Team

Test card requirements

Generated test cards should meet the following requirements:

  • Test card numbers should be between 6-19 digits long.
  • All test card numbers in a generated test card range need to have the same number of digits.
  • The first six digits of the test card numbers in any generated range need to be valid BIN numbers.
  • Test card numbers should comply with standard payment card number constraints. For example, to test a system with Visa you should create a test card range with a valid Visa BIN.
  • Although the created test card start and end range numbers are not checked for Luhn compliance, if you carry out a test payment the test card is handled like a standard payment card. It undergoes the standard card checks that take place in live environments, including Luhn verification.
  • The billing address details you define for a test card range need to be AVS (Address Verification Service) compliant, i.e. you always need to include at least the street address. Zip code is optional.
  • The billing address check verifies only the numeric characters in the street address and Zip code (if available).

Generating test cards in Customer Area

To generate ranges of test card numbers using the UI, do the following:

  1. Log in to your Customer Area.
  2. Go to Settings > Test cards.
  3. Select Add New Range.
  4. Enter the necessary details in the Test Card Range form.
  5. Select Save.

Generating test cards via API

To create test card ranges using the API, send a request to the /createTestCardRanges endpoint.

Request

Response

Response with an error

If the operation does not complete successfully, a service exception is thrown. See Error handling for more details.

Error handling

After submitting a call, you receive a confirmation that the message was received, and if it was correctly processed. The API returns HTTP status codes and the response message.

For a list of request and response fields, see Response handling.

Test card response handling

Test card generation fails, with a 4XX or 5XX HTTP response, in the following cases:

  • The range start test card number is larger than the end one.
  • The range start and the end test card numbers have different lengths, i.e. they do not have the same amount of digits.
  • The test card numbers are shorter than 6 digits or longer than 19 digits.
  • The test card numbers do not observe BIN code and AVS constraints (see Requirements).
  • If you use a generated test card number to carry out an actual payment, the test card number needs to be Luhn compliant because this check is part of standard behavior in a live environment.

A Luhn compliance error is returned as a 101 Invalid card number fault code. When this happens, you receive a fault response with a description of the problem. In general, your toolkit handles this situation as an exception.

Payment requests that are rejected with an error message are not charged.

Service exceptions

Exception Error Message
Invalid test card range The length of the start of the card range needs to be between 6 and 19 digits long but was {specified_start_range_length_value}.
Invalid test card range The length of the end of the card range needs to be between 6 and 19 digits long but was {specified_end_range_length_value}.
Invalid test card range The length of the start of the card range ({specified_start_range_length_value}) needs to match the length of the end of the card range ({specified_end_range_length_value}).
Invalid test card range The specified range start value {specified_start_value} does not represent a valid number.
Invalid test card range The specified range end value {specified_end_value} does not represent a valid number.
Invalid test card number The specified card {specified_test_card_number} number is invalid.