cancel
Showing results for 
Search instead for 
Did you mean: 

Error "Card Code is required"? Why is it not recognizing that I'm passing CCV?

TJPride
Expert
5 REPLIES 5
There's no way to know without you giving us more information. It's probably a coding issue so if you show us your code we may be able to spot the issue for you.

-------------------------------------------------------------------------------------------------------------------------------------------
John Conde :: Certified Authorize.Net Developer (Brainyminds) :: Official Authorize.Net Blogger

NEW! Handling Authorize.Net's Webhooks with PHP

Integrate Every Authorize.Net JSON API with One PHP Class (Sample code included)

Tutorials for integrating Authorize.Net with PHP: AIM, ARB, CIM, Silent Post
All About Authorize.Net's Silent Post
stymiee
Expert
Expert

If is in C# you must fill CardCode thats the CVV.

Edisonsan8
Member

What the heck? I spent 15 minutes last night carefully documenting both the back-end code and my output, the stupid form must have erased my post because it's buggy on my older Mac (or because it contained code, I'm not sure). I'm posting on my PC now just to make absolutely sure my code doesn't get dumped again. I also note, by the way, that the text box width is far wider than the allowed display area, so it scrolls to the right while I type rather than allowing me to see the whole thing. This is even on my PC.

 

Back-end code, written in PHP:

 

if ($_POST['submitted'] && !$errors) {
    $authorize = new AuthorizeNetAIM(
        $GLOBALS['_authorize_id'], $GLOBALS['_authorize_key']);
    $authorize->setSandbox(true);
       
    $fields = array(
        'first_name' => $_POST['first'],
        'last_name' => $_POST['last'],
        'company' => $_POST['company'],
        'address' => $_POST['address'],
        'city' => $_POST['city'],
        'state' => $_POST['state'],
        'zip' => $_POST['zip'],
        'country' => 'US',

        'phone' => $_POST['phone'],
        'email' => $_POST['email'],

        'customer_ip' => $_SERVER['REMOTE_ADDR'],

        'amount' => $_POST['amount'],

        'card_num' => $_POST['card_number'],
        'exp_date' => sprintf('%02d%02d', $_POST['card_exp_month'], ($_POST['card_exp_year'] % 1000)),
        'cardholder_authentication_value' => $_POST['card_ccv']
    );
    print_r($fields);
    $authorize->setFields($fields);
    $authorize->setCustomField('payment_type', 'SINGLE');


    $result = $authorize->authorizeAndCapture();
    print_r($result);
}

 

And And output (I've edited anything I wouldn't want people getting their hands on):

 

(
    [first_name] => Theodore
    [last_name] => Pride
    [company] => My Company Name
    [address] => My Address Here
    [city] => Fenton
    [state] => MO
    [zip] => 63026
    [country] => US
    [phone] => (636) 555-5555
    [email] => myemail@mydomain.com
    [customer_ip] => 1.2.3.4
    [amount] => 1.99
    [card_num] => 1234567890123456
    [exp_date] => 0515
    [cardholder_authentication_value] => 724
)
...AuthorizeNetAIM_Response Object
(
    [_response_array:private] => Array
        (
            [0] => 3
            [1] => 2
            [2] => 33
            [3] => (TESTMODE) Card Code is required.
            [4] => 000000
            [5] => P
            [6] => 0
            [7] => 
            [8] => 
            [9] => 1.99
            [10] => CC
            [11] => auth_capture
            [12] => 
            [13] => Theodore
            [14] => Pride
            [15] => My Company Name
            [16] => My Address here
            [17] => Fenton
            [18] => MO
            [19] => 63026
            [20] => US
            [21] => (636) 555-5555
            [22] => 
            [23] => myemail@mydomain.com
            [24] => 
            [25] => 
            [26] => 
            [27] => 
            [28] => 
            [29] => 
            [30] => 
            [31] => 
            [32] => 
            [33] => 
            [34] => 
            [35] => 
            [36] => 
            [37] => 4674B1424DE7D0987E99C1X6804016BE
            [38] => 
            [39] => 
            [40] => 
            [41] => 
            [42] => 
            [43] => 
            [44] => 
            [45] => 
            [46] => 
            [47] => 
            [48] => 
            [49] => 
            [50] => XXXX1234
            [51] => Visa
            [52] => 
            [53] => 
            [54] => 
            [55] => 
            [56] => 
            [57] => 
            [58] => 
            [59] => 
            [60] => 
            [61] => 
            [62] => 
            [63] => 
            [64] => 
            [65] => 
            [66] => 
            [67] => 
            [68] => SINGLE
        )

    [approved] => 
    [declined] => 
    [error] => 1
    [held] => 
    [response_code] => 3
    [response_subcode] => 2
    [response_reason_code] => 33
    [response_reason_text] => (TESTMODE) Card Code is required.
    [authorization_code] => 000000
    [avs_response] => P
    [transaction_id] => 0
    [invoice_number] => 
    [description] => 
    [amount] => 1.99
    [method] => CC
    [transaction_type] => auth_capture
    [customer_id] => 
    [first_name] => Theodore
    [last_name] => Pride
    [company] => My Company Name
    [address] => My Address Here
    [city] => Fenton
    [state] => MO
    [zip_code] => 63026
    [country] => US
    [phone] => (636) 555-5555
    [fax] => 
    [email_address] => myemail@mydomain.com
    [ship_to_first_name] => 
    [ship_to_last_name] => 
    [ship_to_company] => 
    [ship_to_address] => 
    [ship_to_city] => 
    [ship_to_state] => 
    [ship_to_zip_code] => 
    [ship_to_country] => 
    [tax] => 
    [duty] => 
    [freight] => 
    [tax_exempt] => 
    [purchase_order_number] => 
    [md5_hash] => 4634B1424DEX0987E99C1C6804016BE
    [card_code_response] => 
    [cavv_response] => 
    [account_number] => XXXX1234
    [card_type] => Visa
    [split_tender_id] => 
    [requested_amount] => 
    [balance_on_card] => 
    [response] => |3|,|2|,|33|,|(TESTMODE) Card Code is required.|,|000000|,|P|,|0|,||,||,|1.99|,|CC|,|auth_capture|,||,|Theodore|,|Pride|,|My Company Name|,|My Address Here|,|Fenton|,|MO|,|63026|,|US|,|(636) 555-5555|,||,|myemail@mydomain.com|,||,||,||,||,||,||,||,||,||,||,||,||,||,|46X4B1424DE7D0987E99C1B6804016BEE|,||,||,||,||,||,||,||,||,||,||,||,||,|XXXX1234|,|Visa|,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,|SINGLE|
    [payment_type] => SINGLE
    [error_message] => AuthorizeNet Error:
                Response Code: 3
                Response Subcode: 2
                Response Reason Code: 33
                Response Reason Text: (TESTMODE) Card Code is required.
                
)

 

The error in this case may have something to do with what I named the CCV field (cardholder_authentication_value). But I couldn't find any alternatives, unless I was looking in the wrong places.

TJPride
Expert

Bump for today. Really need this solved.

Ok, well I was experimenting with everything I could think of, and apparently card_code is accepted. Would have been nice to have the answer a couple days ago, however.