Showing results for 
Search instead for 
Did you mean: 

AIM, C# 1.7SDK - AuthorizeNet Request - Multiple Line Items Not Working




I'm having a difficult time getting multiple lines passed properly in my AuthorizeNet request object. I saw there was a fix for this recently in 1.7 SDK - but I don't know what that fix actually is.


A single line item works fine:


request.Post["x_line_item"] = "1<|>Reservation<|>Event<|>1<|>20<|>F";


But how do I pass multiple line items? I tried a few things:


request.Post["x_line_item"] = "1<|>Reservation<|>Event<|>1<|>20<|>F&x_line_item=2<|>Reservation<|>Event<|>1<|>20<|>F";




request.Post["x_line_item1"] = "1<|>Reservation<|>Event<|>1<|>20<|>F&x_line_item2=2<|>Reservation<|>Event<|>1<|>20<|>F";


Even if I can get the transaction to go through as approved, I don't see the line items ever showing up in my receipt or transaction report.


Any information would be greatly appreciated!





The output needs to be multiple form fields, one per item, all with the name x_line_item. I'm not familiar enough with C# to tell you how to achieve that, however.


Thanks for your response.


Unfortunately, having the same name x_line_item causes the request to be invalid. Using request.Post["x_line_item"], replaces the previous line item. Is there a sample API request string with multiple line items? 

You appear to be accessing the post values directly instead of using the SDK functionality to handle them for you.  The GatewayRequest object (and all of the objects that extend it) includes a "AddLineItem" method which can be called multiple times and automatically handles adding all of the line items.  However, there was actually a bug with this method in version 1.7.0 of the .Net SDK, so make sure you have the newest version (currently 1.7.1).