Support » Plugin: Authorize.Net Payment Gateway WooCommerce Addon » Authorize.Net – Code : Line item 1 is invalid

  • Resolved irfan.muhammad

    (@irfanmuhammad)


    Authorize.net has following limitations.

    The product name MUST be up to 31 chars
    The product name MUST NOT contains some funny chars like curly quote, tm or copyright signs and so on. Try to use a short name containing only letters from the basic alphabet (A-Z a-z).
    The product PRICE must be a positive number (>0)
    The product QUANTITY must be a positive number (>0)

    $item_name = strip_tags($cart_item[‘data’]->get_title());
    $item_name = substr($item_name, 0, 31);

    Can you please update your plugin after applying validations?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author nazrulhassanmca

    (@nazrulhassanmca)

    Hi Irfan,

    Thank you for letting me know i have following code and i am applying it to authorize.net version i have not yet officially released this line item code because before releasing i gather the user feedback like you gave me above and when user testing is done i release a stable version because there are many who might update the plugin and might land in trouble.

    I hope following code would fix any further issues

    
    $i =1;
    foreach ( WC()->cart->get_cart() as $cart_item ) {
    
       $item_name       = substr( strip_tags($cart_item['data']->get_title() ) ,0,30) ;
       $item_quantity   = $cart_item['quantity'];
       $item_price      = $cart_item['data']->get_price();
       $item_taxable    = $cart_item['data']->is_taxable() == true ? 'Y':'N';
    
       if($item_quantity > 0 &&  $item_price > 0 ){
       	
         $sale->addLineItem($i, $item_name, $item_name, $item_quantity, $item_price, $item_taxable);
       }
       $i++;
    }
    
    
    
    Side Note the HTML symbols get accepted  like © but ©  not accepted
    

    I am also having this problem when adding “free” items to the checkout. I am applying your patch, please fix in next release.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Authorize.Net – Code : Line item 1 is invalid’ is closed to new replies.