Testing

Use the following information to perform all the needed tests and launch your project in production mode using Conekta.

What tests should I do to integrate Conekta?

During the frontend integration, check that:

  • The card number, expiration date, security code (CVC), and the amount are entered correctly in charge.new.
  • In the response manager for charge.create, any error should be considered and handled correctly.
  • Card sensitive information (such as name, expiration date, and CVC) should not be included in the form that you upload to your server.

When testing serverside flows, ensure that:

  • ALl values sent through a form are valid
  • All API errors are handled properly
  • All relevant Conekta Webhooks are handled correctly

Before you begin, also check that your public and private keys are correct. You can find more about keys in your account section.

Which card numbers should be used for testing?

In sandbox mode, you can use the following card numbers to simulate a successful transaction (all other card information can be random):

NUMBER TOKEN ID TYPE OF CARD
4242424242424242 tok_test_visa_4242 Visa
4012888888881881 tok_test_visa_1881 Visa
5555555555554444 tok_test_mastercard_4444 MasterCard
5105105105105100 tok_test_mastercard_5100 MasterCard
378282246310005 tok_test_amex_0005 American Express
371449635398431 tok_test_amex_8431 American Express

The following card numbers produce a specific response and are useful for testing different scenarios:

NUMBER TOKEN ID DESCRIPTION
4000000000000002 tok_test_card_declined The card has been declined.
4000000000000127 tok_test_insufficient_funds The credit limit of the card has been exceeded.
4111111111111111 tok_test_msi_error Simulates Monthly Installments.
  • When using the token tok_test_msi_error, it will return an error (Too much time has elapsed since this charge was tokenized.).
  • When tokenizing the card number 4111111111111111, or any other valid card, if you create a charge within 10 minutes it will return a valid transaction, if it takes more than 10 minutes, it will return an error (The charge was tokenized more than 10 minutes ago. Try again).

Additional validation in sandbox mode: If no customer information is added, it will be assigned a null value.

How I can test specific error codes?

Here we provide some suggestions:

  • Card declined: Use the card number 4000000000000002.
  • Incorrect number: Use a number that fails the Luhn test, for ex. 4242424242424241.
  • Invalid expiry month: Use an invalid month, for ex. 13.
  • Invalid expiry year: Use a past year, for ex. 1982.
  • Invalid cvc: Use a 2-digit number for ex. 99.

The full list of API error codes can be found here.

How do I debug javascript ?

There exist many developer tools to debug client side errors. We recommend using the Chrome Web Inspector. You can also use a debuggable version of conekta.js.

How can I test Conekta’s webhooks ?

Webhooks can be configured in both sandbox and production modes within your admin panel and reconfigured at you wish.