Reply
Highlighted
Member
Posts: 8
Registered: ‎11-02-2010
Accepted Solution

x_line_item= (270) line item 1 is invalid.

Hello-

    I am trying to follow the instructions I found online in terms of formatting with delimiters and am getting the above error with the following syntax.

 

$lineItem = "x_line_item=item1<|>home3<|>Basic (Reuse)<|>$29.99<|>Y&x_line_item=item2<|>4<|>New Basic<|>$49.99<|>Y&";

 

echo "<INPUT type='hidden' name='x_line_item' value='$lineItem' />";

 

All other fields work using PHP so am wondering what is wrong with my syntax or if I am even going about correctly. 

 

Thank you,

Josh


Accepted Solutions
Highlighted
Solution
Accepted by topic author imyourjosh
‎08-21-2015 01:58 AM
Member
Posts: 8
Registered: ‎11-02-2010

Re: x_line_item= (270) line item 1 is invalid.

<?php

while($x != $i){

  $lineItem = $_SESSION['lineItem'][$x];

   echo "<INPUT type=\"hidden\" name=\"x_line_item\" value=\"$lineItem\" />";

   $x++

}

?>

 

$i = the number of individual items purchased.

$x = 0

$_SESSION['lineItem'][$x] = looks like your comment #2.  but is associated with however many items are purchased

 

This works for me!!!

 

Thanks for your help!

Josh

View solution in original post


All Replies
Highlighted
Trusted Contributor
Posts: 264
Registered: ‎09-10-2009

Re: x_line_item= (270) line item 1 is invalid.

Greetings,

 

You have two things wrong with the format of the line item string below that is easily fixable!

 

1) quantity parameter is missing from line item string

2) you may not include a "$" sign inside the amount field

 

Once these items were removed the processing was absolutely flawless.

 

 

Correct Format:

 

 

item1<|>home3<|>Basic (Reuse)<|>1<|>29.99<|>Y

 

Also placing (') single quotes around a PHP variable may cause it not to be evaluated, I would use double quotes please, or remove the single quotes entirely.

 

Thanks!

 

Highlighted
Member
Posts: 8
Registered: ‎11-02-2010

Re: x_line_item= (270) line item 1 is invalid.

Thank you,

Will give this a try and post back with success or more questions. 

Cheers,

Josh

Highlighted
Member
Posts: 8
Registered: ‎11-02-2010

Re: x_line_item= (270) line item 1 is invalid.

item1<|>home3<|>Basic (Reuse)<|>1<|>29.99<|>Y&item2<|>home4<|>Pro (Reuse)<|>1<|>49.99<|>Y&

Does not seem to work for me.  What would I need to format to have x_line_item except multiple items in a single string?

Highlighted
Member
Posts: 8
Registered: ‎11-02-2010

Re: x_line_item= (270) line item 1 is invalid.

I am putting the above line into one $variable and passing it along in the 'hidden' field.

Highlighted
Trusted Contributor
Posts: 264
Registered: ‎09-10-2009

Re: x_line_item= (270) line item 1 is invalid.

Please echo this hidden field and see what you receive. I believe the single quotes you original used around the variable name is causing it not to be read properly.

Highlighted
Member
Posts: 8
Registered: ‎11-02-2010

Re: x_line_item= (270) line item 1 is invalid.

I tried using double quotes and I have also tried piping each line into an array and then using a while loop to post each element in the array.  What I get when I post with only one item purchased from my site is successful and it looks great on the athorize.net credit card page but when I order more than one item invoking a second or third item then I get the (270) line item 1 is invalid.  If I use the while loop and array method I get a (270) per line item vs. just line item 1...

 

 

Highlighted
Trusted Contributor
Posts: 264
Registered: ‎09-10-2009

Re: x_line_item= (270) line item 1 is invalid.

Please post your code for review.

 

Thanks!

Highlighted
Solution
Accepted by topic author imyourjosh
‎08-21-2015 01:58 AM
Member
Posts: 8
Registered: ‎11-02-2010

Re: x_line_item= (270) line item 1 is invalid.

<?php

while($x != $i){

  $lineItem = $_SESSION['lineItem'][$x];

   echo "<INPUT type=\"hidden\" name=\"x_line_item\" value=\"$lineItem\" />";

   $x++

}

?>

 

$i = the number of individual items purchased.

$x = 0

$_SESSION['lineItem'][$x] = looks like your comment #2.  but is associated with however many items are purchased

 

This works for me!!!

 

Thanks for your help!

Josh

Highlighted
Member
Posts: 1
Registered: ‎08-13-2011

Re: x_line_item= (270) line item 1 is invalid.

My site is having the similiar error. I read up on the error and tried to make the necessary corrction, but it is still having the error. Maybe some one can take a look at the web site and advise what exactly needs to be fixed?

 

www.orientairsolution.com