Search

Are you looking for test card numbers?

Would you like to contact support?

Developer-resource icon

Custom test cards

Learn how you can generate custom card numbers for testing 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 the 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. Sign in to your Customer Area.
  2. Go to Account > 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

{
  "accountCode":"TestMerchant",
  "accountTypeCode":"MerchantAccount",
  "testCardRanges":[
    {
      "TestCardRange":{
        "rangeStart":"5232492669190772",
        "rangeEnd":"5232492670020681",
        "expiryDates":[
          {
            "ExpiryDate":{
              "expiryMonth":"JANUARY",
              "expiryYear":"2020"
            }
          }
        ],
        "cvc":"123",
        "cardHolderName":"S Hopper",
        "address":{
          "streetAddress":"1 Infinite Loop, Cupertino",
          "zip":"CA 95014"
        },
        "threeDUsername":"simonhopper",
        "threeDPassword":"mypassword",
        "threeDDirectoryServerResponse":"Y"
      }
    },
    {
      "TestCardRange":{
        "rangeStart":"4596123423450871",
        "rangeEnd":"4596123434560780",
        "expiryDates":[
          {
            "ExpiryDate":{
              "expiryMonth":"MARCH",
              "expiryYear":"2021"
            }
          }
        ],
        "cvc":"321",
        "cardHolderName":"T Anderson",
        "address":{
          "streetAddress":"42, End of the Universe Rd., Los Alamos",
          "zip":"NM 87544"
        },
        "threeDUsername":"thomasanderson",
        "threeDPassword":"mypassword",
        "threeDDirectoryServerResponse":"Y"
      }
    }
  ]
}
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soap:Body>
      <createTestCardRanges xmlns="http://testcard.services.adyen.com">
         <request>
            <accountCode>TestMerchant</accountCode>
            <accountTypeCode>MerchantAccount</accountTypeCode>
            <testCardRanges>
               <TestCardRange>
                  <rangeStart>5232492670020681</rangeStart>
                  <rangeEnd>5232492669190772</rangeEnd>
                  <expiryDates>
                     <expiryMonth>JANUARY</expiryMonth>
                     <expiryYear>2020</expiryYear>
                  </expiryDates>
                  <cvc>123</cvc>
                  <cardHolderName>S Hopper</cardHolderName>
                  <address>
                     <streetAddress>1 Infinite Loop, Cupertino</streetAddress>
                     <zip>CA 95014</zip>
                  </address>
                  <threeDUsername>simonhopper</threeDUsername>
                  <threeDPassword>mypassword</threeDPassword>
                  <threeDDirectoryServerResponse>Y</threeDDirectoryServerResponse>
               </TestCardRange>
               <TestCardRange>
                  <rangeStart>4596123434560780</rangeStart>
                  <rangeEnd>4596123423450871</rangeEnd>
                  <expiryDates>
                     <expiryMonth>MARCH</expiryMonth>
                     <expiryYear>2021</expiryYear>
                  </expiryDates>
                  <cvc>321</cvc>
                  <address>
                     <streetAddress>42, End of the Universe Rd., Los Alamos</streetAddress>
                     <zip>NM 87544</zip>
                  </address>
                  <cardHolderName>T Anderson</cardHolderName>
                  <threeDUsername>thomasanderson</threeDUsername>
                  <threeDPassword>mypassword</threeDPassword>
                  <threeDDirectoryServerResponse>Y</threeDDirectoryServerResponse>
               </TestCardRange>
            </testCardRanges>
         </request>
      </createTestCardRanges>
   </soap:Body>
</soap:Envelope>

Response

{  
   "rangeCreationResults":[  
      {  
         "TestCardRangeCreationResult":{  
            "cardNumberRangeStart":"5232492669190772",
            "cardNumberRangeEnd":"5232492670020681",
            "creationResultCode":"ALREADY_EXISTS"
         }
      },
      {  
         "TestCardRangeCreationResult":{  
            "cardNumberRangeStart":"4596123423450871",
            "cardNumberRangeEnd":"4596123434560780",
            "creationResultCode":"ALREADY_EXISTS"
         }
      }
   ]
}
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="http://testcard.services.adyen.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soap:Body>
      <ns0:createTestCardsResponse>
         <ns0:result>
            <ns0:rangeCreationResults>
               <ns0:TestCardRangeCreationResult>
                  <ns0:cardNumberRangeEnd>5232492669190772</ns0:cardNumberRangeEnd>
                  <ns0:cardNumberRangeStart>5232492670020681</ns0:cardNumberRangeStart>
                  <ns0:creationResultCode>ALREADY_EXISTS</ns0:creationResultCode>
               </ns0:TestCardRangeCreationResult>
               <ns0:TestCardRangeCreationResult>
                  <ns0:cardNumberRangeEnd>4596123423450871</ns0:cardNumberRangeEnd>
                  <ns0:cardNumberRangeStart>4596123434560780</ns0:cardNumberRangeStart>
                  <ns0:creationResultCode>ALREADY_EXISTS</ns0:creationResultCode>
               </ns0:TestCardRangeCreationResult>
            </ns0:rangeCreationResults>
         </ns0:result>
      </ns0:createTestCardsResponse>
   </soap:Body>
</soap:Envelope>

Response with an error

{
    "errorType" : "security",
    "errorCode" : "901",
    "message" : "Invalid Merchant Account",
    "status" : "403"
}
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soap:Body>
    <soap:Fault>
      <faultcode>soap:Server</faultcode>
      <faultstring>security 901 Invalid Merchant Account</faultstring>
    </soap:Fault>
  </soap:Body>
</soap:Envelope>

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.