cancel
Showing results for 
Search instead for 
Did you mean: 

Line Item 1 is invalid.

Hi all,

I'm  using anet java sdk3.1's AIM.

here is the problem.

when I post the datas to anet, if there's some chinese, then the response always error .

       datas: 

x_country=US&x_method=CC&x_delim_data=TRUE&x_fax=&x_city=CITY&x_cust_id=12333&x_relay_response=FALSE&x_company=&x_version=3.1&x_address=ADDR&x_amount=50.00&x_last_name=LAST&x_type=AUTH_CAPTURE&x_zip=POSTAL&x_customer_ip=&x_encap_char=&x_tran_key=************&x_description=JoyTravel-Order&x_allow_partial_Auth=FALSE&x_phone=PHONE&x_card_num=4111111111111111&x_exp_date=122012&x_state=STATE&x_login=4jrQ7Sj2V&x_first_name=FIRST&x_invoice_num=1332908503122&x_test_request=FALSE&x_delim_char=%7C&x_email=313114030%40qq.com&x_line_item=Item+id<|>%E4%BA%A7%E5%93%81%E5%90%8D%E7%A7%B0<|><|>2.00<|>999.23<|>FALSE

 

response:

3|1|270|(TESTMODE) Line item 1 is invalid.|000000|P|0|1332908503122|JoyTravel-Order|50.00|CC|auth_capture|12333|FIRST|LAST||ADDR|CITY|STATE|POSTAL|US|PHONE||313114030@qq.com||||||||||||||448D94D5DF02E4CD66C918273A636A62|||||||||||||XXXX1111|||||||||||||||||

 

if there's no chinese, then it will be ok.my local encoding is GBK, I tried to change my encoding to UTF8, but still not working.

so I need your help, somebody help me, plz.

 

jamestorn
Member
4 REPLIES 4

and the response reason code is RRC_3_270, 

jamestorn
Member

Haven't experimented with this sort of thing myself, but when you say change your encoding to UTF-8, what do you mean? I would suggest using the iconv extension:

http://us2.php.net/manual/en/book.iconv.php

http://us2.php.net/manual/en/function.iconv.php

The regular conversion functions in PHP don't handle GBK real well, according to the php.net documentation posts.

 

EDIT: In this instance. It could be that Authorize.net is first checking the length of the field, which in this case would be 37 characters if it's looking at it as ASCII rather than a URL-encoded string. What happens if you remove one of the Chinese characters?

TJPride
Expert

I'm using Java, not PHP...

 

Change my encoding to UTF-8 means change my AnetUtil.java's text file encoding to UTF-8.

 

and, even just have one chinese Chinese character. still the error.

 

here is the last post with one Chinese character's debug output.

 

 

15:39:43,859 DEBUG SingleClientConnManager:195 - Get connection for route HttpRoute[{s}->https://secure.authorize.net]
15:39:46,331 DEBUG RequestAddCookies:131 - CookieSpec selected: best-match
15:39:46,350 DEBUG DefaultHttpClient:481 - Attempt 1 to execute request
15:39:46,350 DEBUG DefaultClientConnection:244 - Sending request: POST /gateway/transact.dll HTTP/1.1
15:39:46,358 DEBUG wire:78 - >> "POST /gateway/transact.dll HTTP/1.1[EOL]"
15:39:46,361 DEBUG wire:78 - >> "Content-Type: application/x-www-form-urlencoded; charset=utf-8[EOL]"
15:39:46,362 DEBUG wire:78 - >> "Content-Length: 582[EOL]"
15:39:46,362 DEBUG wire:78 - >> "Host: secure.authorize.net[EOL]"
15:39:46,363 DEBUG wire:78 - >> "Connection: Keep-Alive[EOL]"
15:39:46,363 DEBUG wire:78 - >> "User-Agent: Apache-HttpClient/4.0.1 (java 1.5)[EOL]"
15:39:46,364 DEBUG wire:78 - >> "Expect: 100-Continue[EOL]"
15:39:46,364 DEBUG wire:78 - >> "[EOL]"
15:39:46,365 DEBUG headers:248 - >> POST /gateway/transact.dll HTTP/1.1
15:39:46,365 DEBUG headers:251 - >> Content-Type: application/x-www-form-urlencoded; charset=utf-8
15:39:46,365 DEBUG headers:251 - >> Content-Length: 582
15:39:46,366 DEBUG headers:251 - >> Host: secure.authorize.net
15:39:46,366 DEBUG headers:251 - >> Connection: Keep-Alive
15:39:46,366 DEBUG headers:251 - >> User-Agent: Apache-HttpClient/4.0.1 (java 1.5)
15:39:46,367 DEBUG headers:251 - >> Expect: 100-Continue
15:39:48,369 DEBUG wire:78 - >> "x_country=US&x_method=CC&x_delim_data=TRUE&x_fax=&x_city=CITY&x_cust_id=12333&x_relay_response=FALSE&x_company=&x_version=3.1&x_address=ADDR&x_amount=50.00&x_last_name=LAST&x_type=AUTH_CAPTURE&x_zip=POSTAL&x_customer_ip=&x_encap_char=&x_tran_key=76t2RbZnsY389BjZ&x_description=JoyTravel-Order&x_allow_partial_Auth=FALSE&x_phone=PHONE&x_card_num=4111111111111111&x_exp_date=122012&x_state=STATE&x_login=4jrQ7Sj2V&x_first_name=FIRST&x_invoice_num=1332920383364&x_test_request=FALSE&x_delim_char=%7C&x_email=313114030%40qq.com&x_line_item=Item+id<|>%E5%95%8A<|><|>2.00<|>999.23<|>FALSE"
15:39:48,632 DEBUG wire:78 - << "HTTP/1.1 200 OK[EOL]"
15:39:48,638 DEBUG wire:78 - << "Connection: close[EOL]"
15:39:48,638 DEBUG wire:78 - << "Date: Wed, 28 Mar 2012 07:39:51 GMT[EOL]"
15:39:48,639 DEBUG wire:78 - << "Server: Microsoft-IIS/6.0[EOL]"
15:39:48,640 DEBUG wire:78 - << "X-Powered-By: ASP.NET[EOL]"
15:39:48,640 DEBUG wire:78 - << "Content-Type: text/html[EOL]"
15:39:48,642 DEBUG wire:78 - << "Content-Length: 257[EOL]"
15:39:48,643 DEBUG wire:78 - << "[EOL]"
15:39:48,645 DEBUG DefaultClientConnection:229 - Receiving response: HTTP/1.1 200 OK
15:39:48,646 DEBUG headers:232 - << HTTP/1.1 200 OK
15:39:48,646 DEBUG headers:235 - << Connection: close
15:39:48,647 DEBUG headers:235 - << Date: Wed, 28 Mar 2012 07:39:51 GMT
15:39:48,648 DEBUG headers:235 - << Server: Microsoft-IIS/6.0
15:39:48,648 DEBUG headers:235 - << X-Powered-By: ASP.NET
15:39:48,648 DEBUG headers:235 - << Content-Type: text/html
15:39:48,650 DEBUG headers:235 - << Content-Length: 257
15:39:48,658 DEBUG wire:78 - << "3|1|270|(TESTMODE) Line item 1 is invalid.|000000|P|0|1332920383364|JoyTravel-Order|50.00|CC|auth_capture|12333|FIRST|LAST||ADDR|CITY|STATE|POSTAL|US|PHONE||313114030@qq.com||||||||||||||448D94D5DF02E4CD66C918273A636A62|||||||||||||XXXX1111|||||||||||||||||"
15:39:48,659 DEBUG SingleClientConnManager:250 - Releasing connection org.apache.http.impl.conn.SingleClientConnManager$ConnAdapter@14fdb00d
15:39:48,659 DEBUG SingleClientConnManager:268 - Released connection open but not reusable.
15:39:48,659 DEBUG DefaultClientConnection:141 - Connection shut down
15:39:48,661 DEBUG HttpClient:93 - Url-decoded response data: 3|1|270|(TESTMODE) Line item 1 is invalid.|000000|P|0|1332920383364|JoyTravel-Order|50.00|CC|auth_capture|12333|FIRST|LAST||ADDR|CITY|STATE|POSTAL|US|PHONE||313114030@qq.com||||||||||||||448D94D5DF02E4CD66C918273A636A62|||||||||||||XXXX1111|||||||||||||||||

 

My bad, don't know why I was thinking PHP. Have you tried encoding the character before passing it, such that it's encoded twice (once by the API)? This might avoid Authorize.net rejecting characters that it doesn't like, since you'd effectively only be passing % and numbers. Given, it wouldn't be as pretty in the control panel or emails, but anything displayed by you could be decoded and displayed properly.