cancel
Showing results for 
Search instead for 
Did you mean: 

Length of productCode field is too short

Hi,

 

I have integrated in the Level III but am running into a problem. The length of the productCode field is a maximum of 15 but many of the values listed are longer than 15. 

 

Specifically gift_certificate is 16 characters long. When I run a transaction for a gift_certificate it returns the error: The 'AnetApi/xml/v1/schema/AnetApiSchema. xsd:productCode' element is invalid - The value 'gift_certificate' is invalid according to its datatype 'String' - The actual length is greater than the MaxLength value.

 

Here is the XML response:

<?xml version="1.0" encoding="utf-8"?><ErrorResponse xmlns:xsi="http://www.w3. org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><messages><resultCode>Error</ resultCode><message><code>E00003</code><text>The 'AnetApi/xml/v1/schema/AnetApiSchema. xsd:productCode' element is invalid - The value &amp;#39;gift_certificate&amp;#39; is invalid according to its datatype 'String' - The actual length is greater than the MaxLength value.</text></message></messages></ErrorResponse>

rassydawg
Member
6 REPLIES 6
@rassydawg

For your integration, is the productCode something that authorize needs to accurately process the transaction? I would imagine not. If not, the solution for you is to just pass the product code under a different API property. So if you do not currently pass anything under invoice number, just pass the product code under that. Or go down the list of API properties and pick any one that accepts strings with a large enough character length for you to use.
Renaissance
All Star

Thanks for the reply. This is a required field for Level III processing. Here is the API Doc: https://developer.authorize.net/api/reference/features/level_iii.html#ItemRelated_API_Fields

 

productCode String, up to 15 characters.

One of the following: 

adult_content
coupon
default
electronic_good
electronic_software
gift_certificate
handling_only
service
shipping_and_handling
shipping_only
subscription

Defaults to default if blank or absent. The type of product purchased.

Level III Required by Visa and Mastercard.

 

I don't see how sending this in a different field would even remotely get the data in the right place. The only values from the list we use are default and gift_certificate. So I guess I'll have to change them all to be "default" until this is fixed.

@rassydawg

I see now. I was wondering where that API property came from. I haven’t used Level III. Your issue is not that the gift_certificate value has characters in excess of what is allowed. The error you printed indicates that you are not passing gift_certificate but that you are passing ‘gift_cerificate’

Those extra single quotes are causing the error. Authorize is doing an html entities sanitization on what you post, and when it converts those single quotes it ups the character length. So in whatever language you are using, axe those single quotes and you should be fine.

This is what I'm sending:

 

<lineItems>
<lineItem>
<itemId>NoSKUDefinedItem0</itemId>
<name>E-mail Gift Certificate</name>
<quantity>1</quantity>
<unitPrice>50.00</unitPrice>
<taxable>false</taxable>
<taxAmount>0.00</taxAmount>
<totalAmount>50.00</totalAmount>
<productCode>gift_certificate</productCode>
<taxIncludedInTotal>false</taxIncludedInTotal>
</lineItem>
</lineItems>

No quotes.

Somehow it ends up in single quotes with auth.net. Or maybe their error message is being sanitized. That’s funny.

Hello,

 

You are correct that the Authorize.Net API does not accept all of the allowable values for the Level III field productCode. Specifically, the length of the following allowable values is greater than the stated 15 character field length:

  • electronic_software (19 chars)
  • gift_certificate (16 chars)
  • shipping_and_handling (21 chars)

We apologize for this oversight and have logged a change request with our internal teams. Until a fix is in place, you may leave the productCode field blank or set it to "default" (without quotes).

 

Thank you.

 

 

Vladimir

vladimir
Authorize.Net Developer Authorize.Net Developer
Authorize.Net Developer