Test Credit and Debit Card Numbers for Every Payment API (2024)

Kyle Pollock for Rapyd

Posted on • Updated on • Originally published at community.rapyd.net

Test Credit and Debit Card Numbers for Every Payment API (4) Test Credit and Debit Card Numbers for Every Payment API (5) Test Credit and Debit Card Numbers for Every Payment API (6) Test Credit and Debit Card Numbers for Every Payment API (7) Test Credit and Debit Card Numbers for Every Payment API (8)

#paymentapi #api #payments #fintech

by Allan MacGregor

When building e-commerce solutions or working with payment processing systems, it’s vital to test the different transaction scenarios to ensure that the payment processing is working as expected. Testing your system to make sure it can handle scenarios where payment transactions fail also helps protect your business and your customers alike.

Payment transactions might fail due to a variety of reasons, and some of the most typical errors include the following:

  • Do not honor
  • Insufficient funds
  • Stolen credit card
  • Identity verification error

You might be wondering, "How do I test these scenarios? Should I use a test card number or an actual card number?”

Although credit card companies have a reserved Bank Identification Number or BIN for test credit cards in an attempt to provide a quasi-universal standard of testing card numbers that can be used on any payment, not all payment gateways follow this convention.

It's always recommended to check your gateway processor for details on the numbers and scenarios they support. Needless to say, test card numbers will only work on sandbox accounts, and fail on live payment gateways. Additionally, enabling sandbox mode will vary from payment processor to payment processor, so it’s recommended to consult their official documentation for more information.

This article provides a list of test credit and debit card numbers that will work on most payment processors and elaborates on the specific scenarios that these numbers will simulate.

Testing Credit and Debit Card Numbers

While there’s a wide variety of situations for testing your payment API, typically you’ll want to cover at least the following scenarios:

  • Successful transactions.
  • Payment errors like do not honor, insufficient funds, and stolen cards.
  • Cardholder disputes.
  • Testing 3D Secure

The numbers and setup discussed in this article are specific to Rapyd payments, but the numbers should work on most APIs and the steps should also be much the same.
<!--HubSpot Call-to-Action Code --><!--[if lte IE 8]><![endif]-->Test Credit and Debit Card Numbers for Every Payment API (9) hbspt.cta.load(5246303, &#39;5fd0724d-a725-4f12-84ac-23227175b99a&#39;, {&quot;useNewLoader&quot;:&quot;true&quot;,&quot;region&quot;:&quot;na1&quot;}); <!-- end HubSpot Call-to-Action Code -->

Numbers for Successful Transactions

A successful transaction is the most typical scenario that you might want to test. Testing a successful translation is useful to confirm that the final stages of your flow are working correctly, like confirmation pages and emails, order reviews, and so on. You can simulate a successful transaction using the following numbers, which will work on any payment processor.

Card NumberCVVExp. DateAmountScenario
4111111111111111AnyAny future dateAnySuccessful Transaction
4462030000000000AnyAny future dateAnySuccessful Transaction

Numbers for Error Transactions

Knowing how your system will handle errors that lead to declined transactions is vital. Transaction errors occur as transactions are being processed, for example, during checkout in an e-commerce store, and typically fall into one of the following categories:

  • Do not honor: Also called an invalid service code error, this indicates that the customer's issuing bank will not validate the transaction with the authorization code provided. There are several possible reasons for this error:

    • The customer has a hold on their card.
    • The card has had multiple denied payments in a row, so it’s temporarily locked.
    • The merchant is operating in a different country than the customer.
    • The transactions were flagged by the bank's anti-fraud system.
  • Stolen card: This indicates that the card has been reported as stolen. If operating in a retail store, the recommended process is to retain the card, deny any goods or services, and immediately call the card issuer.

  • Insufficient funds: The card doesn't have the necessary funds to complete the transaction. This is applicable to credit cards and debit cards.

The numbers for simulating these transaction errors are as follows:

Card NumberCVVExp. DateAmountScenario
4111111111111105AnyAny future dateAnyDo not honor
4111111111111143AnyAny future dateAnyStolen card
4111111111111151AnyAny future dateAnyInsufficient funds

In addition to the above numbers, you can also use a specific transaction amount to simulate the following errors:

  • Payment gateway not responding: This error simulates the payment gateway not responding to the request due to an internal error.
  • Payment expired: Simulates a scenario where the transaction cannot be processed because the payment has expired.
  • Insufficient funds: Simulates an instance of the test credit card not having enough funds to complete the transaction.
  • Processor unavailable: Simulates the payment processor not being available and the transaction failing as result of a network error.
  • Settlement decline: Simulates the transaction failing due to an instance where the payment could not be processed because the settlement amount was declined.

The following table contains the test numbers along with the transaction amount ranges you must enter to simulate these particular errors.

Card NumberCVVExp. DateAmount (in cents)Scenario
4111111111111111AnyAny future date2000 - 2009Settlement decline
4111111111111111AnyAny future date2080 - 2089Processor unavailable
4111111111111111AnyAny future date2120 - 2129Insufficient funds
4111111111111111AnyAny future date2180 - 2189Payment expired
4111111111111111AnyAny future date4000 - 4009Payment gateway not responding

Numbers for Cardholder Disputes

Cardholder disputes is another category of tests that you should consider running on your e-commerce or payment processing system. These occur when the initial transaction has been processed, and the cardholder is then disputing the transaction.

Normally, the customer will open a dispute through their credit card company and the business will receive notification of the dispute and be offered a chance to refute the claim. Cardholder disputes typically fall under one of the following categories:

  • Goods or services not provided: This error indicates that the customer has not received the goods or services they ordered, so they’re disputing the transaction with their credit card company.
  • Subscription canceled: For SaaS companies, customers will often dispute subscription payments claiming the subscription had been canceled.
  • Counterfeit merchandise: This simulates an instance of a fraudulent transaction where the customer claims the merchandise is counterfeit.
  • Credit not processed: A common case for retailers is when customers claim to have a receipt for credit or a voided transaction, but have not yet had their credit processed.

  • Cardholder dispute - miscellaneous: Simulates a generic dispute where the customer has a dispute with the credit card company, but no specific reason is attached.

The numbers for simulating these cardholder disputes are as follows.

Card NumberCVVExp. DateAmount (in cents)Scenario
4539922288211219AnyAny future dateAnyGoods or services not provided
4556028624137080AnyAny future dateAnySubscription canceled
4556942399248726AnyAny future dateAnyCounterfeit merchandise
5374500863109043AnyAny future dateAnyCredit not processed
5132803130357186AnyAny future dateAnyCardholder dispute - miscellaneous

Testing 3D Secure

Another important aspect of credit card processing that’s worth implementing and testing is 3D Secure, or 3DS. This is a feature that verifies the identity of the cardholder before allowing them to complete a transaction, with the aim of adding another layer of security to your payment processing system.

Different payment processors implement 3DS as different products, for example:

  • MasterCard SecureCode
  • Verified by Visa
  • Discover ProtectBuy

With Rapyd, we can simulate 3DS authentication for the following Rapyd Payment API operations:

  • Create payment: Set amount to 1000 or above, while avoiding the amounts listed in the 2000 range for error transactions.
  • Create customer: This request will require 3DS for all payment methods.
  • Add payment method to customer: This request will require 3DS for all payment methods.

Let's go ahead with the API request to create a payment with a 3DS-enabled verification:

Request URL: POST https://sandboxapi.rapyd.net/v1/payments

{ "amount": 1100, "currency": "USD", "payment_method": { "type": "us_visa_card", "fields": { "number": "4111111111111111", "expiration_month": "12", "expiration_year": "25", "cvv": "789", "name": "John Doe" } }, "capture": true}

Once you receive the response, you can check the status, redirect_url, and next_action fields to validate the response and simulate the 3DS redirection flow. For example:

{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "42416643-4159-49a8-8c65-4a17e8d4e489" }, "data": { "id": "payment_46bd13214fe6e7ab9f12f70e64d5743c", "amount": 0, "original_amount": 1050, "is_partial": false, "currency_code": "USD", "country_code": "US", "status": "ACT", // ... "payment_method": "card_761c1a5ce9b7af77f5f6cd539fb1fcbb", "payment_method_data": { "id": "card_761c1a5ce9b7af77f5f6cd539fb1fcbb", "type": "us_visa_card", "category": "card", // ... "next_action": "3d_verification" }, // ... "redirect_url": "https://sandboxcheckout.rapyd.net/3ds-payment?token=payment_46bd13214fe6e7ab9f12f70e64d5743c", // ... "next_action": "3d_verification", // ... },}

Looking at the data section of the response, you can see that the next_action field is set to 3d_verification. This means that the payment processor has requested a 3DS authentication:

  • status: The status of the payment is ACT (active). The payment is active and awaiting completion of 3DS authentication.
  • redirect_url: The URL for 3DS authentication.
  • next_action: The value is 3d_verification. 3DS authentication is required to complete the payment.

As part of the testing, you can open the redirect_url in a new tab and complete the 3DS authentication. Once you open the URL in the browser, you should see the following.

Test Credit and Debit Card Numbers for Every Payment API (10)

From this page, we can simulate the following:

  • 3DS failure: By clicking the Cancel button.
  • 3DS success: By clicking the Continue button.

Conclusion

In this article, you learned the importance of testing your payment processing system regardless of whether you’re a merchant, a SaaS company, or a retailer; testing will ensure your system can correctly process credit and debit cards and protect you against fraud. You also learned about some of the challenges involved with testing your payment processing system and the existence of test credit and debit card numbers.

While every payment processor has their own set of test credit and debit card numbers, and the testing scenarios they support vary, most will support the scenarios we covered in this article.

This article simulated these transactions and errors using Rapyd Payment API, a payment processing API that makes payment processing from a myriad payment methods, such as credit cards, debit cards, and e-wallets, fast and easy.

Test Credit and Debit Card Numbers for Every Payment API (2024)

FAQs

What card number is 4111 1111 1111 1111 CVV? ›

Windcave eCommerce test details

We recommend using the test card 4111 1111 1111 1111 for Visa, 5431 1111 1111 1111 for MasterCard, 3711 1111 1111 114 for Amex, and 3600 0000 0000 08 for Diners. These can be used with any expiry date, 3 digit (4 digit for Amex) CVC and are suitable only for Windcave test accounts.

What test credit card numbers can I use? ›

Payment and Refund Status Codes
Card NumberCard TypePayment Status
5555 5555 5555 4444MasterCardAPPROVED
4012 8888 8888 1881VisaAPPROVED
4111 1111 1111 1111VisaAPPROVED
6011 0009 9013 9424DiscoverAPPROVED
27 more rows

How to test a payment system? ›

How to Test Payment Gateway Performance: Complete checklist
  1. Collect all relevant test data, such as dummy financial information.
  2. Compile payment gateway data from the merchant.
  3. Create a payment processor sandbox to run simulated scenarios.
  4. Develop a list of error codes and document all error events.

What is the test card number for Diners Club? ›

Diners Club - 30569309025904 (Use any 3-digit number for the Card Security Code) Discover - 6011111111111117 (Use any 3-digit number for the Card Security Code) Mastercard - 5555555555554444 (Use any 3-digit number for the Card Security Code)

What is the universal CVV code for Visa cards? ›

Does a CVV have 3 or 4 digits? Most card issuers use a three-digit code on credit and debit cards, including VISA, Mastercard, and Discover. But American Express uses a four-digit CVV. Each CVV is unique to the card and account holder, meaning there's no universal CVV code.

What credit card starts with 4400? ›

4400 – This prefix is commonly associated with Visa branded debit and credit cards issued by various banks. Cards that start with 4400 are part of Visa's extensive network and are widely accepted both domestically and internationally. 5466 – Credit cards that begin with 5466 are typically MasterCard products.

What is the name of the secret number you use with a credit card? ›

A credit card security code is a three- or four-digit number designed to prevent fraudulent transactions. You might hear this code referred to as the Card Verification Value (CVV). Other common names for it include Card Security Code (CSC), Card Verification Code (CVC or CVC2) and Card Identification Number (CID).

What is the algorithm for credit card test? ›

According to Luhn's algorithm, you can determine if a credit card number is (syntactically) valid as follows: 1. Double every second digit from right to left. If this “doubling” results in a two-digit number, subtract 9 from it get a single digit.

What is the algorithm for credit card number checking? ›

The Luhn algorithm works by summing up every other digit in the identification number, starting from the rightmost digit, and then doubling the value of every other digit and summing up the individual digits of the doubled values.

How to test payment APIs? ›

Testing for Payment API
  1. Simulating 3DS Authentication.
  2. Simulating 3DS Authentication - API Method.
  3. Simulating 3DS Authentication - Hosted Page.
  4. Card Numbers for Testing.
  5. Error Simulation.
  6. Simulating Rapyd Verify Application Responses.

What is passive payment testing? ›

Passive Real Payments Testing

Testers don't directly execute the payment process but instead share their payment methods, including full card details or login accesses to e-wallets, through a specialized and encrypted interface with the customer. The actual testing is then managed by the customers themselves.

How do I create a dummy payment gateway? ›

How do I create a dummy payment gateway for testing?
  1. Create a Make-Believe Checkout Counter: Design a fake checkout counter on your computer. ...
  2. Make Up Some Credit Cards: Create imaginary credit card numbers, expiration dates, and security codes.
Dec 5, 2023

What does mm yy mean? ›

All banks follow a four-digit MM/YY format for expiry dates, where 'MM' is the month and 'YY' is the year. For example, a credit card expiring in May 2026 would show '05/26'. Credit cards generally expire at the end of the month listed in the expiry.

Is vccgenerator real? ›

The generator creates valid credit card numbers that follow real credit rules, but they're not real cards. They can't be used to make actual purchases, but they're perfect for testing payment systems or for development and educational purposes.

What is the format of a diner credit card number? ›

Credit Card Number (Diner's Club) is a 14-digit number beginning with 300–305, 36, 38, or 39 and might have dashes (hyphens) or spaces as separators. For example, NNNN-NNNNNN-NNNN or NNNN NNNNNN NNNN.

What is the format of a diners club credit card number? ›

Credit Card Number (Diner's Club) is a 14-digit number beginning with 300–305, 36, 38, or 39 and might have dashes (hyphens) or spaces as separators. For example, NNNN-NNNNNN-NNNN or NNNN NNNNNN NNNN.

What is the ccv2 card number? ›

CVV2/CVC2/CID is a security feature for transactions where your credit card is not physically present. It is a three or four digit value which provides our payment system with a check of your credit card's authenticity. The terms are generally used interchangeably.

Which number is Amex CVV? ›

For American Express (Amex), a four-digit CVV number is printed on the front of the card immediately beginning above the last digit of the card's account number.

What is CVC2 number on Visa card? ›

Information What does the CVV / CVC / CVC2 number mean? CVV / CVC / CVC2 for Visa and MasterCard is the final three digits of the number printed on the signature strip on the back of your card. What is an e-Visa?

Top Articles
Latest Posts
Article information

Author: Rubie Ullrich

Last Updated:

Views: 5834

Rating: 4.1 / 5 (72 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Rubie Ullrich

Birthday: 1998-02-02

Address: 743 Stoltenberg Center, Genovevaville, NJ 59925-3119

Phone: +2202978377583

Job: Administration Engineer

Hobby: Surfing, Sailing, Listening to music, Web surfing, Kitesurfing, Geocaching, Backpacking

Introduction: My name is Rubie Ullrich, I am a enthusiastic, perfect, tender, vivacious, talented, famous, delightful person who loves writing and wants to share my knowledge and understanding with you.