Gift Cards

What is CVV format testing?

CVV format testing checks that a payment form accepts the 3 or 4 digit card security code in the right field and rejects bad input. It uses test card numbers and fake codes, never real card data. The goal is a form that captures a valid code, sends it to the processor, and keeps it out of logs and storage.

more on this topic

CVV stands for card verification value. Visa uses CVV2, Mastercard uses CVC2, American Express uses CID, and Discover uses a card validation code. The name changes by network. The input rule does not: most cards use 3 digits; American Express uses 4.

CVV Format Standard: A Comprehensive Guide

How should a CVV field work?

A CVV field should accept digits only and show a clear label. It should sit next to the card number field or in the same payment block. It should never appear in a URL, a hidden form field with a readable name like cvv, or a server log.

CVV Format Guide: The Ultimate Guide to CVV Numbers

  • Accept 3 digits for Visa, Mastercard, and Discover.
  • Accept 4 digits for American Express.
  • Reject letters, spaces, dashes, and symbols.
  • Use inputmode=numeric and autocomplete=cc-csc on the input.
  • Mask the value on screen when the user types.

Client-side checks improve the user experience. Server-side checks protect the payment flow. Run both. A browser check can be bypassed; a server check cannot.

What does CVV format testing cover?

CVV format testing covers input rules, error handling, data flow, and storage rules. A complete test plan checks the field on its own and checks what happens after the user submits the form. It also checks the systems that touch the code after submit.

  • Length: 3 digits for most networks, 4 digits for American Express.
  • Character set: digits only. Reject letters, spaces, and punctuation.
  • Empty field: show a clear error and block submit.
  • Paste and autofill: accept valid digits, reject mixed text.
  • Error copy: tell the user what to fix without echoing the code.
  • Network calls: confirm the code goes to the processor over TLS.
  • Logs: confirm the code does not appear in app logs, proxy logs, or error reports.
  • Storage: confirm the code is not written to a database, cache, or file.

Do not treat a card number check as a CVV check. The Luhn algorithm validates the card number. It says nothing about the 3 or 4 digit code. Keep the two checks separate in your test cases.

How do you test CVV format without real cards?

Use a payment processor sandbox and public test card numbers. Test cards let you exercise valid and invalid CVV paths without touching live card data. Never use a real card number in a test environment.

  1. Pick test cards for Visa, Mastercard, American Express, and Discover.
  2. Submit a valid 3 digit code for Visa, Mastercard, and Discover.
  3. Submit a valid 4 digit code for American Express.
  4. Submit a 2 digit code, a 5 digit code, letters, spaces, and a blank field.
  5. Check the error message and the form state after each failure.
  6. Inspect the browser network tab and server logs for leaks.
  7. Check the processor response for approve, decline, and invalid format cases.
  8. Repeat on mobile, desktop, and with autofill enabled.

Use fake values such as 123 for a 3 digit test and 1234 for a 4 digit test. Your processor may require specific test codes for some scenarios. Follow its test documentation for those cases.

What are common CVV testing mistakes?

The most common mistake is using live card data in a test. That puts real cardholders at risk and can break PCI DSS rules. A second mistake is testing one card network and calling the job done. American Express alone proves the 4 digit path; it does not prove the 3 digit path.

  • Logging full request bodies that contain the CVV.
  • Storing the CVV in a database column for convenience.
  • Relying on client-side validation alone.
  • Echoing the CVV back in an error message.
  • Using a card number check as a stand-in for CVV validation.
  • Leaving test keys or sandbox settings in production.

Run a search in your logs for the field name and for 3 or 4 digit strings near card data. Fix any hit before launch. A code review can catch storage paths that a form test will miss.

How does CVV format testing fit PCI DSS?

PCI DSS treats the CVV as sensitive authentication data. Merchants must not store it after authorization. The code may pass through the payment flow, but it should not land in a database, a log, or a backup.

Tokenization helps. The payment processor returns a token that stands in for the card data. Your system stores the token, not the CVV. This keeps the scope of card data small and makes testing safer.

Keep test and production separate. Use test keys in the sandbox and live keys in production. Limit access to payment logs. Review your data flow each time you add a payment feature.

FAQ

Is CVV always 3 digits?

No. Visa, Mastercard, and Discover use 3 digits. American Express uses 4 digits. The field should accept both lengths and route the value to the processor.

Can I store a CVV for repeat payments?

No. PCI DSS forbids storing the CVV after authorization. Use processor tokens or stored card references for repeat payments.

Does a valid CVV format prove the card is real?

No. Format testing only checks the shape of the input. It does not prove the card exists, is active, or belongs to the user. The processor handles authorization.

What is the best test data for CVV fields?

Use public sandbox test cards from your payment processor and fake codes such as 123 or 1234. Do not use real card numbers, even for a quick check.


Fast digital delivery

You will receive the digital voucher immediately.

Secure Payment

All your data is transmitted with unbreakable SSL-RSA encryption.

Suitable for giving away

You can give away, resell or keep the vouchers.

24/7 customer support

We are available for you 24 hours a day.

ProtectedGiftCards.com Newsletter

Be informed as soon as new vouchers are added or when there are discounts.

Read our complete guide: Buy CVV in 2025: A Buyer's Guide to Prices, Pitfalls, and Avoiding Scams