A CVV validation test confirms that your payment integration sends the card verification value to the processor and reacts to the result. You run it in a sandbox with processor-issued test card numbers, never with live card data. The test passes when a matching CVV approves, a wrong CVV declines, and your application surfaces the right message for each case.
Prerequisites
- A sandbox or test account with your payment processor
- Test API keys, not live keys
- The processor's test card table, which lists which card numbers trigger which CVV outcome
- Access to raw gateway responses in your logs
How CVV checking works
The card verification value is a three-digit code on the back of most cards and a four-digit code on the front of American Express cards. The value is not part of the card number and is not printed on the magnetic stripe or chip. When you submit an authorization, the processor forwards the code to the issuing bank, and the bank returns a single-letter result. That letter tells you whether the code matched, failed to match, or could not be checked.
Most processors return the result in a dedicated field, often named cvv_result, card_code_response, or similar. Some gateways fold the result into a general decline reason instead, so read your processor's response reference before you start.
Run a CVV validation test
- Switch your integration to sandbox mode and confirm requests are hitting the test endpoint.
- Open the processor's test card documentation and pick a card number that returns a CVV match.
- Submit an authorization with the card number, a future expiry date, and the CVV field filled.
- Record the response. A match should approve or return a match code, depending on your gateway.
- Submit the same card number again with an incorrect CVV, such as 999.
- Confirm the transaction is declined and the response carries a no-match code rather than a generic failure.
- Submit the card a third time with the CVV field omitted entirely.
- Check that your application handles the missing-code response without throwing an error or retrying the charge.
- Repeat all three cases across card brands, since issuers and processors handle American Express and debit cards differently.
- Log the raw request and response for each run so you can compare codes side by side.
CVV response codes to expect
- M - match, the code is correct
- N - no match, the code is wrong
- P - not processed, the check did not run
- S - the code should have been present but was not
- U - the issuer does not participate in CVV checks
- X - no response from the issuer
Codes P, U, and X are the ones that break most integrations. They are not declines, so a system that treats every non-match as a hard failure will reject valid orders.
What this test does not cover
A sandbox CVV test tells you nothing about your fraud rules, your AVS configuration, or how a real issuer behaves on a specific card. It also does not verify that your storage is compliant. CVV data must never be written to disk, logged, or held after authorization, and your test logs should follow the same rule so the habit carries into production.
Handling the result in your app
Decide in advance which codes block a sale and which codes pass through for manual review. A no-match should stop the transaction. An unsupported or absent response should route to review rather than a silent approval. Write that mapping down, test it, then leave it alone unless the processor changes its codes.