A CVV test response code is the value a payment gateway returns after a sandbox transaction includes a card verification value. The code reports one of three outcomes: the CVV matched, the CVV failed, or the issuer did not run the check. Test cards and test CVV values exist so a developer can force each outcome on demand.

What the CVV check covers

The card verification value is a 3-digit code on Visa, Mastercard, and Discover cards, and a 4-digit code on American Express. The check compares that code against the issuer record as part of an authorization request. It runs separate from the address verification system (AVS) check, which compares billing street number and ZIP code. A gateway can return a CVV result and an AVS result in the same response.

Standard CVV2 result codes

These single-letter codes come from the card networks and appear in gateway response fields such as cvv_result or card_code_response.

  • M: CVV matched.
  • N: CVV did not match.
  • P: CVV not processed.
  • S: CVV should be on the card but the merchant reported it was not provided.
  • U: Issuer unable to process the CVV check.
  • X: No response from the issuer.

Test values that trigger each result

Gateways publish their own test card numbers and test CVV values. Stripe documents card 4000 0000 0000 0127 as a CVC failure in test mode. Authorize.Net publishes sandbox CVV values that map to specific card code responses. Braintree and Adyen publish separate lists. The values are not interchangeable across processors, so read the docs for the gateway in use.

Numeric decline codes tied to CVV failure

Some gateways return a numeric response reason code instead of a letter. Authorize.Net uses a 2xx range for declines. Code 200 means the issuing bank declined the card. Code 205 means the CVV was invalid. Code 315 is reported for a failed card code check. Numbers differ by processor, so a code list from one gateway will not match another.

Why sandbox results differ from production

Sandbox CVV checks are simulated. A test card does not reach the issuer, so the response comes from the gateway rule set. Production results depend on the issuer, the card network, and the region. A sandbox pass does not prove a production pass.

Checklist for testing CVV handling

  1. Confirm which field holds the CVV result in the gateway response.
  2. Run one transaction per result code: match, no match, not processed, unsupported.
  3. Log the raw response before any mapping.
  4. Test the decline path with a CVV failure, not a generic decline.
  5. Check that the customer message does not reveal which check failed.

Compliance note

PCI DSS requirement 3.2 prohibits storing the card verification code after authorization. Test values are not card data, but production code must not log or persist the real value. Route CVV fields away from application logs and database columns at the point of capture.