A test card has the format of a real card, but it only works in a provider's sandbox, where the provider scripts the outcome. A real card is linked to an issuer account, and the issuer decides every authorization. Test cards cover most integration testing. One controlled live payment confirms what a sandbox cannot.
A test card and a real card can look identical on a checkout form. Both have a valid card network prefix, a valid length, and a correct check digit. The difference is what stands behind the number. A real card is linked to an account at a card issuer. A test card is linked to nothing but a script in a payment provider's test environment.
A test card is a card number published by a payment provider for use in its sandbox, the provider's non-production environment. The sandbox recognizes the number and returns a predictable result, such as an approval, a specific decline, or a 3D Secure challenge. No money moves and no issuer is involved. Each provider publishes its own list, and a test card from one provider may not work in another provider's sandbox.
A real card is a payment card issued by a bank or other card issuer and linked to a cardholder's account. When it is used, the authorization request travels from the merchant's payment service provider (PSP) through the card network to the issuer. The issuer checks the account, the available funds, and its own risk rules, and then approves or declines. Real card data is sensitive account data and must be protected under PCI DSS wherever it is stored, processed, or transmitted.
The main difference is who decides the outcome. For a test card, the payment provider's sandbox decides, based on rules it publishes. For a real card, the issuer decides, based on the account and its risk models. Most other differences follow from that.
Why do test cards look like real cards?
Test cards look like real cards so that every part of an integration, from the checkout form to the database, handles them the same way. A card number, or primary account number (PAN), has three parts. The first six to eight digits are the issuer identification number (IIN), also called the bank identification number (BIN), which identifies the card network and issuer. The middle digits identify the account, and the last digit is a check digit.
The check digit is calculated with the Luhn algorithm, defined in ISO/IEC 7812-1. It catches typing errors such as one wrong digit. Test cards pass the Luhn check just like real cards, so they pass client-side validation, brand detection, and length checks.
The Luhn check only proves a number is well formed. Roughly one in ten random numbers of the right length passes it, which is why a Luhn-valid number is not a card.
Each kind of card only works in its own environment. A test card used on a live checkout is declined, because the authorization reaches the card network and no issuer account matches the number. A real card used in a sandbox usually fails too, because the sandbox only recognizes the numbers it has scripted.
A number that merely looks valid fails in both places. A generated, Luhn-valid number is unknown to the sandbox and has no issuer account in production. Its security code would also fail: issuers calculate the code from the card number and expiry date using secret cryptographic keys, so a made-up code will not match.
Using a real card in a test environment causes a further problem, even if no money moves. The card data ends up in test logs, databases, and error trackers that were never built to protect cardholder data. That is the main reason to keep real cards out of testing.
A sandbox simulates the issuer, so it cannot reproduce everything an issuer does. Test cards show that an integration handles each outcome correctly. They do not show how real issuers will behave, and some of those differences only appear in production.
The main gaps are these:
This is why many teams run one controlled live payment before launch. A small payment with a company card on the production setup, refunded straight away, confirms that live credentials, routing, and settlement work. It complements sandbox testing and should not replace it.
Test cards should be used for almost all payment testing. A real card belongs in only one place: a single controlled live check before launch or after a major change.
Testing goalUseForm validation, input masks, brand iconsLuhn-valid numbers of each length and card networkSuccessful payment flowThe provider's success test cardDeclines and error handlingThe provider's decline test cards, amounts, or codes3D Secure with and without a challengeThe provider's 3D Secure test cardsRefunds, webhooks, and disputesSandbox payments plus the provider's simulation toolsEvery processor and backup routeEach provider's own test cardsFinal check before launchOne small live payment with a company card, then a refund
Our guide to 3D Secure authentication covers the authentication outcomes worth testing. Our guide to card-on-file transactions explains which stored-card flows need their own tests.
Developers should use the test cards published by the provider whose sandbox they are testing. The numbers below are listed in the Visa Acceptance Solutions testing guide, and several also appear in other providers' documentation. All of them pass the Luhn check. What each one returns depends on the provider.
The guide accepts any expiry date after the current date. Test cards for other card networks, and the specific numbers or amounts that trigger declines and 3D Secure, should come from the provider's own documentation.
Two format details catch many integrations. American Express cards have 15 digits and a 4-digit security code. Mastercard's 2-series range, 222100 to 272099, is missed by older brand-detection rules. Detecting the brand from a maintained BIN table, as described in our article on BIN lookup, avoids both problems.
A few habits cause most testing problems:
Test cards and real cards look the same but answer different questions. Test cards show that an integration handles every outcome. A real card, used once and carefully, shows that the live setup works.