- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 &#39;gift_certificate&#39; is invalid according to its datatype 'String' - The actual length is greater than the MaxLength value.</text></message></messages></ErrorResponse>
โ03-29-2019 10:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
โ04-01-2019 07:20 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
โ04-01-2019 10:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
โ04-01-2019 01:31 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
โ04-01-2019 02:16 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
โ04-01-2019 03:34 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
โ04-03-2019 03:38 PM