Reply
Highlighted
Member
Posts: 2
Registered: ‎03-15-2012

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

 

Hi,

 

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";

 

or

 

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!

 

Thanks,

Nirav

Highlighted
Posts: 1,609
Topics: 15
Kudos: 201
Solutions: 121
Registered: ‎06-23-2011

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

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.

Highlighted
Member
Posts: 2
Registered: ‎03-15-2012

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

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? 

Highlighted
Administrator
Posts: 591
Registered: ‎08-21-2009

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

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).