CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Authorize.net returning invlalid state/province error
Pages: [1]

Author Topic: Authorize.net returning invlalid state/province error  (Read 4592 times)

pjosephson

  • Guest
Authorize.net returning invlalid state/province error
June 30, 2007, 11:04:58 am
status
    Payment Processor Error message:
    4: (TESTMODE) A valid billing state/province is required.

I have received this error constantly (in test mode both on/off locally and at authorize.net  & not in test mode) when trying to process an contribution.  I can't get beyond it.  Does anybody know what is going on?

Using Joomla 1.0.12 integration.

Thanks,
Paul Josephson

idealso

  • Guest
Re: Authorize.net returning invlalid state/province error
June 30, 2007, 05:10:37 pm
The details for that error are "This code is applicable to Wells Fargo SecureSource merchants only."  You might need to talk to Authorize.Net support to see exactly what the problem is, and what kind of data they require for this, or how to get around this.

JLong

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 0
Re: Authorize.net returning invlalid state/province error
July 06, 2007, 08:00:12 am
I'm also experiencing this when trying to test-drive a contributions page. I have my Authorize.net account in test mode, and I'm receiving the exact same error message. I just spoke to an Authorize.net rep about it; he said the error indicates an invalid billing state/province, and that the error is not specific to Wells Fargo, but rather to the Authorize.net account type.

I'm at a loss as to how to proceed. Any help is appreciated.

MOD 7/7: I found the same comment that idealso posted about Wells Fargo SecureSource merchants; this was directly from Authorize.net's AIM documentation (revised 5/24/2007). Not sure why the Authorize.net rep told me otherwise.
« Last Edit: July 07, 2007, 09:07:47 am by jtlong »

idealso

  • Guest
Re: Authorize.net returning invlalid state/province error
July 08, 2007, 12:40:20 pm
This error shouldn't be happening, so I'd take a look at the data being submitted.  If you edit CRM/Core/Payment/AuthorizeNet.php, lines 84-88 should be

Code: [Select]
    $postFields = array( );
    $authorizeNetFields = $this->_getAuthorizeNetFields( );
    foreach ( $authorizeNetFields as $field => $value ) {
        $postFields[] = $field . '=' . urlencode( $value );
    }

Immediately after this, put:
Code: [Select]
    echo "<pre>\n"; print_r($postFields); echo "</pre>\n";
    exit();

This will spit out the entire contents of $postFields, and stop processing there so it won't be submitted.  You can see if x_state contains an invalid value.

JLong

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 0
Re: Authorize.net returning invlalid state/province error
July 08, 2007, 03:18:31 pm
Thanks for the guidance. I entered your code as indicated. When I submit the contribution, I get the following (asterisks indicate fields which were correctly populated):
Code: [Select]
Array
(
    [0] => x_login=***
    [1] => x_tran_key==***
    [2] => x_email_customer=FALSE
    [3] => x_first_name=fn20070708
    [4] => x_last_name=ln20070708
    [5] => x_address=138+Lafayette+St
    [6] => x_city=New+York
    [7] => x_state=
    [8] => x_zip=10013
    [9] => x_country=US
    [10] => x_customer_ip==***
    [11] => x_email==***
    [12] => x_invoice_num=b467e8b37651fdebc574
    [13] => x_amount=150.00
    [14] => x_currency_code=USD
    [15] => x_relay_response=FALSE
    [16] => x_delim_data=TRUE
    [17] => x_delim_char=%2C
    [18] => x_encap_char=%22
    [19] => x_card_num=6011000000000012
    [20] => x_card_code=123
    [21] => x_exp_date=12%2F2009
    [22] => x_test_request=TRUE
)

I can see that element 7 is empty. In CRM/Core/Payment/AuthorizeNet.php line 154, I can see where this field is populated, but I'm not sure what civicrm has done with my form entry prior to that point.

Thanks again for the help; I'd appreciate any further suggestions.

idealso

  • Guest
Re: Authorize.net returning invlalid state/province error
July 08, 2007, 05:07:54 pm
To the code added, also do print_r($params);

If you see "state_province" instead of "state" in the params list, then change line 154 accordingly.  Also, does this happen with every state, and can you tell if it happens with PayPal Pro?

JLong

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 0
Re: Authorize.net returning invlalid state/province error
July 08, 2007, 06:49:38 pm
The params list did include "state_province" instead of "state". I changed line 154 to:
Code: [Select]
$fields['x_state'] = $this->_getParam( 'state_province' );
I took out the print_r and exit statements, and ran the test drive again.
This time there was no state/province error, but the processor returned "2: (TESTMODE) Phone is required."

Edited--Sorry, forgot to mention that it was appearing for all states that I tried (four or five). Not sure if there's a problem with PayPal. The only processor I have an account with is Authorize.
« Last Edit: July 08, 2007, 06:54:22 pm by jtlong »

idealso

  • Guest
Re: Authorize.net returning invlalid state/province error
July 10, 2007, 10:02:27 am
I'm not seeing anything anywhere in the Authorize.Net account settings or documentation which indicates that a phone number is required.  I think more info is needed from Authorize.Net

I also did find one other mistake in.  On line 121, change
Code: [Select]
            $errormsg = $result_fields[2] . ' ' . $response_fields[3];

to
Code: [Select]
            $errormsg = $response_fields[2] . ' ' . $response_fields[3];

This will give a slightly more detailed response, including the reason code.  However, even just looking at result code 2, there are only three reasons, all of which are "This transaction has been declined."

JLong

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 0
Re: Authorize.net returning invlalid state/province error
July 10, 2007, 12:06:39 pm
I contacted Authorize.net and found out that our account is a Wells Fargo Secure Source account. Now things are starting to make sense.
Per the Authorize rep, there are additional fields required for this account type:
  • First Name
  • Last Name
  • Address
  • City
  • State
  • Zip Code
  • Country
  • Phone
  • Email
The account type doesn't require any change in the transmission protocol; it just needs the additional fields sent.

idealso

  • Guest
Re: Authorize.net returning invlalid state/province error
July 10, 2007, 12:57:53 pm
All of these fields are already included, except for phone.  A workaround is to create a new profile (call it Phone Number), with a single field (Individuals / Phone / Primary / Phone).  The help text for this field should say to enter the phone number as (xxx) xxx-xxxx.

Make sure you use this profile in all contribution and event pages which accept payment.

Add the following to CRM/Core/Payment/Authorize.Net, in _getAuthorizeNetFields():
Code: [Select]
        $fields['x_phone'] = $this->_getParam( 'phone-Primary-Phone' );

It's not the best solution, but it should work for you.

JLong

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 0
Re: Authorize.net returning invlalid state/province error
July 10, 2007, 05:29:19 pm
This worked. I was able to complete the transaction. I will continue to test and debug, but I think the problem is solved.
Thanks again for all your help. Are there any plans for building a phone number field into this module in the future?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Authorize.net returning invlalid state/province error
July 10, 2007, 05:47:47 pm

Can u file an issue for 2.0 on the issue tracker. That way we wont forget :). yes, we need to figure out how to resolve this in a coherent manner in core civicrm :)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Authorize.net returning invlalid state/province error

This forum was archived on 2017-11-26.