Showing results for 
Search instead for 
Did you mean: 

Amex CVV not working in PHP Script - The actual length is greater than the MaxLength

When using an Amex using the provided sample PHP API for charging a credit card, we get the error:

Transaction Failed , The 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:cardCode' element is invalid - The value '#### ' is invalid according to its datatype 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:cardCode' - The actual length is greater than the MaxLength value.

When using the Gateway charge form, Amex is accepted

Is there a reason why it's not accepting 4 digit card codes? Is it possible to change the Max Length? The code looks like:


Thank you,

- David Staschover


If this is the first time you've used Amex, you may need to take an additional set-up step with Authorize Net. I remember reading something in the docs about additional cards requiring some additional set-up.  Call Authorize Net 1.877.447.3938.

Trusted Contributor