Integration and Testing

Authorize.Net API questions and help with your payment integration.

Reply
Contributor
Posts: 37
Registered: ‎05-09-2011

AIM submitting itemized order information

I can't figure out how to submit itemized information. The documentation says authnet handles delimited information with the delimter as "<|>". 

 

i'm using a modified version of john conde's php authorize.net class. 

 

So my script that sets up the transaction i have this snippet:

 

$items = "item1<|>golf balls<|><|>1<|>18.95<|>Y";

$this->authnetaim->setParameter("x_line_item", $items);

 

This works. But i can't figure out how to submit multiple items. 

 

in the authnet class:

function setParameter($field = '', $value = null)

{$this->params[$field] = $value;}

 

And all the parameters get submitted via:

curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($this->params));

 

Anybody got any suggestions?

 

I've tried:

 

$items = "item1<|>golf balls<|><|>1<|>18.95<|>Y";

$items .= "&x_line_item=item1<|>Tennis Raquet<|><|>1<|>18.95<|>Y";

 

But i get the following error:

Line item 1 is invalid. (A value submitted in x_line_item for the item referenced is invalid.)

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

Re: AIM submitting itemized order information

1) Download the latest version of the Authorize.net PHP SDK.

2) Look in the doc folder for a file called AIM.markdown.

 

The PHP layer on top of the XML is fairly simple to learn how to use. You should never have to mess with the sort of thing you're trying to do here, rather you'd be doing something like:

 

$auth->addLineItem(
  'item1', // Item Id
  'Golf tees', // Item Name
  'Blue tees', // Item Description
  '2', // Item Quantity
  '5.00', // Item Unit Price
  'N' // Item taxable
);