Barclays epdq pspid integration error : Invalid ItemName field length

时间:2015-09-14 16:10:34

标签: magento payment-gateway

I have integrated barclay card payment into my website and when i do a cardpayment i get the following error message

Invalid ItemName field length: "Product name --- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxburgandy" (54 MIN : 0 MAX : 40)

in the page https://payments.epdq.co.uk/ncol/prod/orderstandard.asp

1 个答案:

答案 0 :(得分:1)

REASON for the error : The error is being caused by the Product name / sku being too long. The parameter is limited to a maximum of 40 characters (including spaces).

In order to resolve this issue, you need to pass an item name that is less than 40 characters long.

SOLUTION:

Before submitting the form to https://payments.epdq.co.uk/ncol/prod/orderstandard.asp just delimit the itemname and id as shown below

//Fix for only 40 characters of length for itemname ITEMNAME*XX* 
                $ordername = substr($ordername, 0, 40); 
                $sku = substr($sku, 0, 15);
//Fix - End
                $html .= '<input type="hidden" name="ITEMID'.$counter.'" value="'.$sku.'">';
                $html .= '<input type="hidden" name="ITEMNAME'.$counter.'" value="'.$ordername.'">';