Showing results for 
Search instead for 
Did you mean: 

Keep Getting Transaction Failed E00003

I keep getting the following error message from the API:


ERROR : Transaction Failed E00003: The 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:cardCode' element is invalid - The value XXXX is invalid according to its datatype 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:cardCode' - The actual length is less than the MinL



The error code resources is a bit vague on the description:

"An error occurred while parsing the XML request."



My implementation is as follow


// Common setup for API credentials
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
$refId = 'ref' . time();


// Remove potential white spaces
$ccn = preg_replace( '/\s+/', '', $ccn );

// Format Date
$exp_date = DateTime::createFromFormat('m / y', $exp);


// Create the payment data for a credit card
$creditCard = new AnetAPI\CreditCardType();
$creditCard->setCardNumber( intval( $ccn ) );
$creditCard->setExpirationDate( $exp_date->format('Y-m') );
$creditCard->setCardCode( intval( $cvc ) );

$paymentOne = new AnetAPI\PaymentType();
$order = new AnetAPI\OrderType();


// Create a transaction
$transactionRequestType = new AnetAPI\TransactionRequestType();


//Assign previous info to the transactionRequest field
$transactionRequestType->setAmount( $amount );
$transactionRequestType->setOrder( $order );
// $transactionRequestType->setBillTo($billto);

$request = new AnetAPI\CreateTransactionRequest();
$request->setRefId( $refId );
$controller = new AnetController\CreateTransactionController($request);
$response_api = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::PRODUCTION);


Am I doing anything wrong?




What value are you testing with for the card code? If you're trying something like "009", that's going to get sent as "9" because of your intval() call.


Try dropping the intval() call and just send it as text, and see if that will help.

All Star