Jump to content

Authorize.net Error ... AuthorizeAIM : Bill To City is required.


Recommended Posts

I have a new fresh install of prestashop with one of the free templates. I installed the Authorize.net module and entered the api information for my Authorize.net account that I use for another shop. I keep getting the same error when testing checkout.

 

Error detail from AuthorizeAIM : Bill To City is required.

 

I've tried everything I can think of and can't get it to work. Is this a common error? Anyone know how I can get this fixed?

 

Thanks!

Link to comment
Share on other sites

Thanks for your reply! I turned off the AVS address verification and it still happened. I contacted authorize.net and they told me i have to give them the error string and i'm not sure where to find that. I don't see anything in the authorize.net side so it seems like it is just not going anywhere. I have an ssl installed and the api from authorize.net I'm using is working on my other site fine. You can give it a try at kitsuperstore.com if you want to see the error. Thanks again!

Link to comment
Share on other sites

I'm using the out of the box authorize.net module in the newest prestashop download. Do I need to download a newer version of that module somewhere? I was able to fix this error and now I have a new error. :)

 

To fix open validation.php and add this line:

'x_city' => Tools::safeOutput($invoiceAddress->city),

 

But now I get this error: Error detail from AuthorizeAIM : Bill To State/Province is required.

 

I tried to do the same thing and add state and country but I am not naming it correctly i guess. Any idea the names for these parms? Here is what I tried and it failed still.

'x_state' => Tools::safeOutput($invoiceAddress->state),

'x_country' => Tools::safeOutput($invoiceAddress->country),

 

Thanks!

Link to comment
Share on other sites

Here is the part of the code that passes those parm. I just need to know what prestashop names the city and country to write it correctly i think.

 

$params = array(

'x_test_request' => (bool)Configuration::get('AUTHORIZE_AIM_DEMO'),

'x_invoice_num' => (int)$_POST['x_invoice_num'],

'x_amount' => number_format((float)$cart->getOrderTotal(true, 3), 2, '.', ''),

'x_exp_date' => Tools::safeOutput($_POST['x_exp_date_m'].$_POST['x_exp_date_y']),

'x_address' => Tools::safeOutput($invoiceAddress->address1.' '.$invoiceAddress->address2),

'x_zip' => Tools::safeOutput($invoiceAddress->postcode),

'x_first_name' => Tools::safeOutput($customer->firstname),

'x_last_name' => Tools::safeOutput($customer->lastname),

'x_version' => '3.1',

'x_delim_data' => true,

'x_delim_char' => '|',

'x_relay_response' => false,

'x_type' => 'AUTH_CAPTURE',

'x_method' => 'CC',

'x_solution_id' => 'A1000006',

'x_login' => Tools::safeOutput(Configuration::get('AUTHORIZE_AIM_LOGIN_ID')),

'x_tran_key' => Tools::safeOutput(Configuration::get('AUTHORIZE_AIM_KEY')),

'x_card_num' => Tools::safeOutput($_POST['x_card_num']),

'x_card_code' => Tools::safeOutput($_POST['x_card_code']),

);

 

 

I added this and it worked for city.

'x_city' => Tools::safeOutput($invoiceAddress->city),

 

I tried to do the same thing and add state and country but I am not naming it correctly i guess. Any idea the names for these parms? Here is what I tried and it failed still.

'x_state' => Tools::safeOutput($invoiceAddress->state),

'x_country' => Tools::safeOutput($invoiceAddress->country),

Link to comment
Share on other sites

Ok so i just went and turned all the AVS checks off in my authorize.net admin and I still got the same error. It seems like authorize.net is expecting these fields to be passed. I'm not sure how to call them from prestashop. I know the field names from authorize.net AIM integration document but I can't find what prestashop uses?

 

Error detail from AuthorizeAIM : Bill To State/Province is required.

 

Thanks for the replies!

Link to comment
Share on other sites

Well that makes perfect sense then good call! :)

 

Does anyone know how to call all these fields in prestashop? I'm new to prestashop and not sure where to look.

  • First Name
  • Last Name
  • Address
  • City
  • State
  • Zip Code
  • Country
  • Phone
  • Email

Anyone out there have a shop using a wells fargo authorize.net account? If you can post that small spot of code it would be a huge help. Thanks!

Link to comment
Share on other sites

Ok i found a way to make an order go through, but all the fields that are not in the list at /modules/authorizeaim/validation.php do not get passed and in authorize.net it is a lot of blanks.

 

If anyone knows how to pass all these fields I would still really like to be passing them if you can offer the code.

 

For everyone else, the way to get your order to pass this error is in authorize.net admin. Go to Account --> Payment Form --> Form Fields. Then just unselect the check boxes for state and country. This will make it something not required but you will end up with empty fields on the authorize.net side so when you are working in there you won't have the customer info you need.

Link to comment
Share on other sites

I seem to have fixed this problem on my end by adding the following code to "modules/authorizeaim/validation.php:

 

'x_city' => Tools::safeOutput($invoiceAddress->city),

'x_state' => Tools::safeOutput($invoiceAddress->id_state),

 

Note "$invoiceAddress->id_state", you can't use "$invoiceAddress->state" becuase "state" does not exist in the database. This will send authorize.net the state id. I don't think authorize.net uses this information but it is a filler to send them and it fixes my problem.

 

I just did this on a new install of prestashop 1.4.9 but I am curious to know if this works for previous versions as well.

Link to comment
Share on other sites

  • 1 year later...

I have the same problem. 

I have input 2 lines for city and country which work fine however its asking for email and im not sure what that is, can anyone help?

 

'x_city' => Tools::safeOutput($invoiceAddress->city),
'x_country' => Tools::safeOutput($invoiceAddress->country),
'x_email' => Tools::safeOutput($invoiceAddress->email),
Link to comment
Share on other sites

  • 10 months later...

Can anyone help please?

 

I know this was a long time ago but I have just installed the authorize.net module and I am having the same problem.

 

I am still getting Error detail from AuthorizeAIM : Bill To Country is required.

 

I have added the city line as above and also added a country line but nothing seems to work. I have also tried un-ticking the Country line in the authorize.net form data.

 

Lines I have added to validation.php:

 

'x_city' => Tools::safeOutput($invoiceAddress->city),
‘x_country’ => Tools::safeOutput($invoiceAddress->id_country),

 

All versions are up to date.

 

Thanks

Link to comment
Share on other sites

  • 3 months later...

After the latest update it again didn't work for me, this is what i added to fix it again:

 
'x_city' => Tools::safeOutput($invoiceAddress->city),
'x_state' => Tools::safeOutput($invoiceAddress->id_state),
'x_country' => Tools::safeOutput($invoiceAddress->country),
'x_email' => Tools::safeOutput($customer->email),
 
Regards Frank
Link to comment
Share on other sites

  • 3 months later...

Hello, I am also experiencing the same problem.

First of all i found absurd that the uffical authorize module doesn't handle this properly. 

Anyway I have added to /public_html/modules/authorizeaim/validation.php this code

 

'x_city' => Tools::safeOutput($invoiceAddress->city),
'x_state' => Tools::safeOutput($invoiceAddress->id_state),
'x_country' => Tools::safeOutput($invoiceAddress->country),
'x_email' => Tools::safeOutput($customer->email),
 
as specified in the last post, but now I get another error which reads: "Country must be a valid three-character value if specified."
 
Does anyone know how to sove this?
Link to comment
Share on other sites

  • 2 months later...

I don't think there's an easy fix since the three letter ISO country code is not even stored anywhere in the Prestashop DB.

 

Here's my very ugly, hardcoded fix which might or might not work for other users:

 

To the params array, add:

 

'x_country' => getIsoCode($invoiceAddress->id_country),

 

And before the array definition, insert this function:

 

function getIsoCode($id) {
    switch($id) {
    case 40: return "AND";
    case 217: return "ARE";
    case 231: return "AFG";
    case 43: return "ATG";
    case 42: return "AIA";
    case 230: return "ALB";
    case 45: return "ARM";
    case 157: return "ANT";
    case 41: return "AGO";
    case 232: return "ATA";
    case 44: return "ARG";
    case 39: return "ASM";
    case 2: return "AUT";
    case 24: return "AUS";
    case 46: return "ABW";
    case 244: return "ALA";
    case 47: return "AZE";
    case 233: return "BIH";
    case 51: return "BRB";
    case 50: return "BGD";
    case 3: return "BEL";
    case 60: return "BFA";
    case 236: return "BGR";
    case 49: return "BHR";
    case 62: return "BDI";
    case 54: return "BEN";
    case 179: return "BLM";
    case 55: return "BMU";
    case 59: return "BRN";
    case 34: return "BOL";
    case 58: return "BRA";
    case 48: return "BHS";
    case 56: return "BTN";
    case 234: return "BVT";
    case 57: return "BWA";
    case 52: return "BLR";
    case 53: return "BLZ";
    case 4: return "CAN";
    case 239: return "CCK";
    case 71: return "COD";
    case 66: return "CAF";
    case 72: return "COG";
    case 19: return "CHE";
    case 32: return "CIV";
    case 240: return "COK";
    case 68: return "CHL";
    case 64: return "CMR";
    case 5: return "CHN";
    case 69: return "COL";
    case 73: return "CRI";
    case 75: return "CUB";
    case 65: return "CPV";
    case 238: return "CXR";
    case 76: return "CYP";
    case 16: return "CZE";
    case 1: return "DEU";
    case 77: return "DJI";
    case 20: return "DNK";
    case 78: return "DMA";
    case 79: return "DOM";
    case 38: return "DZA";
    case 81: return "ECU";
    case 86: return "EST";
    case 82: return "EGY";
    case 226: return "ESH";
    case 85: return "ERI";
    case 6: return "ESP";
    case 87: return "ETH";
    case 7: return "FIN";
    case 90: return "FJI";
    case 88: return "FLK";
    case 146: return "FSM";
    case 89: return "FRO";
    case 246: return "FRA";
    case 8: return "FRA";
    case 91: return "GAB";
    case 17: return "GBR";
    case 95: return "GRD";
    case 93: return "GEO";
    case 241: return "GUF";
    case 101: return "GGY";
    case 94: return "GHA";
    case 97: return "GIB";
    case 96: return "GRL";
    case 92: return "GMB";
    case 102: return "GIN";
    case 98: return "GLP";
    case 84: return "GNQ";
    case 9: return "GRC";
    case 196: return "SGS";
    case 100: return "GTM";
    case 99: return "GUM";
    case 103: return "GNB";
    case 104: return "GUY";
    case 22: return "HKG";
    case 106: return "HMD";
    case 108: return "HND";
    case 74: return "HRV";
    case 105: return "HTI";
    case 143: return "HUN";
    case 111: return "IDN";
    case 26: return "IRL";
    case 29: return "ISR";
    case 114: return "IMN";
    case 110: return "IND";
    case 235: return "IOT";
    case 113: return "IRQ";
    case 112: return "IRN";
    case 109: return "ISL";
    case 10: return "ITA";
    case 116: return "JEY";
    case 115: return "JAM";
    case 117: return "JOR";
    case 11: return "JPN";
    case 119: return "KEN";
    case 123: return "KGZ";
    case 63: return "KHM";
    case 120: return "KIR";
    case 70: return "COM";
    case 180: return "KNA";
    case 121: return "PRK";
    case 28: return "KOR";
    case 122: return "KWT";
    case 237: return "CYM";
    case 118: return "KAZ";
    case 124: return "LAO";
    case 126: return "LBN";
    case 181: return "LCA";
    case 130: return "LIE";
    case 197: return "LKA";
    case 128: return "LBR";
    case 127: return "LSO";
    case 131: return "LTU";
    case 12: return "LUX";
    case 125: return "LVA";
    case 129: return "LBY";
    case 152: return "MAR";
    case 148: return "MCO";
    case 147: return "MDA";
    case 150: return "MNE";
    case 182: return "MAF";
    case 134: return "MDG";
    case 140: return "MHL";
    case 133: return "MKD";
    case 138: return "MLI";
    case 61: return "MMR";
    case 149: return "MNG";
    case 132: return "MAC";
    case 163: return "MNP";
    case 141: return "MTQ";
    case 142: return "MRT";
    case 151: return "MSR";
    case 139: return "MLT";
    case 35: return "MUS";
    case 137: return "MDV";
    case 135: return "MWI";
    case 145: return "MEX";
    case 136: return "MYS";
    case 153: return "MOZ";
    case 154: return "NAM";
    case 158: return "NCL";
    case 160: return "NER";
    case 162: return "NFK";
    case 31: return "NGA";
    case 159: return "NIC";
    case 13: return "NLD";
    case 23: return "NOR";
    case 156: return "NPL";
    case 155: return "NRU";
    case 161: return "NIU";
    case 27: return "NZL";
    case 164: return "OMN";
    case 168: return "PAN";
    case 171: return "PER";
    case 242: return "PYF";
    case 169: return "PNG";
    case 172: return "PHL";
    case 165: return "PAK";
    case 14: return "POL";
    case 183: return "SPM";
    case 173: return "PCN";
    case 174: return "PRI";
    case 167: return "PSE";
    case 15: return "PRT";
    case 166: return "PLW";
    case 170: return "PRY";
    case 175: return "QAT";
    case 176: return "REU";
    case 36: return "ROU";
    case 190: return "SRB";
    case 177: return "RUS";
    case 178: return "RWA";
    case 188: return "SAU";
    case 194: return "SLB";
    case 191: return "SYC";
    case 198: return "SDN";
    case 18: return "SWE";
    case 25: return "SGP";
    case 247: return "SHN";
    case 193: return "SVN";
    case 200: return "SJM";
    case 37: return "SVK";
    case 192: return "SLE";
    case 186: return "SMR";
    case 189: return "SEN";
    case 195: return "SOM";
    case 199: return "SUR";
    case 187: return "STP";
    case 83: return "SLV";
    case 202: return "SYR";
    case 201: return "SWZ";
    case 213: return "TCA";
    case 67: return "TCD";
    case 243: return "ATF";
    case 33: return "TGO";
    case 206: return "THA";
    case 204: return "TJK";
    case 207: return "TKL";
    case 80: return "TLS";
    case 212: return "TKM";
    case 210: return "TUN";
    case 208: return "TON";
    case 211: return "TUR";
    case 209: return "TTO";
    case 214: return "TUV";
    case 203: return "TWN";
    case 205: return "TZA";
    case 216: return "UKR";
    case 215: return "UGA";
    case 248: return "UMI";
    case 21: return "USA";
    case 218: return "URY";
    case 219: return "UZB";
    case 107: return "VAT";
    case 184: return "VCT";
    case 221: return "VEN";
    case 223: return "VGB";
    case 224: return "VIR";
    case 222: return "VNM";
    case 220: return "VUT";
    case 225: return "WLF";
    case 185: return "WSM";
    case 227: return "YEM";
    case 144: return "MYT";
    case 30: return "ZAF";
    case 228: return "ZMB";
    case 229: return "ZWE";
    default: return "USA";
    }
}
Link to comment
Share on other sites

×
×
  • Create New...